diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ae6e505 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +lua/**/*.lua linguist-generated +lua/nfnl/fennel.lua linguist-vendored +after/**/*.lua linguist-vendored diff --git a/.gitignore b/.gitignore index f209139..bddb8a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /.dev/ -/lua/ /plugin/packer_compiled.lua diff --git a/.nfnl.fnl b/.nfnl.fnl new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.nfnl.fnl @@ -0,0 +1 @@ +{} diff --git a/.projections.json b/.projections.json new file mode 100644 index 0000000..cbd9c5d --- /dev/null +++ b/.projections.json @@ -0,0 +1,52 @@ +{ + "*.fnl": { + "alternate": ["{}.lua"] + }, + "*.lua": { + "alternate": ["{}.fnl"] + }, + "fnl/magic/*.fnl": { + "type": "module", + "template": [ + "; you can update or remove this template in .projections.json", + "", + "(local {open}: autoload : define{close} (require :nfnl.module))", + "", + "; example will be loaded until one of its properties of methods is used", + "(local example (autoload :some-plugin))", + "", + "(local M (define :{}))", + "", + "(fn M.my-function [arg]", + " (comment", + " (example.some-method)))", + + "", + "M" + ], + "alternate": [ + "lua/magic/{}.lua" + ] + }, + "lua/magic/*.lua": { + "alternate": [ + "fnl/magic/{}.fnl" + ] + }, + "fnl/plugins/*.fnl": { + "type": "plugin", + "template": [ + "(import-macros {open}: tx{close} :magic.macros)", + "", + "(tx :plugin-url {open}:opts {open}{close}{close})" + ], + "alternate": [ + "lua/plugins/{}.lua" + ] + }, + "lua/plugins/*.lua": { + "alternate": [ + "fnl/plugins/{}.fnl" + ] + } +} diff --git a/README.adoc b/README.adoc index cc40e8f..615317a 100644 --- a/README.adoc +++ b/README.adoc @@ -1,11 +1,11 @@ = Magic Kit -Neovim starter kit for working with https://github.com/Olical/conjure[Conjure] and https://github.com/Olical/aniseed[Aniseed], contains everything you need to get started. The goal is for you to take this and modify it to fit your needs, it is _not_ a distribution I'll constantly tweak, it's a starting point you should change as you see fit. +Neovim starter kit for working with https://github.com/Olical/conjure[Conjure] and https://github.com/Olical/nfnl[Nfnl], contains everything you need to get started. The goal is for you to take this and modify it to fit your needs, it is _not_ a distribution I'll constantly tweak, it's a starting point you should change as you see fit. == Requirements * git (for cloning the project and managing plugins) - * Neovim 0.7+ + * Neovim 0.11+ == Installation @@ -15,9 +15,8 @@ Neovim starter kit for working with https://github.com/Olical/conjure[Conjure] a # Make sure you don't have anything here already! Back it up if so! git clone git@github.com:Olical/magic-kit.git ~/.config/nvim -# Perform the initial sync which will fetch all of the plugins. -# Run then whenever you change the plugin configuration. -~/.config/nvim/script/sync.sh +# Starting neovim will perform the initial sync which will fetch all of the +# plugins. ---- Once done, have a look at `~/.config/nvim/init.lua` to learn about the bootstrap process then `~/.config/nvim/fnl/magic/init.fnl` for the real beginning of your Fennel based configuration. Good luck! Have fun! @@ -28,10 +27,18 @@ If you press a key and then wait, https://github.com/folke/which-key.nvim[which- * `` is the https://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader[leader key] (``) * `,` is the https://learnvimscriptthehardway.stevelosh.com/chapters/06.html#local-leader[local leader key] (``) - * `f...` finds things with https://github.com/nvim-telescope/telescope.nvim[telescope] + * `f...` finds things with https://github.com/folke/snacks.nvim[snacks] ** Try `ff` to find files and `fb` to find buffers, there's a bunch of mappings so you'll have to experiment and rely on which-key * `ut` opens https://github.com/mbbill/undotree[undotree] +== Navigation + +The https://github.com/tpope/vim-fugitive[vim-fugitive] plugin is included to jump around modules, plugins, sources and generated files. + +You can find or create modules and plugins using `:Emodule ` and `:Eplugin ` respectively. New files will be prepopulated with a template. + +See the vim-fugitive documentation and `.projections.json` for more details. + == Unlicenced > You can change this in your own repository, I don't care! Do what you want with this repository, attribution is appreciated but not required. diff --git a/after/ftplugin/fennel.fnl b/after/ftplugin/fennel.fnl new file mode 100644 index 0000000..51a0ff5 --- /dev/null +++ b/after/ftplugin/fennel.fnl @@ -0,0 +1,4 @@ +(local fennel-lua-paths (require :magic.fennel-lua-paths)) + +(fennel-lua-paths.setup) + diff --git a/after/ftplugin/fennel.lua b/after/ftplugin/fennel.lua new file mode 100644 index 0000000..aad41ea --- /dev/null +++ b/after/ftplugin/fennel.lua @@ -0,0 +1,3 @@ +-- [nfnl] after/ftplugin/fennel.fnl +local fennel_lua_paths = require("magic.fennel-lua-paths") +return fennel_lua_paths.setup() diff --git a/after/ftplugin/lua.fnl b/after/ftplugin/lua.fnl new file mode 100644 index 0000000..51a0ff5 --- /dev/null +++ b/after/ftplugin/lua.fnl @@ -0,0 +1,4 @@ +(local fennel-lua-paths (require :magic.fennel-lua-paths)) + +(fennel-lua-paths.setup) + diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua new file mode 100644 index 0000000..18bbeaf --- /dev/null +++ b/after/ftplugin/lua.lua @@ -0,0 +1,3 @@ +-- [nfnl] after/ftplugin/lua.fnl +local fennel_lua_paths = require("magic.fennel-lua-paths") +return fennel_lua_paths.setup() diff --git a/fnl/magic/fennel-lua-paths.fnl b/fnl/magic/fennel-lua-paths.fnl new file mode 100644 index 0000000..fe9cf44 --- /dev/null +++ b/fnl/magic/fennel-lua-paths.fnl @@ -0,0 +1,19 @@ +(local {: define} (require :nfnl.module)) + +(local M (define :magic.fennel-lua-paths)) + +(local join #(table.concat $1 ",")) + +(fn M.setup [] + (set vim.bo.path (->> (vim.opt.rtp:get) + (vim.tbl_map #(join [$1 (.. $1 "/fnl") (.. $1 "/lua")])) + (join))) + + (set vim.bo.suffixesadd (join [".fnl" + "/init.fnl" + ".lua" + "/init.lua"])) + + (set vim.bo.includeexpr "tr(v:fname, '.', '/')")) + +M diff --git a/fnl/magic/init.fnl b/fnl/magic/init.fnl index e696122..c0499f4 100644 --- a/fnl/magic/init.fnl +++ b/fnl/magic/init.fnl @@ -1,10 +1,6 @@ -(module magic.init - {autoload {plugin magic.plugin - nvim aniseed.nvim}}) - ;;; Introduction -;; Aniseed compiles this (and all other Fennel files under fnl) into the lua +;; Nfnl compiles this (and all other Fennel files under fnl) into the lua ;; directory. The init.lua file is configured to load this file when ready. ;; We'll use modules, macros and functions to define our configuration and @@ -14,68 +10,10 @@ ;; You can learn all about Conjure and how to evaluate things by executing ;; :ConjureSchool in your Neovim. This will launch an interactive tutorial. - -;;; Generic configuration - -(set nvim.o.termguicolors true) -(set nvim.o.mouse "a") -(set nvim.o.updatetime 500) -(set nvim.o.timeoutlen 500) -(set nvim.o.sessionoptions "blank,curdir,folds,help,tabpages,winsize") -(set nvim.o.inccommand :split) - -(nvim.ex.set :spell) -(nvim.ex.set :list) - - -;;; Mappings - -(set nvim.g.mapleader " ") -(set nvim.g.maplocalleader ",") - +(require :magic.options) +(require :magic.mappings) ;;; Plugins - -;; Run script/sync.sh to update, install and clean your plugins. -;; Packer configuration format: https://github.com/wbthomason/packer.nvim -(plugin.use - :Olical/aniseed {} - :Olical/conjure {} - :Olical/nvim-local-fennel {} - :PaterJason/cmp-conjure {} - :PeterRincker/vim-argumentative {} - :airblade/vim-gitgutter {} - :clojure-vim/clojure.vim {} - :clojure-vim/vim-jack-in {} - :folke/which-key.nvim {:mod :which-key} - :ggandor/lightspeed.nvim {} - :guns/vim-sexp {:mod :sexp} - :hrsh7th/cmp-buffer {} - :hrsh7th/cmp-cmdline {} - :hrsh7th/cmp-nvim-lsp {} - :hrsh7th/cmp-path {} - :hrsh7th/nvim-cmp {:mod :cmp} - :jiangmiao/auto-pairs {:mod :auto-pairs} - :lewis6991/impatient.nvim {} - :liuchengxu/vim-better-default {:mod :better-default} - :marko-cerovac/material.nvim {:mod :material} - :mbbill/undotree {:mod :undotree} - :neovim/nvim-lspconfig {:mod :lspconfig} - :nvim-lualine/lualine.nvim {:mod :lualine} - :nvim-telescope/telescope.nvim {:mod :telescope :requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]]} - :nvim-treesitter/nvim-treesitter {:mod :treesitter} - :radenling/vim-dispatch-neovim {} - :tpope/vim-abolish {} - :tpope/vim-commentary {} - :tpope/vim-dispatch {} - :tpope/vim-eunuch {} - :tpope/vim-fugitive {} - :tpope/vim-repeat {} - :tpope/vim-sexp-mappings-for-regular-people {} - :tpope/vim-sleuth {} - :tpope/vim-surround {} - :tpope/vim-unimpaired {} - :tpope/vim-vinegar {} - :w0rp/ale {:mod :ale} - :wbthomason/packer.nvim {} - ) +(local lazy (require :lazy)) +;; Any file under the `fnl/plugins/` directory will be loaded as a plugin. +(lazy.setup :plugins {}) diff --git a/fnl/magic/macros.fnl b/fnl/magic/macros.fnl index 6ff9ed2..dc7e7ac 100644 --- a/fnl/magic/macros.fnl +++ b/fnl/magic/macros.fnl @@ -1,6 +1,4 @@ -;; Trick vim-sleuth into using the right indentation for this file. -(do - true) +;; [nfnl-macro] ;; These macro functions are executed at compile time to transform our code, ;; add more expressive syntax and create domain specific languages. @@ -9,8 +7,7 @@ ;; compiler. ;; Example: -; (module my.fennel.module -; {require-macros [magic.macros]}) +; (import-macros {: some-macro} :magic.macros) ; (some-macro 123) ;; I consider this to be an advanced concept within Lisp languages but one you @@ -26,17 +23,42 @@ {;; This is just a silly example macro. ; (infix-example-macro 2 + 3) => compiles to: (+ 2 3) => evaluates to: 5 - :infix-example-macro - (fn [x op y] + (fn infix-example-macro [x op y] `(,op ,x ,y)) ;; Create an augroup for your autocmds. ; (augroup my-group ; (nvim.ex.autocmd ...)) - :augroup - (fn [name ...] + (fn augroup [name ...] `(do (vim.cmd (.. "augroup " ,(tostring name) "\nautocmd!")) ,... (vim.cmd "augroup END") nil))} + +(fn tx [...] + " + Merge sequential and key-value tables. + + For example, in Lua, we can write: + + {'some-string', a = 1, b = 2} + + And automatically store the string with a numeric key. + + Fennel can't mix both, so to generate the table above, + we would call it as: + + (tx :some-string {:a 1 :b 2}) + " + (local input [...]) + (local last-index (length input)) + (local props (. input last-index)) + (each [i v (ipairs input)] + (if (~= i last-index) + (tset props i v))) + `(-> ,props)) + +{: infix-example-macro + : augroup + : tx} diff --git a/fnl/magic/mappings.fnl b/fnl/magic/mappings.fnl new file mode 100644 index 0000000..18e8bdb --- /dev/null +++ b/fnl/magic/mappings.fnl @@ -0,0 +1,60 @@ +;;; Mappings + +(local {: autoload} (require :nfnl.module)) +(local {: lmap : nmap} (require :magic.util)) +(local snacks (autoload :snacks)) + +(set vim.g.mapleader " ") +(set vim.g.maplocalleader ",") + +;; finders +(lmap :f : {:desc :find}) +(lmap :ff #(snacks.picker.files) {:desc "files"}) +(lmap :f- #(snacks.explorer.reveal) {:desc "current file"}) +(lmap :fg #(snacks.picker.grep) {:desc "live grep"}) +(lmap :* #(snacks.picker.grep_word) {:desc "grep word"}) +(lmap :fb #(snacks.picker.buffers) {:desc "buffers"}) +(lmap :fh #(snacks.picker.help) {:desc "help"}) +(lmap :fm #(snacks.picker.keymaps) {:desc "keymaps"}) +(lmap :fM #(snacks.picker.marks) {:desc "marks"}) +(lmap :fo #(snacks.picker.recent) {:desc "old files"}) +(lmap :fc #(snacks.picker.commands) {:desc "commands"}) +(lmap :fC #(snacks.picker.command_history) {:desc "command history"}) +(lmap :fq #(snacks.picker.qflist) {:desc "quickfix"}) +(lmap :fl #(snacks.picker.loclist) {:desc "loclist"}) +(lmap :fs #(snacks.picker) {:desc "snacks pickers"}) + +;; lsp +(lmap :l : {:desc :lsp}) +(lmap :la #(snacks.picker.lsp_code_actions) {:desc "code actions"}) +(lmap :li #(snacks.picker.lsp_implementations) {:desc "implementations"}) +(lmap :lf #(snacks.picker.lsp_references) {:desc "find references"}) +(lmap :lt #(snacks.picker.lsp_type_definitions) {:desc "type definitions"}) +(lmap :ls #(snacks.picker.lsp_document_symbols) {:desc "document symbols"}) +(lmap :lS #(snacks.picker.lsp_workspace_symbols) {:desc "workspace symbols"}) +(lmap :lr #(vim.lsp.buf.rename) {:desc "rename"}) +(lmap :lf #(vim.lsp.buf.format {:async true}) {:desc "format"}) +(lmap :lh #(vim.lsp.buf.hover) {:desc "hover"}) +(lmap :ld #(vim.lsp.buf.definition) {:desc "definition"}) +(lmap :lD #(vim.lsp.buf.declaration) {:desc "declaration"}) + +;; diagnostics +(lmap :d : {:desc :diagnostics}) +(lmap :dn #(vim.diagnostic.jump {:count 1 :float true}) {:desc "next"}) +(lmap :dp #(vim.diagnostic.jump {:count -1 :float true}) {:desc "previous"}) + +;; notifications +(lmap :n : {:desc :notifications}) +(lmap :no #(snacks.picker.notifications) {:desc "open"}) +(lmap :nd #(snacks.notifier.hide) {:desc "dismiss"}) + +;; git +(lmap :g : {:desc :git}) +(lmap :gg :Git {:desc "status"}) +(lmap :gb "Git blame" {:desc "blame"}) +(lmap :gw "Gwrite" {:desc "write"}) +(lmap :gr "Gread" {:desc "read"}) + +;; special cases +(nmap :l :Lazy {:desc :Lazy}) +(nmap :c #(snacks.picker.files {:dirs [(vim.fs.dirname vim.env.MYVIMRC)]}) {:desc "Neovim config"}) diff --git a/fnl/magic/options.fnl b/fnl/magic/options.fnl new file mode 100644 index 0000000..40ac3ff --- /dev/null +++ b/fnl/magic/options.fnl @@ -0,0 +1,21 @@ +;;; General options + +(set vim.o.termguicolors true) +(set vim.o.mouse "a") +(set vim.o.updatetime 500) +(set vim.o.timeoutlen 500) +(set vim.o.sessionoptions "blank,curdir,folds,help,tabpages,winsize") +(set vim.o.inccommand :split) +(set vim.o.spell false) +(set vim.o.list true) + +;;; Better defaults +(set vim.o.number false) +(set vim.o.relativenumber false) +(set vim.o.wrap true) +(set vim.o.cursorline false) +(set vim.o.wildmode :full) +(set vim.o.wildoptions :pum) + +(comment + (vim.o.clipboard :unnamedplus)) diff --git a/fnl/magic/plugin.fnl b/fnl/magic/plugin.fnl deleted file mode 100644 index 616683b..0000000 --- a/fnl/magic/plugin.fnl +++ /dev/null @@ -1,36 +0,0 @@ -(module magic.plugin - {autoload {a aniseed.core - packer packer}}) - -(defn- safe-require-plugin-config [name] - "Safely require a module under the magic.plugin.* prefix. Will catch errors - and print them while continuing execution, allowing other plugins to load - even if one configuration module is broken." - (let [(ok? val-or-err) (pcall require (.. "magic.plugin." name))] - (when (not ok?) - (print (.. "Plugin config error: " val-or-err))))) - -(defn req [name] - "A shortcut to building a require string for your plugin - configuration. Intended for use with packer's config or setup - configuration options. Will prefix the name with `magic.plugin.` - before requiring." - (.. "require('magic.plugin." name "')")) - -(defn use [...] - "Iterates through the arguments as pairs and calls packer's use function for - each of them. Works around Fennel not liking mixed associative and sequential - tables as well. - - This is just a helper / syntax sugar function to make interacting with packer - a little more concise." - (let [pkgs [...]] - (packer.startup - (fn [use] - (for [i 1 (a.count pkgs) 2] - (let [name (. pkgs i) - opts (. pkgs (+ i 1))] - (-?> (. opts :mod) (safe-require-plugin-config)) - (use (a.assoc opts 1 name))))))) - - nil) diff --git a/fnl/magic/plugin/ale.fnl b/fnl/magic/plugin/ale.fnl deleted file mode 100644 index d73df9e..0000000 --- a/fnl/magic/plugin/ale.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(module magic.plugin.ale - {autoload {nvim aniseed.nvim}}) - -(set nvim.g.ale_linters - {:clojure [:clj-kondo :joker]}) diff --git a/fnl/magic/plugin/auto-pairs.fnl b/fnl/magic/plugin/auto-pairs.fnl deleted file mode 100644 index 1ff5e29..0000000 --- a/fnl/magic/plugin/auto-pairs.fnl +++ /dev/null @@ -1,15 +0,0 @@ -(module magic.plugin.auto-pairs - {autoload {nvim aniseed.nvim} - require-macros [magic.macros]}) - -(defn setup [] - (let [auto-pairs nvim.g.AutoPairs] - (when auto-pairs - (tset auto-pairs "'" nil) - (tset auto-pairs "`" nil) - (set nvim.b.AutoPairs auto-pairs)))) - -(augroup auto-pairs-config - (nvim.ex.autocmd - :FileType "clojure,fennel,scheme" - (.. "call v:lua.require('" *module-name* "').setup()"))) diff --git a/fnl/magic/plugin/better-default.fnl b/fnl/magic/plugin/better-default.fnl deleted file mode 100644 index 0bdfc1c..0000000 --- a/fnl/magic/plugin/better-default.fnl +++ /dev/null @@ -1,17 +0,0 @@ -(module magic.plugin.better-default - {autoload {nvim aniseed.nvim}}) - -(set nvim.g.vim_better_default_persistent_undo true) -(nvim.ex.runtime_ "plugin/default.vim") - -(nvim.ex.set :nonumber) -(nvim.ex.set :norelativenumber) -(nvim.ex.set :wrap) -(nvim.ex.set :nocursorline) -(nvim.ex.set "wildmode=full") -(nvim.ex.set "wildoptions=pum") -(nvim.ex.set "listchars-=eol:↵") - -(set nvim.o.undodir (.. (nvim.fn.stdpath "data") "/undo")) - -(nvim.ex.set "clipboard-=unnamedplus") diff --git a/fnl/magic/plugin/cmp.fnl b/fnl/magic/plugin/cmp.fnl deleted file mode 100644 index 7cb97a2..0000000 --- a/fnl/magic/plugin/cmp.fnl +++ /dev/null @@ -1,18 +0,0 @@ -(module dotfiles.plugin.cmp - {autoload {nvim aniseed.nvim}}) - -(set nvim.o.completeopt "menuone,noselect") - -(let [(ok? cmp) (pcall require :cmp)] - (when ok? - (cmp.setup - {:sources [{:name "conjure"} - {:name "nvim_lsp"} - {:name "buffer"} - {:name "path"}] - :mapping (cmp.mapping.preset.insert - {"" (cmp.mapping.scroll_docs -4) - "" (cmp.mapping.scroll_docs 4) - "" (cmp.mapping.complete) - "" (cmp.mapping.abort) - "" (cmp.mapping.confirm {:select true})})}))) diff --git a/fnl/magic/plugin/lspconfig.fnl b/fnl/magic/plugin/lspconfig.fnl deleted file mode 100644 index 781001f..0000000 --- a/fnl/magic/plugin/lspconfig.fnl +++ /dev/null @@ -1,29 +0,0 @@ -(module magic.plugin.lspconfig - {autoload {util magic.util - nvim aniseed.nvim}}) - -(defn- map [from to] - (util.nnoremap from to)) - -(let [(ok? lsp) (pcall #(require :lspconfig))] - (when ok? - (lsp.clojure_lsp.setup {}) - (lsp.tsserver.setup {}) - (lsp.pylsp.setup {}) - (lsp.bashls.setup {}) - (lsp.lua_ls.setup - {:cmd ["lua-language-server"] - :settings {:Lua {:telemetry {:enable false}}}}) - - ;; https://www.chrisatmachine.com/Neovim/27-native-lsp/ - (map :gd "lua vim.lsp.buf.definition()") - (map :gD "lua vim.lsp.buf.declaration()") - (map :gr "lua vim.lsp.buf.references()") - (map :gi "lua vim.lsp.buf.implementation()") - (map :K "lua vim.lsp.buf.hover()") - (map : "lua vim.lsp.buf.signature_help()") - (map : "lua vim.diagnostic.goto_prev()") - (map : "lua vim.diagnostic.goto_next()") - - (map :lr "lua vim.lsp.buf.rename()") - (map :lf "lua vim.lsp.buf.format({async = true})"))) diff --git a/fnl/magic/plugin/lualine.fnl b/fnl/magic/plugin/lualine.fnl deleted file mode 100644 index ea31012..0000000 --- a/fnl/magic/plugin/lualine.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(module magic.plugin.lualine) - -(let [(ok? lualine) (pcall require :lualine)] - (when ok? - (lualine.setup))) diff --git a/fnl/magic/plugin/material.fnl b/fnl/magic/plugin/material.fnl deleted file mode 100644 index dee8f95..0000000 --- a/fnl/magic/plugin/material.fnl +++ /dev/null @@ -1,12 +0,0 @@ -(module magic.plugin.material - {autoload {nvim aniseed.nvim}}) - -(let [(ok? material) (pcall #(require :material))] - (when ok? - (material.setup - {:custom_highlights {:FloatBorder {:fg "#1A1A1A"}} - :borders true - :high_visibility {:darker true}}) - - (set nvim.g.material_style :darker) - (nvim.ex.colorscheme :material))) diff --git a/fnl/magic/plugin/sexp.fnl b/fnl/magic/plugin/sexp.fnl deleted file mode 100644 index 0e5419a..0000000 --- a/fnl/magic/plugin/sexp.fnl +++ /dev/null @@ -1,4 +0,0 @@ -(module magic.plugin.sexp - {autoload {nvim aniseed.nvim}}) - -(set nvim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,janet") diff --git a/fnl/magic/plugin/telescope.fnl b/fnl/magic/plugin/telescope.fnl deleted file mode 100644 index 5bcfe19..0000000 --- a/fnl/magic/plugin/telescope.fnl +++ /dev/null @@ -1,33 +0,0 @@ -(module magic.plugin.telescope - {autoload {nvim aniseed.nvim - util magic.util}}) - -(let [(ok? telescope) (pcall #(require :telescope))] - (when ok? - (telescope.setup - {:defaults - {:vimgrep_arguments ["rg" "--color=never" "--no-heading" - "--with-filename" "--line-number" "--column" - "--smart-case" "--hidden" "--follow" - "-g" "!.git/"]}}) - - (util.lnnoremap :ff "Telescope find_files hidden=true") - (util.lnnoremap :f- "Telescope file_browser") - (util.lnnoremap :fg "Telescope live_grep") - (util.lnnoremap :* "Telescope grep_string") - (util.lnnoremap :fb "Telescope buffers") - (util.lnnoremap :fH "Telescope help_tags") - (util.lnnoremap :fm "Telescope keymaps") - (util.lnnoremap :fM "Telescope marks") - (util.lnnoremap :fh "Telescope oldfiles") - (util.lnnoremap :ft "Telescope filetypes") - (util.lnnoremap :fc "Telescope commands") - (util.lnnoremap :fC "Telescope command_history") - (util.lnnoremap :fq "Telescope quickfix") - (util.lnnoremap :fl "Telescope loclist") - (util.lnnoremap :fsa "Telescope lsp_code_actions") - (util.lnnoremap :fsi "Telescope lsp_implementations") - (util.lnnoremap :fsr "Telescope lsp_references") - (util.lnnoremap :fsS "Telescope lsp_document_symbols") - (util.lnnoremap :fss "Telescope lsp_workspace_symbols"))) - diff --git a/fnl/magic/plugin/treesitter.fnl b/fnl/magic/plugin/treesitter.fnl deleted file mode 100644 index e3bd4e3..0000000 --- a/fnl/magic/plugin/treesitter.fnl +++ /dev/null @@ -1,8 +0,0 @@ -(module magic.plugin.treesitter) - -(let [(ok? ts) (pcall require :nvim-treesitter.configs)] - (when ok? - (ts.setup - {:indent {:enable true} - :highlight {:enable true - :additional_vim_regex_highlighting false}}))) diff --git a/fnl/magic/plugin/undotree.fnl b/fnl/magic/plugin/undotree.fnl deleted file mode 100644 index 0b43f6c..0000000 --- a/fnl/magic/plugin/undotree.fnl +++ /dev/null @@ -1,9 +0,0 @@ -(module magic.plugin.undotree - {autoload {nvim aniseed.nvim}}) - -(nvim.set_keymap - :n - :ut - ":UndotreeShow:UndotreeFocus" - {:noremap true - :silent true}) diff --git a/fnl/magic/plugin/which-key.fnl b/fnl/magic/plugin/which-key.fnl deleted file mode 100644 index fa66ea9..0000000 --- a/fnl/magic/plugin/which-key.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(module magic.plugin.which-key) - -(let [(ok? which-key) (pcall #(require :which-key))] - (when ok? - (which-key.setup {}))) diff --git a/fnl/magic/util.fnl b/fnl/magic/util.fnl index 5481279..1873b6b 100644 --- a/fnl/magic/util.fnl +++ b/fnl/magic/util.fnl @@ -1,27 +1,31 @@ -(module magic.util - {autoload {nvim aniseed.nvim - a aniseed.core}}) +(local {: define} (require :nfnl.module)) -(defn expand [path] - (nvim.fn.expand path)) +(local M (define :magic.util)) -(defn glob [path] - (nvim.fn.glob path true true true)) +(fn M.expand [path] + (vim.fn.expand path)) -(defn exists? [path] - (= (nvim.fn.filereadable path) 1)) +(fn M.glob [path] + (vim.fn.glob path true true true)) -(defn lua-file [path] - (nvim.ex.luafile path)) +(fn M.exists? [path] + (= (vim.fn.filereadable path) 1)) -(def config-path (nvim.fn.stdpath "config")) +(set M.config-path (vim.fn.stdpath :config)) -(defn nnoremap [from to opts] - (let [map-opts {:noremap true} - to (.. ":" to "")] - (if (a.get opts :local?) - (nvim.buf_set_keymap 0 :n from to map-opts) - (nvim.set_keymap :n from to map-opts)))) +(fn M.nmap [from to opts] + (vim.keymap.set :n from to opts)) -(defn lnnoremap [from to] - (nnoremap (.. "" from) to)) +(fn M.vmap [from to opts] + (vim.keymap.set :v from to opts)) + +(fn M.imap [from to opts] + (vim.keymap.set :i from to opts)) + +(fn M.tmap [from to opts] + (vim.keymap.set :t from to opts)) + +(fn M.lmap [from to opts] + (M.nmap (.. : from) to opts)) + +M diff --git a/fnl/plugins/colorscheme.fnl b/fnl/plugins/colorscheme.fnl new file mode 100644 index 0000000..40fc6b6 --- /dev/null +++ b/fnl/plugins/colorscheme.fnl @@ -0,0 +1,9 @@ +(import-macros {: tx} :magic.macros) +(local {: autoload} (require :nfnl.module)) +(local catppuccin (autoload :catppuccin)) + +(tx :catppuccin/nvim {:name :catppuccin + :opts {:flavour :frappe + :transparent_background false + :term_colors true} + :init #(vim.cmd.colorscheme :catppuccin)}) diff --git a/fnl/plugins/completion.fnl b/fnl/plugins/completion.fnl new file mode 100644 index 0000000..8d8d388 --- /dev/null +++ b/fnl/plugins/completion.fnl @@ -0,0 +1,21 @@ +(import-macros {: tx} :magic.macros) +(local {: autoload} (require :nfnl.module)) +(local cmp (autoload :cmp)) + +(tx :hrsh7th/nvim-cmp {:dependencies [:hrsh7th/cmp-nvim-lsp + :hrsh7th/cmp-buffer + :PaterJason/cmp-conjure] + :event :InsertEnter + :init (fn [] + (set vim.opt.completeopt [:menuone :noselect :popup :fuzzy])) + :opts (fn [] + {:sources [{:name :conjure} + {:name :nvim_lsp} + {:name :buffer} + {:name :path}] + :mapping (cmp.mapping.preset.insert + {: (cmp.mapping.scroll_docs -4) + : (cmp.mapping.scroll_docs 4) + : (cmp.mapping.complete) + : (cmp.mapping.abort) + : (cmp.mapping.confirm {:select true})})})}) diff --git a/fnl/plugins/conjure.fnl b/fnl/plugins/conjure.fnl new file mode 100644 index 0000000..42c8551 --- /dev/null +++ b/fnl/plugins/conjure.fnl @@ -0,0 +1,3 @@ +(import-macros {: tx} :magic.macros) + +(tx :Olical/conjure {:branch :main}) diff --git a/fnl/plugins/editing.fnl b/fnl/plugins/editing.fnl new file mode 100644 index 0000000..748e681 --- /dev/null +++ b/fnl/plugins/editing.fnl @@ -0,0 +1,7 @@ +(import-macros {: tx} :magic.macros) + +[:tpope/vim-eunuch + :tpope/vim-repeat + :tpope/vim-surround + :tpope/vim-sleuth + :tpope/vim-unimpaired] diff --git a/fnl/plugins/fennel.fnl b/fnl/plugins/fennel.fnl new file mode 100644 index 0000000..fdd9d27 --- /dev/null +++ b/fnl/plugins/fennel.fnl @@ -0,0 +1,3 @@ +(import-macros {: tx} :magic.macros) + +(tx :Olical/nfnl {:ft :fennel}) diff --git a/fnl/plugins/git.fnl b/fnl/plugins/git.fnl new file mode 100644 index 0000000..c56d722 --- /dev/null +++ b/fnl/plugins/git.fnl @@ -0,0 +1,12 @@ +(import-macros {: tx} :magic.macros) + +[:tpope/vim-git + + (tx :tpope/vim-fugitive {:dependencies [:tpope/vim-rhubarb]}) + + (tx :lewis6991/gitsigns.nvim {:opts {:signcolumn true + :current_line_blame true}}) + + ;; sets the genterated files as readonly, based on the rules defined in + ;; .gitattributes + (tx :davidmh/gitattributes.nvim {:opts {}})] diff --git a/fnl/plugins/lsp.fnl b/fnl/plugins/lsp.fnl new file mode 100644 index 0000000..5c49952 --- /dev/null +++ b/fnl/plugins/lsp.fnl @@ -0,0 +1,12 @@ +(import-macros {: tx} :magic.macros) +(local {: autoload} (require :nfnl.module)) +(local lsp (autoload :lspconfig)) + +(tx :neovim/nvim-lspconfig + {:config (fn config [] + (lsp.clojure_lsp.setup {}) + (lsp.ts_ls.setup {}) + (lsp.pylsp.setup {}) + (lsp.bashls.setup {}) + (lsp.lua_ls.setup + {:settings {:Lua {:telemetry {:enable false}}}}))}) diff --git a/fnl/plugins/nfnl.fnl b/fnl/plugins/nfnl.fnl new file mode 100644 index 0000000..a0edcaa --- /dev/null +++ b/fnl/plugins/nfnl.fnl @@ -0,0 +1,3 @@ +; Nfnl is bootstraped on startup when missing, but we want to let +; lazy.nvim mange its updates by defining it here as well. +[:Olical/nfnl] diff --git a/fnl/plugins/parpar.fnl b/fnl/plugins/parpar.fnl new file mode 100644 index 0000000..ad27082 --- /dev/null +++ b/fnl/plugins/parpar.fnl @@ -0,0 +1,8 @@ +(import-macros {: tx} :magic.macros) + +;; Blends Parinfer and Paredit modes together for the best lisp editing +;; experience. +(tx :dundalek/parpar.nvim {:dependencies [:gpanders/nvim-parinfer + :julienvincent/nvim-paredit] + :opts {:use_default_keys true} + :ft [:clojure :fennel :query :lisp]}) diff --git a/fnl/plugins/projectionist.fnl b/fnl/plugins/projectionist.fnl new file mode 100644 index 0000000..83b4b1f --- /dev/null +++ b/fnl/plugins/projectionist.fnl @@ -0,0 +1 @@ +[:tpope/vim-projectionist] diff --git a/fnl/plugins/snacks.fnl b/fnl/plugins/snacks.fnl new file mode 100644 index 0000000..33a9017 --- /dev/null +++ b/fnl/plugins/snacks.fnl @@ -0,0 +1,15 @@ +(import-macros {: tx} :magic.macros) + +(tx :folke/snacks.nvim {:lazy false + :priority 1000 + :opts {:bigfile {:enabled true} + :statuscolumn {:enabled true} + :input {:enabled true + :win {:relative :cursor + :col 0 + :row 1}} + :notifier {:enabled true + :style :fancy + :margin {:bottom 2} + :top_down false} + :picker {:sources {:files {:hidden true}}}}}) diff --git a/fnl/plugins/status-line.fnl b/fnl/plugins/status-line.fnl new file mode 100644 index 0000000..f97f638 --- /dev/null +++ b/fnl/plugins/status-line.fnl @@ -0,0 +1,3 @@ +(import-macros {: tx} :magic.macros) + +(tx :nvim-lualine/lualine.nvim {:opts {}}) diff --git a/fnl/plugins/tree-sitter.fnl b/fnl/plugins/tree-sitter.fnl new file mode 100644 index 0000000..9bc7e06 --- /dev/null +++ b/fnl/plugins/tree-sitter.fnl @@ -0,0 +1,11 @@ +(import-macros {: tx} :magic.macros) +(local {: autoload} (require :nfnl.module)) +(local configs (autoload :nvim-treesitter.configs)) + +(tx :nvim-treesitter/nvim-treesitter {:build ::TSUpdate + :init #(configs.setup {:indent {:enable true} + :ensure_installed [:fennel + ;; add other languages here + :lua] + :highlight {:enable true + :additional_vim_regex_highlighting false}})}) diff --git a/fnl/plugins/undotree.fnl b/fnl/plugins/undotree.fnl new file mode 100644 index 0000000..6a03d08 --- /dev/null +++ b/fnl/plugins/undotree.fnl @@ -0,0 +1,7 @@ +(import-macros {: tx} :magic.macros) + +(tx :mbbill/undotree {:event :VeryLazy + :keys [(tx :ut + :UndotreeShowUndotreeFocus + {:mode :n + :silent true})]}) diff --git a/fnl/plugins/which-key.fnl b/fnl/plugins/which-key.fnl new file mode 100644 index 0000000..ddd4992 --- /dev/null +++ b/fnl/plugins/which-key.fnl @@ -0,0 +1,9 @@ +(import-macros {: tx} :magic.macros) +(local {: autoload} (require :nfnl.module)) +(local which-key (autoload :which-key)) + +(tx :folke/which-key.nvim {:event :VeryLazy + :keys [(tx :? + #(which-key.show {:global false}) + {:desc "Buffer Local Keymaps (which-key)"})] + :opts {}}) diff --git a/init.lua b/init.lua index b928d5f..4e70ac3 100644 --- a/init.lua +++ b/init.lua @@ -4,32 +4,31 @@ -- This will allow us to load more Fennel based code and download more plugins. -- Make some modules easier to access. -local execute = vim.api.nvim_command local fn = vim.fn local fmt = string.format --- Work out where our plugins will be stored. -local pack_path = fn.stdpath("data") .. "/site/pack" +local data_path = fn.stdpath("data") -function ensure (user, repo) - -- Ensures a given github.com/USER/REPO is cloned in the pack/packer/start directory. - local install_path = fmt("%s/packer/start/%s", pack_path, repo, repo) +---@param user string +---@param repo string +---@param alias string? +local function ensure(user, repo, alias) + -- Ensures a given github.com/USER/REPO is cloned in the lazy directory. + local install_path = fmt("%s/lazy/%s", data_path, (alias or repo)) + local repo_url = fmt("https://github.com/%s/%s.git", user, repo) if fn.empty(fn.glob(install_path)) > 0 then - execute(fmt("!git clone https://github.com/%s/%s %s", user, repo, install_path)) - execute(fmt("packadd %s", repo)) + vim.system({ "git", "clone", "--filter=blob:none", "--single-branch", repo_url, install_path }, {}):wait() end + return vim.opt.runtimepath:prepend(install_path) end --- Packer is our plugin manager. -ensure("wbthomason", "packer.nvim") +-- Lazy.nvim is our plugin manager. +ensure("folke", "lazy.nvim") --- Aniseed compiles our Fennel code to Lua and loads it automatically. -ensure("Olical", "aniseed") +-- Nfnl compiles our Fennel code to Lua and loads it automatically. +ensure("Olical", "nfnl") --- Enable Aniseed's automatic compilation and loading of Fennel source code. --- Aniseed looks for this when it's loaded then loads the rest of your --- configuration if it's set. -vim.g["aniseed#env"] = {module = "magic.init"} +require("magic.init") -- Now head to fnl/magic/init.fnl to continue your journey. -- Try pressing gf on the file path to [g]o to the [f]ile. diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..7c10b89 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "catppuccin": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-conjure": { "branch": "master", "commit": "8c9a88efedc0e5bf3165baa6af8a407afe29daf6" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "conjure": { "branch": "main", "commit": "15063cc166a9f407c46ee73b3e05c3389678e84d" }, + "gitattributes.nvim": { "branch": "main", "commit": "3f9b6afe13675e9be0f55aa720d9ea60b5de5dbf" }, + "gitsigns.nvim": { "branch": "main", "commit": "056d5ea359efe35c4e25e2ebcc255117ac86500d" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, + "nfnl": { "branch": "main", "commit": "6bcfdc4ab9f23c381590d78fa55ee79abebbe9c5" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" }, + "nvim-paredit": { "branch": "master", "commit": "a7b22f211cd96fc8a4bb2c40eff5eeb04ce332ea" }, + "nvim-parinfer": { "branch": "master", "commit": "5ca09287ab3f4144f78ff7977fabc27466f71044" }, + "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, + "parpar.nvim": { "branch": "main", "commit": "e99a88f0f0b1234f49a3efe9c49b712b58a5acfc" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "vim-eunuch": { "branch": "master", "commit": "e86bb794a1c10a2edac130feb0ea590a00d03f1e" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-git": { "branch": "master", "commit": "485e38f29494e46a9998100e707c755d114155f1" }, + "vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" }, + "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, + "vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/lua/magic/fennel-lua-paths.lua b/lua/magic/fennel-lua-paths.lua new file mode 100644 index 0000000..fd625aa --- /dev/null +++ b/lua/magic/fennel-lua-paths.lua @@ -0,0 +1,19 @@ +-- [nfnl] fnl/magic/fennel-lua-paths.fnl +local _local_1_ = require("nfnl.module") +local define = _local_1_["define"] +local M = define("magic.fennel-lua-paths") +local join +local function _2_(_241) + return table.concat(_241, ",") +end +join = _2_ +M.setup = function() + local function _3_(_241) + return join({_241, (_241 .. "/fnl"), (_241 .. "/lua")}) + end + vim.bo.path = join(vim.tbl_map(_3_, vim.opt.rtp:get())) + vim.bo.suffixesadd = join({".fnl", "/init.fnl", ".lua", "/init.lua"}) + vim.bo.includeexpr = "tr(v:fname, '.', '/')" + return nil +end +return M diff --git a/lua/magic/init.lua b/lua/magic/init.lua new file mode 100644 index 0000000..ad18d90 --- /dev/null +++ b/lua/magic/init.lua @@ -0,0 +1,5 @@ +-- [nfnl] fnl/magic/init.fnl +require("magic.options") +require("magic.mappings") +local lazy = require("lazy") +return lazy.setup("plugins", {}) diff --git a/lua/magic/mappings.lua b/lua/magic/mappings.lua new file mode 100644 index 0000000..b51dd5b --- /dev/null +++ b/lua/magic/mappings.lua @@ -0,0 +1,139 @@ +-- [nfnl] fnl/magic/mappings.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local _local_2_ = require("magic.util") +local lmap = _local_2_["lmap"] +local nmap = _local_2_["nmap"] +local snacks = autoload("snacks") +vim.g.mapleader = " " +vim.g.maplocalleader = "," +lmap("f", "", {desc = "find"}) +local function _3_() + return snacks.picker.files() +end +lmap("ff", _3_, {desc = "files"}) +local function _4_() + return snacks.explorer.reveal() +end +lmap("f-", _4_, {desc = "current file"}) +local function _5_() + return snacks.picker.grep() +end +lmap("fg", _5_, {desc = "live grep"}) +local function _6_() + return snacks.picker.grep_word() +end +lmap("*", _6_, {desc = "grep word"}) +local function _7_() + return snacks.picker.buffers() +end +lmap("fb", _7_, {desc = "buffers"}) +local function _8_() + return snacks.picker.help() +end +lmap("fh", _8_, {desc = "help"}) +local function _9_() + return snacks.picker.keymaps() +end +lmap("fm", _9_, {desc = "keymaps"}) +local function _10_() + return snacks.picker.marks() +end +lmap("fM", _10_, {desc = "marks"}) +local function _11_() + return snacks.picker.recent() +end +lmap("fo", _11_, {desc = "old files"}) +local function _12_() + return snacks.picker.commands() +end +lmap("fc", _12_, {desc = "commands"}) +local function _13_() + return snacks.picker.command_history() +end +lmap("fC", _13_, {desc = "command history"}) +local function _14_() + return snacks.picker.qflist() +end +lmap("fq", _14_, {desc = "quickfix"}) +local function _15_() + return snacks.picker.loclist() +end +lmap("fl", _15_, {desc = "loclist"}) +local function _16_() + return snacks.picker() +end +lmap("fs", _16_, {desc = "snacks pickers"}) +lmap("l", "", {desc = "lsp"}) +local function _17_() + return snacks.picker.lsp_code_actions() +end +lmap("la", _17_, {desc = "code actions"}) +local function _18_() + return snacks.picker.lsp_implementations() +end +lmap("li", _18_, {desc = "implementations"}) +local function _19_() + return snacks.picker.lsp_references() +end +lmap("lf", _19_, {desc = "find references"}) +local function _20_() + return snacks.picker.lsp_type_definitions() +end +lmap("lt", _20_, {desc = "type definitions"}) +local function _21_() + return snacks.picker.lsp_document_symbols() +end +lmap("ls", _21_, {desc = "document symbols"}) +local function _22_() + return snacks.picker.lsp_workspace_symbols() +end +lmap("lS", _22_, {desc = "workspace symbols"}) +local function _23_() + return vim.lsp.buf.rename() +end +lmap("lr", _23_, {desc = "rename"}) +local function _24_() + return vim.lsp.buf.format({async = true}) +end +lmap("lf", _24_, {desc = "format"}) +local function _25_() + return vim.lsp.buf.hover() +end +lmap("lh", _25_, {desc = "hover"}) +local function _26_() + return vim.lsp.buf.definition() +end +lmap("ld", _26_, {desc = "definition"}) +local function _27_() + return vim.lsp.buf.declaration() +end +lmap("lD", _27_, {desc = "declaration"}) +lmap("d", "", {desc = "diagnostics"}) +local function _28_() + return vim.diagnostic.jump({count = 1, float = true}) +end +lmap("dn", _28_, {desc = "next"}) +local function _29_() + return vim.diagnostic.jump({count = -1, float = true}) +end +lmap("dp", _29_, {desc = "previous"}) +lmap("n", "", {desc = "notifications"}) +local function _30_() + return snacks.picker.notifications() +end +lmap("no", _30_, {desc = "open"}) +local function _31_() + return snacks.notifier.hide() +end +lmap("nd", _31_, {desc = "dismiss"}) +lmap("g", "", {desc = "git"}) +lmap("gg", "Git", {desc = "status"}) +lmap("gb", "Git blame", {desc = "blame"}) +lmap("gw", "Gwrite", {desc = "write"}) +lmap("gr", "Gread", {desc = "read"}) +nmap("l", "Lazy", {desc = "Lazy"}) +local function _32_() + return snacks.picker.files({dirs = {vim.fs.dirname(vim.env.MYVIMRC)}}) +end +return nmap("c", _32_, {desc = "Neovim config"}) diff --git a/lua/magic/options.lua b/lua/magic/options.lua new file mode 100644 index 0000000..0e1ec37 --- /dev/null +++ b/lua/magic/options.lua @@ -0,0 +1,17 @@ +-- [nfnl] fnl/magic/options.fnl +vim.o.termguicolors = true +vim.o.mouse = "a" +vim.o.updatetime = 500 +vim.o.timeoutlen = 500 +vim.o.sessionoptions = "blank,curdir,folds,help,tabpages,winsize" +vim.o.inccommand = "split" +vim.o.spell = false +vim.o.list = true +vim.o.number = false +vim.o.relativenumber = false +vim.o.wrap = true +vim.o.cursorline = false +vim.o.wildmode = "full" +vim.o.wildoptions = "pum" +--[[ (vim.o.clipboard "unnamedplus") ]] +return nil diff --git a/lua/magic/util.lua b/lua/magic/util.lua new file mode 100644 index 0000000..a879497 --- /dev/null +++ b/lua/magic/util.lua @@ -0,0 +1,30 @@ +-- [nfnl] fnl/magic/util.fnl +local _local_1_ = require("nfnl.module") +local define = _local_1_["define"] +local M = define("magic.util") +M.expand = function(path) + return vim.fn.expand(path) +end +M.glob = function(path) + return vim.fn.glob(path, true, true, true) +end +M["exists?"] = function(path) + return (vim.fn.filereadable(path) == 1) +end +M["config-path"] = vim.fn.stdpath("config") +M.nmap = function(from, to, opts) + return vim.keymap.set("n", from, to, opts) +end +M.vmap = function(from, to, opts) + return vim.keymap.set("v", from, to, opts) +end +M.imap = function(from, to, opts) + return vim.keymap.set("i", from, to, opts) +end +M.tmap = function(from, to, opts) + return vim.keymap.set("t", from, to, opts) +end +M.lmap = function(from, to, opts) + return M.nmap(("" .. from), to, opts) +end +return M diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..76f328b --- /dev/null +++ b/lua/plugins/colorscheme.lua @@ -0,0 +1,8 @@ +-- [nfnl] fnl/plugins/colorscheme.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local catppuccin = autoload("catppuccin") +local function _2_() + return vim.cmd.colorscheme("catppuccin") +end +return {"catppuccin/nvim", name = "catppuccin", opts = {flavour = "frappe", term_colors = true, transparent_background = false}, init = _2_} diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua new file mode 100644 index 0000000..50627e1 --- /dev/null +++ b/lua/plugins/completion.lua @@ -0,0 +1,12 @@ +-- [nfnl] fnl/plugins/completion.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local cmp = autoload("cmp") +local function _2_() + vim.opt.completeopt = {"menuone", "noselect", "popup", "fuzzy"} + return nil +end +local function _3_() + return {sources = {{name = "conjure"}, {name = "nvim_lsp"}, {name = "buffer"}, {name = "path"}}, mapping = cmp.mapping.preset.insert({[""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({select = true})})} +end +return {"hrsh7th/nvim-cmp", dependencies = {"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "PaterJason/cmp-conjure"}, event = "InsertEnter", init = _2_, opts = _3_} diff --git a/lua/plugins/conjure.lua b/lua/plugins/conjure.lua new file mode 100644 index 0000000..3b672f8 --- /dev/null +++ b/lua/plugins/conjure.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/conjure.fnl +return {"Olical/conjure", branch = "main"} diff --git a/lua/plugins/editing.lua b/lua/plugins/editing.lua new file mode 100644 index 0000000..9d351b1 --- /dev/null +++ b/lua/plugins/editing.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/editing.fnl +return {"tpope/vim-eunuch", "tpope/vim-repeat", "tpope/vim-surround", "tpope/vim-sleuth", "tpope/vim-unimpaired"} diff --git a/lua/plugins/fennel.lua b/lua/plugins/fennel.lua new file mode 100644 index 0000000..0a94799 --- /dev/null +++ b/lua/plugins/fennel.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/fennel.fnl +return {"Olical/nfnl", ft = "fennel"} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..0eae46d --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/git.fnl +return {"tpope/vim-git", {"tpope/vim-fugitive", dependencies = {"tpope/vim-rhubarb"}}, {"lewis6991/gitsigns.nvim", opts = {signcolumn = true, current_line_blame = true}}, {"davidmh/gitattributes.nvim", opts = {}}} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..63334e8 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,12 @@ +-- [nfnl] fnl/plugins/lsp.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local lsp = autoload("lspconfig") +local function config() + lsp.clojure_lsp.setup({}) + lsp.ts_ls.setup({}) + lsp.pylsp.setup({}) + lsp.bashls.setup({}) + return lsp.lua_ls.setup({settings = {Lua = {telemetry = {enable = false}}}}) +end +return {"neovim/nvim-lspconfig", config = config} diff --git a/lua/plugins/nfnl.lua b/lua/plugins/nfnl.lua new file mode 100644 index 0000000..96632e2 --- /dev/null +++ b/lua/plugins/nfnl.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/nfnl.fnl +return {"Olical/nfnl"} diff --git a/lua/plugins/parpar.lua b/lua/plugins/parpar.lua new file mode 100644 index 0000000..55aea95 --- /dev/null +++ b/lua/plugins/parpar.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/parpar.fnl +return {"dundalek/parpar.nvim", dependencies = {"gpanders/nvim-parinfer", "julienvincent/nvim-paredit"}, opts = {use_default_keys = true}, ft = {"clojure", "fennel", "query", "lisp"}} diff --git a/lua/plugins/projectionist.lua b/lua/plugins/projectionist.lua new file mode 100644 index 0000000..03235e4 --- /dev/null +++ b/lua/plugins/projectionist.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/projectionist.fnl +return {"tpope/vim-projectionist"} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..eae46ce --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/snacks.fnl +return {"folke/snacks.nvim", priority = 1000, opts = {bigfile = {enabled = true}, statuscolumn = {enabled = true}, input = {enabled = true, win = {relative = "cursor", col = 0, row = 1}}, notifier = {enabled = true, style = "fancy", margin = {bottom = 2}, top_down = false}, picker = {sources = {files = {hidden = true}}}}, lazy = false} diff --git a/lua/plugins/status-line.lua b/lua/plugins/status-line.lua new file mode 100644 index 0000000..2bec116 --- /dev/null +++ b/lua/plugins/status-line.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/status-line.fnl +return {"nvim-lualine/lualine.nvim", opts = {}} diff --git a/lua/plugins/tree-sitter.lua b/lua/plugins/tree-sitter.lua new file mode 100644 index 0000000..3fdc3bb --- /dev/null +++ b/lua/plugins/tree-sitter.lua @@ -0,0 +1,8 @@ +-- [nfnl] fnl/plugins/tree-sitter.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local configs = autoload("nvim-treesitter.configs") +local function _2_() + return configs.setup({indent = {enable = true}, ensure_installed = {"fennel", "lua"}, highlight = {enable = true, additional_vim_regex_highlighting = false}}) +end +return {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate", init = _2_} diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..defc2ec --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,2 @@ +-- [nfnl] fnl/plugins/undotree.fnl +return {"mbbill/undotree", event = "VeryLazy", keys = {{"ut", "UndotreeShowUndotreeFocus", mode = "n", silent = true}}} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..921ba1d --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,8 @@ +-- [nfnl] fnl/plugins/which-key.fnl +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local which_key = autoload("which-key") +local function _2_() + return which_key.show({global = false}) +end +return {"folke/which-key.nvim", event = "VeryLazy", keys = {{"?", _2_, desc = "Buffer Local Keymaps (which-key)"}}, opts = {}} diff --git a/script/sync.sh b/script/sync.sh deleted file mode 100755 index 1deac28..0000000 --- a/script/sync.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -NVIM_CMD=${NVIM_CMD:-nvim} -LUA_DIR=${LUA_DIR:-$HOME/.config/nvim/lua} -$NVIM_CMD +qa -$NVIM_CMD +"au User PackerComplete qa" +PackerSync +TSUpdateSync $@ diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..0435f67 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,2 @@ +indent_type = "Spaces" +indent_width = 2