diff --git a/fnl/plugin.fnl b/fnl/plugin.fnl index ecff2d3..a62a260 100644 --- a/fnl/plugin.fnl +++ b/fnl/plugin.fnl @@ -14,13 +14,17 @@ ;; Treesitter (use! :nvim-treesitter/nvim-treesitter + :requires :p00f/nvim-ts-rainbow :config #(setup! "nvim-treesitter.configs" :ensure_installed :all :sync_install false :auto_install true :highlight { :enable true :additional_vim_regex_highlighting false } - :indent { :enable true })) + :indent { :enable true } + :rainbow { :enable true + :extended_mode true + :max_file_lines nil })) ;; nightfox.nvim (colorscheme) (use! :EdenEast/nightfox.nvim @@ -140,6 +144,7 @@ {}) (bind! :n :go find-other.find_other_current_buffer)))) + ;; illuminate (same symbol highlight) (use! :RRethy/vim-illuminate :config (fn [] (module-call! :illuminate :configure) @@ -157,6 +162,17 @@ :IlluminatedWordText {})))) + ;; vlime (lisp environment) + (use! :vlime/vlime + :config (fn [] + (set vim.g.vlime_cl_impl :my_sbcl) + (set vim.g.vlime_address [ "127.0.0.1" 52842 ]) + (vim.cmd "function! VlimeBuildServerCommandFor_my_sbcl(vlime_loader, vlime_eval) + return [ \"/usr/bin/sbcl\", + \\ \"--load\", a:vlime_loader, + \\ \"--eval\", \"(vlime:main :port 52842)\" ] + endfunction"))) + ;; Snippy (use! :dcampos/nvim-snippy :config #(let [map (require :snippy.mapping)] @@ -169,6 +185,7 @@ :hrsh7th/cmp-path :hrsh7th/cmp-cmdline :hrsh7th/cmp-nvim-lsp + :HiPhish/nvim-cmp-vlime { 1 :ray-x/cmp-treesitter :after :nvim-cmp } :dcampos/cmp-snippy ] diff --git a/fnl/plugin/cmp.fnl b/fnl/plugin/cmp.fnl index bee19cd..3a37d7c 100644 --- a/fnl/plugin/cmp.fnl +++ b/fnl/plugin/cmp.fnl @@ -4,77 +4,84 @@ { :configure #(let [cmp (require :cmp) compare (require :cmp.config.compare)] - (cmp.setup - { :snippet { - :expand #(module-call! :snippy :expand_snippet $1.body) } - :mapping { - : (cmp.mapping (cmp.mapping.scroll_docs -4) - [ :i :c ]) - : (cmp.mapping (cmp.mapping.scroll_docs 4) - [ :i :c ]) - : (cmp.mapping (cmp.mapping.complete) - [ :i :c ]) - : (cmp.mapping (cmp.mapping.abort) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.confirm { :select false }) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_next_item - { :behavior cmp.SelectBehavior.Select }) + (cmp.setup + { :snippet { + :expand #(module-call! :snippy :expand_snippet $1.body) } + :mapping { + : (cmp.mapping (cmp.mapping.scroll_docs -4) + [ :i :c ]) + : (cmp.mapping (cmp.mapping.scroll_docs 4) + [ :i :c ]) + : (cmp.mapping (cmp.mapping.complete) + [ :i :c ]) + : (cmp.mapping (cmp.mapping.abort) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.confirm { :select false }) [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_prev_item - { :behavior cmp.SelectBehavior.Select }) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_next_item - { :behavior cmp.SelectBehavior.Select }) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_prev_item - { :behavior cmp.SelectBehavior.Select }) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_next_item - { :behavior cmp.SelectBehavior.Select }) - [ :i :c ]) - : (cmp.mapping - (cmp.mapping.select_prev_item - { :behavior cmp.SelectBehavior.Select }) - [ :i :c ]) } - :formatting { - :format (fn [entry vim_item] - (tset vim_item :menu - (. { :nvim_lsp "[LSP]" - :treesitter "[TS]" - :snippy "[Snippy]" - :buffer "[Buffer]" - :path "[Path]" } - entry.source.name)) - vim_item) - } - :sources [{ :name "nvim_lsp" :priority 2 :group 1 } - { :name "snippy" :priority 2 :group 2 } - { :name "treesitter" :priority 1 :group 3 } - { :name "buffer" :priority 0 :group 3 } - { :name "path" :priority 0 :group 4 }] - :view { - :entries { :name "custom" :selection_order "near_cursor" }} - :sorting { - :priority_weight 2 - :comparators [ - compare.score - compare.locality - compare.recently_used - compare.offset - compare.order - ; compare.scopes - ; compare.exact - ; compare.sort_text - ; compare.kind - ; compare.length - ]}}) + : (cmp.mapping + (cmp.mapping.select_next_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.select_prev_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.select_next_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.select_prev_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.select_next_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) + : (cmp.mapping + (cmp.mapping.select_prev_item + { :behavior cmp.SelectBehavior.Select }) + [ :i :c ]) } + :formatting { + :format (fn [entry vim_item] + (tset vim_item :menu + (. { :nvim_lsp "[LSP]" + :treesitter "[TS]" + :snippy "[Snippy]" + :buffer "[Buffer]" + :path "[Path]" + :vlime "[Vlime]" } + entry.source.name)) + vim_item) + } + :sources [{ :name "snippy" :priority 2 :group 1 } + { :name "treesitter" :priority 1 :group 2 } + { :name "buffer" :priority 0 :group 3 } + { :name "path" :priority 0 :group 4 }] + :view { + :entries { :name "custom" :selection_order "near_cursor" }} + :sorting { + :priority_weight 2 + :comparators [ + compare.score + compare.locality + compare.recently_used + compare.offset + compare.order + ; compare.scopes + ; compare.exact + ; compare.sort_text + ; compare.kind + ; compare.length + ]}}) + (cmp.setup.filetype [ :lisp ] + { :option { :fuzzy false } + :sources + [{ :name "vlime" :priority 2 :group 1 } + { :name "snippy" :priority 2 :group 2 } + { :name "buffer" :priority 0 :group 3 } + { :name "path" :priority 0 :group 4 }]}) (cmp.setup.cmdline "/" { :mapping (cmp.mapping.preset.cmdline) :sources (cmp.config.sources diff --git a/fnl/plugin/lsp.fnl b/fnl/plugin/lsp.fnl index fd81bc7..937fd63 100644 --- a/fnl/plugin/lsp.fnl +++ b/fnl/plugin/lsp.fnl @@ -3,6 +3,11 @@ (import-macros {: bind!} :macros) (fn on-attach [_ buf] + ((. (. (require :cmp) :setup) :buffer) { + :sources [{ :name "nvim_lsp" :priority 1 :group 1 } + { :name "snippy" :priority 1 :group 2 } + { :name "buffer" :priority 0 :group 3 } + { :name "path" :priority 0 :group 4 }]}) (bind! :n :gD vim.lsp.buf.declaration buf) (bind! :n :gd vim.lsp.buf.definition buf) (bind! :n :K vim.lsp.buf.hover buf)