@@ -194,7 +194,7 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
194194vim .keymap .set (' n' , ' <C-j>' , ' <C-w><C-j>' , { desc = ' Move focus to the lower window' })
195195vim .keymap .set (' n' , ' <C-k>' , ' <C-w><C-k>' , { desc = ' Move focus to the upper window' })
196196
197- -- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes
197+ -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
198198-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
199199-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
200200-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
@@ -614,11 +614,7 @@ require('lazy').setup({
614614
615615 -- Document existing key chains
616616 spec = {
617- { ' <leader>c' , group = ' [C]ode' , mode = { ' n' , ' x' } },
618- { ' <leader>d' , group = ' [D]ocument' },
619- { ' <leader>r' , group = ' [R]ename' },
620617 { ' <leader>s' , group = ' [S]earch' },
621- { ' <leader>w' , group = ' [W]orkspace' },
622618 { ' <leader>t' , group = ' [T]oggle' },
623619 { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
624620 },
@@ -635,7 +631,6 @@ require('lazy').setup({
635631 { -- Fuzzy Finder (files, lsp, etc)
636632 ' nvim-telescope/telescope.nvim' ,
637633 event = ' VimEnter' ,
638- branch = ' 0.1.x' ,
639634 dependencies = {
640635 ' nvim-lua/plenary.nvim' ,
641636 { -- If encountering errors, see telescope-fzf-native README for installation instructions
@@ -764,8 +759,8 @@ require('lazy').setup({
764759 -- Useful status updates for LSP.
765760 { ' j-hui/fidget.nvim' , opts = {} },
766761
767- -- Allows extra capabilities provided by nvim- cmp
768- ' hrsh7th/ cmp-nvim-lsp ' ,
762+ -- Allows extra capabilities provided by blink. cmp
763+ ' saghen/blink. cmp' ,
769764 },
770765 config = function ()
771766 -- Brief aside: **What is LSP?**
@@ -810,42 +805,42 @@ require('lazy').setup({
810805 vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
811806 end
812807
813- -- Jump to the definition of the word under your cursor.
814- -- This is where a variable was first declared, or where a function is defined, etc.
815- -- To jump back, press <C-t>.
816- map (' gd' , require (' telescope.builtin' ).lsp_definitions , ' [G]oto [D]efinition' )
808+ -- Rename the variable under your cursor.
809+ -- Most Language Servers support renaming across files, etc.
810+ map (' grn' , vim .lsp .buf .rename , ' [R]e[n]ame' )
811+
812+ -- Execute a code action, usually your cursor needs to be on top of an error
813+ -- or a suggestion from your LSP for this to activate.
814+ map (' gra' , vim .lsp .buf .code_action , ' [G]oto Code [A]ction' , { ' n' , ' x' })
817815
818816 -- Find references for the word under your cursor.
819- map (' gr ' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
817+ map (' grr ' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
820818
821819 -- Jump to the implementation of the word under your cursor.
822820 -- Useful when your language has ways of declaring types without an actual implementation.
823- map (' gI ' , require (' telescope.builtin' ).lsp_implementations , ' [G]oto [I]mplementation' )
821+ map (' gri ' , require (' telescope.builtin' ).lsp_implementations , ' [G]oto [I]mplementation' )
824822
825- -- Jump to the type of the word under your cursor.
826- -- Useful when you're not sure what type a variable is and you want to see
827- -- the definition of its *type*, not where it was *defined*.
828- map (' <leader>D' , require (' telescope.builtin' ).lsp_type_definitions , ' Type [D]efinition' )
823+ -- Jump to the definition of the word under your cursor.
824+ -- This is where a variable was first declared, or where a function is defined, etc.
825+ -- To jump back, press <C-t>.
826+ map (' grd' , require (' telescope.builtin' ).lsp_definitions , ' [G]oto [D]efinition' )
827+
828+ -- WARN: This is not Goto Definition, this is Goto Declaration.
829+ -- For example, in C this would take you to the header.
830+ map (' grD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
829831
830832 -- Fuzzy find all the symbols in your current document.
831833 -- Symbols are things like variables, functions, types, etc.
832- map (' <leader>ds ' , require (' telescope.builtin' ).lsp_document_symbols , ' [D]ocument [S]ymbols ' )
834+ map (' gO ' , require (' telescope.builtin' ).lsp_document_symbols , ' Open Document Symbols ' )
833835
834836 -- Fuzzy find all the symbols in your current workspace.
835837 -- Similar to document symbols, except searches over your entire project.
836- map (' <leader>ws' , require (' telescope.builtin' ).lsp_dynamic_workspace_symbols , ' [W]orkspace [S]ymbols' )
837-
838- -- Rename the variable under your cursor.
839- -- Most Language Servers support renaming across files, etc.
840- map (' <leader>rn' , vim .lsp .buf .rename , ' [R]e[n]ame' )
841-
842- -- Execute a code action, usually your cursor needs to be on top of an error
843- -- or a suggestion from your LSP for this to activate.
844- map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' , { ' n' , ' x' })
838+ map (' gW' , require (' telescope.builtin' ).lsp_dynamic_workspace_symbols , ' Open Workspace Symbols' )
845839
846- -- WARN: This is not Goto Definition, this is Goto Declaration.
847- -- For example, in C this would take you to the header.
848- map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
840+ -- Jump to the type of the word under your cursor.
841+ -- Useful when you're not sure what type a variable is and you want to see
842+ -- the definition of its *type*, not where it was *defined*.
843+ map (' grt' , require (' telescope.builtin' ).lsp_type_definitions , ' [G]oto [T]ype Definition' )
849844
850845 -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
851846 --- @param client vim.lsp.Client
@@ -932,10 +927,9 @@ require('lazy').setup({
932927
933928 -- LSP servers and clients are able to communicate to each other what features they support.
934929 -- By default, Neovim doesn't support everything that is in the LSP specification.
935- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
936- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
937- local capabilities = vim .lsp .protocol .make_client_capabilities ()
938- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
930+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
931+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
932+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
939933
940934 -- Enable the following language servers
941935 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -1054,12 +1048,14 @@ require('lazy').setup({
10541048 },
10551049
10561050 { -- Autocompletion
1057- ' hrsh7th/nvim-cmp' ,
1058- event = ' InsertEnter' ,
1051+ ' saghen/blink.cmp' ,
1052+ event = ' VimEnter' ,
1053+ version = ' 1.*' ,
10591054 dependencies = {
1060- -- Snippet Engine & its associated nvim-cmp source
1055+ -- Snippet Engine
10611056 {
10621057 ' L3MON4D3/LuaSnip' ,
1058+ version = ' 2.*' ,
10631059 build = (function ()
10641060 -- Build Step is needed for regex support in snippets.
10651061 -- This step is not supported in many windows environments.
@@ -1080,95 +1076,74 @@ require('lazy').setup({
10801076 -- end,
10811077 -- },
10821078 },
1079+ opts = {},
10831080 },
1084- ' saadparwaiz1/cmp_luasnip' ,
1085-
1086- -- Adds other completion capabilities.
1087- -- nvim-cmp does not ship with all sources by default. They are split
1088- -- into multiple repos for maintenance purposes.
1089- ' hrsh7th/cmp-nvim-lsp' ,
1090- ' hrsh7th/cmp-path' ,
1091- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
1081+ ' folke/lazydev.nvim' ,
10921082 },
1093- config = function ()
1094- -- See `:help cmp`
1095- local cmp = require ' cmp'
1096- local luasnip = require ' luasnip'
1097- luasnip .config .setup {}
1098-
1099- cmp .setup {
1100- snippet = {
1101- expand = function (args )
1102- luasnip .lsp_expand (args .body )
1103- end ,
1104- },
1105- completion = { completeopt = ' menu,menuone,noinsert' },
1106-
1107- -- For an understanding of why these mappings were
1108- -- chosen, you will need to read `:help ins-completion`
1083+ --- @module ' blink.cmp'
1084+ --- @type blink.cmp.Config
1085+ opts = {
1086+ keymap = {
1087+ -- 'default' (recommended) for mappings similar to built-in completions
1088+ -- <c-y> to accept ([y]es) the completion.
1089+ -- This will auto-import if your LSP supports it.
1090+ -- This will expand snippets if the LSP sent a snippet.
1091+ -- 'super-tab' for tab to accept
1092+ -- 'enter' for enter to accept
1093+ -- 'none' for no mappings
1094+ --
1095+ -- For an understanding of why the 'default' preset is recommended,
1096+ -- you will need to read `:help ins-completion`
11091097 --
11101098 -- No, but seriously. Please read `:help ins-completion`, it is really good!
1111- mapping = cmp .mapping .preset .insert {
1112- -- Select the [n]ext item
1113- [' <C-n>' ] = cmp .mapping .select_next_item (),
1114- -- Select the [p]revious item
1115- [' <C-p>' ] = cmp .mapping .select_prev_item (),
1116-
1117- -- Scroll the documentation window [b]ack / [f]orward
1118- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
1119- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
1120-
1121- -- Accept ([y]es) the completion.
1122- -- This will auto-import if your LSP supports it.
1123- -- This will expand snippets if the LSP sent a snippet.
1124- [' <C-y>' ] = cmp .mapping .confirm { select = true },
1125-
1126- -- If you prefer more traditional completion keymaps,
1127- -- you can uncomment the following lines
1128- -- ['<CR>'] = cmp.mapping.confirm { select = true },
1129- -- ['<Tab>'] = cmp.mapping.select_next_item(),
1130- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
1131-
1132- -- Manually trigger a completion from nvim-cmp.
1133- -- Generally you don't need this, because nvim-cmp will display
1134- -- completions whenever it has completion options available.
1135- [' <C-Space>' ] = cmp .mapping .complete {},
1136-
1137- -- Think of <c-l> as moving to the right of your snippet expansion.
1138- -- So if you have a snippet that's like:
1139- -- function $name($args)
1140- -- $body
1141- -- end
1142- --
1143- -- <c-l> will move you to the right of each of the expansion locations.
1144- -- <c-h> is similar, except moving you backwards.
1145- [' <C-l>' ] = cmp .mapping (function ()
1146- if luasnip .expand_or_locally_jumpable () then
1147- luasnip .expand_or_jump ()
1148- end
1149- end , { ' i' , ' s' }),
1150- [' <C-h>' ] = cmp .mapping (function ()
1151- if luasnip .locally_jumpable (- 1 ) then
1152- luasnip .jump (- 1 )
1153- end
1154- end , { ' i' , ' s' }),
1099+ --
1100+ -- All presets have the following mappings:
1101+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
1102+ -- <c-space>: Open menu or open docs if already open
1103+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
1104+ -- <c-e>: Hide menu
1105+ -- <c-k>: Toggle signature help
1106+ --
1107+ -- See :h blink-cmp-config-keymap for defining your own keymap
1108+ preset = ' default' ,
11551109
1156- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
1157- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
1158- },
1159- sources = {
1160- {
1161- name = ' lazydev' ,
1162- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
1163- group_index = 0 ,
1164- },
1165- { name = ' nvim_lsp' },
1166- { name = ' luasnip' },
1167- { name = ' path' },
1168- { name = ' nvim_lsp_signature_help' },
1110+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
1111+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
1112+ },
1113+
1114+ appearance = {
1115+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
1116+ -- Adjusts spacing to ensure icons are aligned
1117+ nerd_font_variant = ' mono' ,
1118+ },
1119+
1120+ completion = {
1121+ -- By default, you may press `<c-space>` to show the documentation.
1122+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
1123+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
1124+ },
1125+
1126+ sources = {
1127+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
1128+ providers = {
1129+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
11691130 },
1170- }
1171- end ,
1131+ },
1132+
1133+ snippets = { preset = ' luasnip' },
1134+
1135+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
1136+ -- which automatically downloads a prebuilt binary when enabled.
1137+ --
1138+ -- By default, we use the Lua implementation instead, but you may enable
1139+ -- the rust implementation via `'prefer_rust_with_warning'`
1140+ --
1141+ -- See :h blink-cmp-config-fuzzy for more information
1142+ fuzzy = { implementation = ' lua' },
1143+
1144+ -- Shows a signature help window while you type arguments for a function
1145+ signature = { enabled = true },
1146+ },
11721147 },
11731148
11741149 { -- You can easily change to a different colorscheme.
0 commit comments