Skip to content

Commit 4f2e0c6

Browse files
committed
Merge branch 'master' of https://github.com/nvim-lua/kickstart.nvim into nvim-lua-master
2 parents 2188a51 + d350db2 commit 4f2e0c6

File tree

2 files changed

+96
-130
lines changed

2 files changed

+96
-130
lines changed

init.lua

Lines changed: 95 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
115115
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
116116
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
117117

118-
-- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes
118+
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
119119
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
120120
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
121121
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
@@ -253,11 +253,9 @@ require('lazy').setup({
253253

254254
-- Document existing key chains
255255
spec = {
256-
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
257256
{ '<leader>d', group = '[D]ebug/Document' },
258257
{ '<leader>g', group = '[G]it' },
259258
{ '<leader>s', group = '[S]earch' },
260-
{ '<leader>w', group = '[W]orkspace' },
261259
{ '<leader>t', group = '[T]oggle' },
262260
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
263261
{ '<leader>m', group = '[M]isc' },
@@ -276,8 +274,6 @@ require('lazy').setup({
276274
{ -- Fuzzy Finder (files, lsp, etc)
277275
'nvim-telescope/telescope.nvim',
278276
event = 'VimEnter',
279-
version = false,
280-
-- tag = '0.1.8',
281277
dependencies = {
282278
'nvim-lua/plenary.nvim',
283279
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
@@ -413,8 +409,8 @@ require('lazy').setup({
413409
-- Useful status updates for LSP.
414410
{ 'j-hui/fidget.nvim', opts = {} },
415411

416-
-- Allows extra capabilities provided by nvim-cmp
417-
'hrsh7th/cmp-nvim-lsp',
412+
-- Allows extra capabilities provided by blink.cmp
413+
'saghen/blink.cmp',
418414
},
419415
config = function()
420416
-- Brief aside: **What is LSP?**
@@ -459,42 +455,43 @@ require('lazy').setup({
459455
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
460456
end
461457

462-
-- Jump to the definition of the word under your cursor.
463-
-- This is where a variable was first declared, or where a function is defined, etc.
464-
-- To jump back, press <C-t>.
465-
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
458+
-- Rename the variable under your cursor.
459+
-- Most Language Servers support renaming across files, etc.
460+
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
461+
462+
-- Execute a code action, usually your cursor needs to be on top of an error
463+
-- or a suggestion from your LSP for this to activate.
464+
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
466465

467466
-- Find references for the word under your cursor.
468-
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
467+
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
469468

470469
-- Jump to the implementation of the word under your cursor.
471470
-- Useful when your language has ways of declaring types without an actual implementation.
472-
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
471+
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
473472

474-
-- Jump to the type of the word under your cursor.
475-
-- Useful when you're not sure what type a variable is and you want to see
476-
-- the definition of its *type*, not where it was *defined*.
477-
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
473+
-- Jump to the definition of the word under your cursor.
474+
-- This is where a variable was first declared, or where a function is defined, etc.
475+
-- To jump back, press <C-t>.
476+
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
477+
478+
-- WARN: This is not Goto Definition, this is Goto Declaration.
479+
-- For example, in C this would take you to the header.
480+
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
478481

479482
-- Fuzzy find all the symbols in your current document.
480483
-- Symbols are things like variables, functions, types, etc.
481-
map('<leader>dS', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
484+
485+
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
482486

483487
-- Fuzzy find all the symbols in your current workspace.
484488
-- Similar to document symbols, except searches over your entire project.
485-
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
486-
487-
-- Rename the variable under your cursor.
488-
-- Most Language Servers support renaming across files, etc.
489-
map('<leader>cr', vim.lsp.buf.rename, '[R]ename')
489+
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
490490

491-
-- Execute a code action, usually your cursor needs to be on top of an error
492-
-- or a suggestion from your LSP for this to activate.
493-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
494-
495-
-- WARN: This is not Goto Definition, this is Goto Declaration.
496-
-- For example, in C this would take you to the header.
497-
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
491+
-- Jump to the type of the word under your cursor.
492+
-- Useful when you're not sure what type a variable is and you want to see
493+
-- the definition of its *type*, not where it was *defined*.
494+
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
498495

499496
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
500497
---@param client vim.lsp.Client
@@ -581,10 +578,9 @@ require('lazy').setup({
581578

582579
-- LSP servers and clients are able to communicate to each other what features they support.
583580
-- By default, Neovim doesn't support everything that is in the LSP specification.
584-
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
585-
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
586-
local capabilities = vim.lsp.protocol.make_client_capabilities()
587-
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
581+
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
582+
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
583+
local capabilities = require('blink.cmp').get_lsp_capabilities()
588584

589585
-- Enable the following language servers
590586
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -783,12 +779,14 @@ require('lazy').setup({
783779
},
784780

785781
{ -- Autocompletion
786-
'hrsh7th/nvim-cmp',
787-
event = 'InsertEnter',
782+
'saghen/blink.cmp',
783+
event = 'VimEnter',
784+
version = '1.*',
788785
dependencies = {
789-
-- Snippet Engine & its associated nvim-cmp source
786+
-- Snippet Engine
790787
{
791788
'L3MON4D3/LuaSnip',
789+
version = '2.*',
792790
build = (function()
793791
-- Build Step is needed for regex support in snippets.
794792
-- This step is not supported in many windows environments.
@@ -809,99 +807,75 @@ require('lazy').setup({
809807
-- end,
810808
-- },
811809
},
810+
opts = {},
812811
},
813-
'saadparwaiz1/cmp_luasnip',
814-
815-
-- Adds other completion capabilities.
816-
-- nvim-cmp does not ship with all sources by default. They are split
817-
-- into multiple repos for maintenance purposes.
818-
'hrsh7th/cmp-nvim-lsp',
819-
'hrsh7th/cmp-path',
820-
'hrsh7th/cmp-nvim-lsp-signature-help',
812+
'folke/lazydev.nvim',
821813
},
822-
config = function()
823-
-- See `:help cmp`
824-
local cmp = require 'cmp'
825-
local luasnip = require 'luasnip'
826-
luasnip.config.setup {}
827-
828-
cmp.setup {
829-
snippet = {
830-
expand = function(args)
831-
luasnip.lsp_expand(args.body)
832-
end,
833-
},
834-
completion = { completeopt = 'menu,menuone,noinsert' },
835-
836-
-- For an understanding of why these mappings were
837-
-- chosen, you will need to read `:help ins-completion`
814+
--- @module 'blink.cmp'
815+
--- @type blink.cmp.Config
816+
opts = {
817+
keymap = {
818+
-- TODO: Add "Enter as way to apply suggestion"
819+
-- 'default' (recommended) for mappings similar to built-in completions
820+
-- <c-y> to accept ([y]es) the completion.
821+
-- This will auto-import if your LSP supports it.
822+
-- This will expand snippets if the LSP sent a snippet.
823+
-- 'super-tab' for tab to accept
824+
-- 'enter' for enter to accept
825+
-- 'none' for no mappings
826+
--
827+
-- For an understanding of why the 'default' preset is recommended,
828+
-- you will need to read `:help ins-completion`
838829
--
839830
-- No, but seriously. Please read `:help ins-completion`, it is really good!
840-
mapping = cmp.mapping.preset.insert {
841-
-- Select the [n]ext item
842-
['<C-j>'] = cmp.mapping.select_next_item(),
843-
-- Select the [p]revious item
844-
['<C-k>'] = cmp.mapping.select_prev_item(),
845-
--['<Tab>'] = cmp.mapping.select_next_item(),
846-
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
847-
848-
-- Scroll the documentation window [b]ack / [f]orward
849-
['<C-d>'] = cmp.mapping.scroll_docs(-4),
850-
['<C-u>'] = cmp.mapping.scroll_docs(4),
851-
-- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
852-
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
853-
854-
-- Accept ([y]es) the completion.
855-
-- This will auto-import if your LSP supports it.
856-
-- This will expand snippets if the LSP sent a snippet.
857-
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
858-
['<CR>'] = cmp.mapping.confirm {
859-
behavior = cmp.ConfirmBehavior.Insert,
860-
select = true,
861-
},
831+
--
832+
-- All presets have the following mappings:
833+
-- <tab>/<s-tab>: move to right/left of your snippet expansion
834+
-- <c-space>: Open menu or open docs if already open
835+
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
836+
-- <c-e>: Hide menu
837+
-- <c-k>: Toggle signature help
838+
--
839+
-- See :h blink-cmp-config-keymap for defining your own keymap
840+
preset = 'default',
862841

863-
['<C-e>'] = cmp.mapping.close(),
842+
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
843+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
844+
},
864845

865-
-- Manually trigger a completion from nvim-cmp.
866-
-- Generally you don't need this, because nvim-cmp will display
867-
-- completions whenever it has completion options available.
868-
['<C-Space>'] = cmp.mapping.complete {},
846+
appearance = {
847+
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
848+
-- Adjusts spacing to ensure icons are aligned
849+
nerd_font_variant = 'mono',
850+
},
869851

870-
-- Think of <c-l> as moving to the right of your snippet expansion.
871-
-- So if you have a snippet that's like:
872-
-- function $name($args)
873-
-- $body
874-
-- end
875-
--
876-
-- <c-l> will move you to the right of each of the expansion locations.
877-
-- <c-h> is similar, except moving you backwards.
878-
['<C-l>'] = cmp.mapping(function()
879-
if luasnip.expand_or_locally_jumpable() then
880-
luasnip.expand_or_jump()
881-
end
882-
end, { 'i', 's' }),
883-
['<C-h>'] = cmp.mapping(function()
884-
if luasnip.locally_jumpable(-1) then
885-
luasnip.jump(-1)
886-
end
887-
end, { 'i', 's' }),
852+
completion = {
853+
-- By default, you may press `<c-space>` to show the documentation.
854+
-- Optionally, set `auto_show = true` to show the documentation after a delay.
855+
documentation = { auto_show = false, auto_show_delay_ms = 500 },
856+
},
888857

889-
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
890-
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
858+
sources = {
859+
default = { 'lsp', 'path', 'snippets', 'lazydev' },
860+
providers = {
861+
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
891862
},
892-
sources = {
893-
{
894-
name = 'lazydev',
895-
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
896-
group_index = 0,
897-
},
898-
{ name = 'nvim_lsp' },
899-
{ name = 'luasnip' },
900-
{ name = 'path' },
901-
{ name = 'nvim_lsp_signature_help' },
902-
},
903-
}
904-
end,
863+
},
864+
865+
snippets = { preset = 'luasnip' },
866+
867+
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
868+
-- which automatically downloads a prebuilt binary when enabled.
869+
--
870+
-- By default, we use the Lua implementation instead, but you may enable
871+
-- the rust implementation via `'prefer_rust_with_warning'`
872+
--
873+
-- See :h blink-cmp-config-fuzzy for more information
874+
fuzzy = { implementation = 'lua' },
875+
876+
-- Shows a signature help window while you type arguments for a function
877+
signature = { enabled = true },
878+
},
905879
},
906880

907881
{ -- You can easily change to a different colorscheme.

lua/kickstart/plugins/autopairs.lua

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,5 @@
44
return {
55
'windwp/nvim-autopairs',
66
event = 'InsertEnter',
7-
-- Optional dependency
8-
dependencies = { 'hrsh7th/nvim-cmp' },
9-
config = function()
10-
require('nvim-autopairs').setup {}
11-
-- If you want to automatically add `(` after selecting a function or method
12-
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
13-
local cmp = require 'cmp'
14-
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
15-
end,
7+
opts = {},
168
}

0 commit comments

Comments
 (0)