diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-12-19 21:57:03 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-12-19 21:57:03 +0100 |
commit | 7cfec10601bd2f611651a86175240d2394a204ff (patch) | |
tree | 6f3890328c418ddec12193eaad46acbe9f0c4c11 /fnl/plugins | |
parent | a355b32ec773d6fd830e1e18362d9e9de7ed5b75 (diff) |
Add blink.cmp
Diffstat (limited to 'fnl/plugins')
-rw-r--r-- | fnl/plugins/cmp.fnl | 71 | ||||
-rw-r--r-- | fnl/plugins/lsp/lspconfig.fnl | 2 | ||||
-rw-r--r-- | fnl/plugins/lsp/mason-lspconfig.fnl | 14 |
3 files changed, 17 insertions, 70 deletions
diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl index 6375967..9ba119f 100644 --- a/fnl/plugins/cmp.fnl +++ b/fnl/plugins/cmp.fnl @@ -1,66 +1,13 @@ ;; Configuration for completion plugin. -(local dependencies [:L3MON4D3/LuaSnip - :f3fora/cmp-spell - :hrsh7th/cmp-buffer - :hrsh7th/cmp-cmdline - :hrsh7th/cmp-path - :onsails/lspkind.nvim - :saadparwaiz1/cmp_luasnip]) +(local opts + {:keymap {:preset :default} + :appearance {:use_nvim_cmp_as_default true :nerd_font_variant :mono} + :sources {:default {:lsp :path :snippets :buffer}} + :menu {:border :single :scrollbar false} + :documentation {:window {:border :single :scrollbar false}} + :signature {:enabled true :window {:border :single :scrollbar false}}}) -(λ config [] - (let [cmp (require :cmp) - lspkind (require :lspkind)] - (lspkind.init) - (cmp.setup {:snippet {:expand (λ [args] - (let [luasnip (require :luasnip)] - (luasnip.lsp_expand args.body)))} - :completion {:completopt "menu,menuone,noinsert"} - :mapping (cmp.mapping.preset.insert {:<c-n> (cmp.mapping.select_prev_item {:behavior cmp.SelectBehavior.Insert}) - :<c-e> (cmp.mapping.select_next_item {:behavior cmp.SelectBehavior.Insert}) - :<c-y> (cmp.mapping (cmp.mapping.confirm {:behavior cmp.SelectBehavior.Insert - :select true} - [:i - :c]))}) - :sources [{:name :nvim_lsp - :group_index 1 - :keyword_length 3 - :max_item_count 32} - {:name :buffer :group_index 2} - {:name :spell :group_index 3} - {:name :nvim_lua} - {:name :luasnip :group_index 1 :keyword_length 1} - {:name :path :keyword_length 6}] - :performance {:debounce 60 - :throttle 50 - :fetching_timeout 80 - :max_view_entries 16}}) - (cmp.setup.filetype [:org :orgagenda] - {:sources [{:name :orgmode :group_index 1} - {:name :buffer :group_index 2} - {:name :luasnip - :group_index 1 - :keyword_length 1} - {:name :spell :group_index 3}]}) - (cmp.setup.filetype [:sql] - {:sources [{:name :vim-dadbod-completion - :group_index 1} - {:name :buffer :group_index 2} - {:name :luasnip - :group_index 1 - :keyword_length 1} - {:name :spell :group_index 3}]}) - (cmp.setup.cmdline "/" - {:mapping (cmp.mapping.preset.cmdline) - :sources [{:name :buffer}]}) - (cmp.setup.cmdline ":" - {:mapping (cmp.mapping.preset.cmdline) - :sources [{:name :path} - {:name :cmdline - :option {:ignore_cmds [:Man "!"]}}]}))) +(local dependencies [:rafamadriz/friendly-snippets]) -{1 :iguanacucumber/magazine.nvim - :name :nvim-cmp - : dependencies - :event :InsertEnter - : config} +{1 :saghen/blink.cmp :version :v0.* : dependencies :event :InsertEnter : opts} diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl index 112973b..5cd25d4 100644 --- a/fnl/plugins/lsp/lspconfig.fnl +++ b/fnl/plugins/lsp/lspconfig.fnl @@ -21,5 +21,5 @@ :dependencies [:mason.nvim :williamboman/mason-lspconfig.nvim :b0o/schemastore.nvim - :hrsh7th/cmp-nvim-lsp] + :saghen/blink.cmp] : config} diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl index 105693e..fbf3d1d 100644 --- a/fnl/plugins/lsp/mason-lspconfig.fnl +++ b/fnl/plugins/lsp/mason-lspconfig.fnl @@ -2,16 +2,16 @@ ;; setup hooks for client configurations. (λ capabilities [] - (let [cmp-lsp (require :cmp_nvim_lsp)] - (cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities)))) + (let [blink-cmp (require :blink.cmp)] + (blink-cmp.get_lsp_capabilities))) (λ handlers [server] (let [servers (require :plugins.lsp.servers) - lspconfig (require :lspconfig)] - (let [config (. lspconfig server) - opts (or (. servers server) {})] - (tset opts :capabilities (capabilities)) - (config.setup opts)))) + lspconfigs (require :lspconfig)] + (let [lspconfig (. lspconfigs server) + server-config (or (. servers server) {})] + (tset server-config :capabilities (capabilities)) + (lspconfig.setup server-config)))) (λ setup [] (let [mason-lspconfig (require :mason-lspconfig) |