From 8bb781db165ebc7b8dfebc001c332fa46d7e5eae Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 14 May 2024 23:36:16 +0200 Subject: Update cmp --- fnl/plugins/cmp.fnl | 69 ++++++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) (limited to 'fnl/plugins') diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl index 65acb58..24beee0 100644 --- a/fnl/plugins/cmp.fnl +++ b/fnl/plugins/cmp.fnl @@ -1,15 +1,13 @@ ;; Configuration for completion plugin. -(local dependencies [:hrsh7th/cmp-buffer - :onsails/lspkind-nvim - :hrsh7th/cmp-nvim-lsp +(local dependencies [:L3MON4D3/LuaSnip + :f3fora/cmp-spell + :hrsh7th/cmp-buffer :hrsh7th/cmp-cmdline - :petertriho/cmp-git - :L3MON4D3/LuaSnip - :rafamadriz/friendly-snippets :hrsh7th/cmp-path - :saadparwaiz1/cmp_luasnip - :f3fora/cmp-spell]) + :onsails/lspkind.nvim + :rafamadriz/friendly-snippets + :saadparwaiz1/cmp_luasnip]) (fn config [] (let [cmp (require :cmp) @@ -21,20 +19,12 @@ (cmp.setup {:snippet {:expand (fn [args] (luasnip.lsp_expand args.body))} :completion {:completopt "menu,menuone,noinsert"} - :mapping (cmp.mapping.preset.insert {: (cmp.mapping.select_prev_item) - : (cmp.mapping.select_next_item) - : (cmp.mapping (cmp.mapping.scroll_docs -1) - [:i - :c]) - : (cmp.mapping (cmp.mapping.scroll_docs 1) - [:i - :c]) - : (cmp.mapping (cmp.mapping.complete) - [:i - :c]) - : (cmp.mapping {:i (cmp.mapping.abort) - :c (cmp.mapping.close)}) - : (cmp.mapping.confirm {:select true})}) + :mapping (cmp.mapping.preset.insert {: (cmp.mapping.select_prev_item {:behavior cmp.SelectBehavior.Insert}) + : (cmp.mapping.select_next_item {:behavior cmp.SelectBehavior.Insert}) + : (cmp.mapping (cmp.mapping.confirm {:behavior cmp.SelectBehavior.Insert + :select true} + [:i + :c]))}) :sources [{:name :nvim_lsp :group_index 1 :keyword_length 3 @@ -43,33 +33,20 @@ {:name :spell :group_index 3} {:name :nvim_lua} {:name :luasnip} - {:name :orgmode} - {:name :neorg} - {:name :path :keyword_length 6} - {:name :vim-dadbod-completion} - {:name :git}] - :formatting {:format (lspkind.cmp_format {:with_text true - :menu {:buffer "" - :nvim_lsp "" - :nvim_lua "" - :path "" - :luasnip ""}})} - :window {:documentation {:border ["╭" - "─" - "╮" - "│" - "╯" - "─" - "╰" - "│"]} - :completion {:scrollbar false}} - :confirm_opts {:behavior cmp.ConfirmBehavior.Replace - :select false} + {:name :path :keyword_length 6}] :performance {:debounce 200 :throttle 250 :fetching_timeout 80 - :max_view_entries 16} - :experimental {:ghost_text false :native_menu false}}) + :max_view_entries 16}}) + (cmp.setup.filetype [:org :orgagenda] + {:sources [{:name :orgmode :group_index 1} + {:name :buffer :group_index 2} + {:name :spell :group_index 3}]}) + (cmp.setup.filetype [:sql] + {:sources [{:name :vim-dadbod-completion + :group_index 1} + {:name :buffer :group_index 2} + {:name :spell :group_index 3}]}) (cmp.setup.cmdline "/" {:mapping (cmp.mapping.preset.cmdline) :sources [{:name :buffer}]}) -- cgit v1.2.3-70-g09d2