Skip to content

Commit 61c7bc3

Browse files
authored
Merge branch 'nvim-lua:master' into master
2 parents 2aa942c + 76cb865 commit 61c7bc3

File tree

2 files changed

+99
-132
lines changed

2 files changed

+99
-132
lines changed

init.lua

Lines changed: 98 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
194194
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
195195
vim.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" })
@@ -336,11 +336,7 @@ require('lazy').setup({
336336

337337
-- Document existing key chains
338338
spec = {
339-
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
340-
{ '<leader>d', group = '[D]ocument' },
341-
{ '<leader>r', group = '[R]ename' },
342339
{ '<leader>s', group = '[S]earch' },
343-
{ '<leader>w', group = '[W]orkspace' },
344340
{ '<leader>t', group = '[T]oggle' },
345341
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
346342
},
@@ -357,7 +353,6 @@ require('lazy').setup({
357353
{ -- Fuzzy Finder (files, lsp, etc)
358354
'nvim-telescope/telescope.nvim',
359355
event = 'VimEnter',
360-
branch = '0.1.x',
361356
dependencies = {
362357
'nvim-lua/plenary.nvim',
363358
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
@@ -479,15 +474,15 @@ require('lazy').setup({
479474
-- Automatically install LSPs and related tools to stdpath for Neovim
480475
-- Mason must be loaded before its dependents so we need to set it up here.
481476
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
482-
{ 'williamboman/mason.nvim', opts = {} },
483-
'williamboman/mason-lspconfig.nvim',
477+
{ 'mason-org/mason.nvim', opts = {} },
478+
'mason-org/mason-lspconfig.nvim',
484479
'WhoIsSethDaniel/mason-tool-installer.nvim',
485480

486481
-- Useful status updates for LSP.
487482
{ 'j-hui/fidget.nvim', opts = {} },
488483

489-
-- Allows extra capabilities provided by nvim-cmp
490-
'hrsh7th/cmp-nvim-lsp',
484+
-- Allows extra capabilities provided by blink.cmp
485+
'saghen/blink.cmp',
491486
},
492487
config = function()
493488
-- Brief aside: **What is LSP?**
@@ -532,42 +527,42 @@ require('lazy').setup({
532527
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
533528
end
534529

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

540538
-- Find references for the word under your cursor.
541-
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
539+
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
542540

543541
-- Jump to the implementation of the word under your cursor.
544542
-- Useful when your language has ways of declaring types without an actual implementation.
545-
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
543+
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
546544

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

552554
-- Fuzzy find all the symbols in your current document.
553555
-- Symbols are things like variables, functions, types, etc.
554-
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
556+
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
555557

556558
-- Fuzzy find all the symbols in your current workspace.
557559
-- Similar to document symbols, except searches over your entire project.
558-
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
559-
560-
-- Rename the variable under your cursor.
561-
-- Most Language Servers support renaming across files, etc.
562-
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
563-
564-
-- Execute a code action, usually your cursor needs to be on top of an error
565-
-- or a suggestion from your LSP for this to activate.
566-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
560+
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
567561

568-
-- WARN: This is not Goto Definition, this is Goto Declaration.
569-
-- For example, in C this would take you to the header.
570-
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
562+
-- Jump to the type of the word under your cursor.
563+
-- Useful when you're not sure what type a variable is and you want to see
564+
-- the definition of its *type*, not where it was *defined*.
565+
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
571566

572567
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
573568
---@param client vim.lsp.Client
@@ -654,10 +649,9 @@ require('lazy').setup({
654649

655650
-- LSP servers and clients are able to communicate to each other what features they support.
656651
-- By default, Neovim doesn't support everything that is in the LSP specification.
657-
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
658-
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
659-
local capabilities = vim.lsp.protocol.make_client_capabilities()
660-
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
652+
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
653+
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
654+
local capabilities = require('blink.cmp').get_lsp_capabilities()
661655

662656
-- Enable the following language servers
663657
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -776,12 +770,14 @@ require('lazy').setup({
776770
},
777771

778772
{ -- Autocompletion
779-
'hrsh7th/nvim-cmp',
780-
event = 'InsertEnter',
773+
'saghen/blink.cmp',
774+
event = 'VimEnter',
775+
version = '1.*',
781776
dependencies = {
782-
-- Snippet Engine & its associated nvim-cmp source
777+
-- Snippet Engine
783778
{
784779
'L3MON4D3/LuaSnip',
780+
version = '2.*',
785781
build = (function()
786782
-- Build Step is needed for regex support in snippets.
787783
-- This step is not supported in many windows environments.
@@ -802,95 +798,74 @@ require('lazy').setup({
802798
-- end,
803799
-- },
804800
},
801+
opts = {},
805802
},
806-
'saadparwaiz1/cmp_luasnip',
807-
808-
-- Adds other completion capabilities.
809-
-- nvim-cmp does not ship with all sources by default. They are split
810-
-- into multiple repos for maintenance purposes.
811-
'hrsh7th/cmp-nvim-lsp',
812-
'hrsh7th/cmp-path',
813-
'hrsh7th/cmp-nvim-lsp-signature-help',
803+
'folke/lazydev.nvim',
814804
},
815-
config = function()
816-
-- See `:help cmp`
817-
local cmp = require 'cmp'
818-
local luasnip = require 'luasnip'
819-
luasnip.config.setup {}
820-
821-
cmp.setup {
822-
snippet = {
823-
expand = function(args)
824-
luasnip.lsp_expand(args.body)
825-
end,
826-
},
827-
completion = { completeopt = 'menu,menuone,noinsert' },
828-
829-
-- For an understanding of why these mappings were
830-
-- chosen, you will need to read `:help ins-completion`
805+
--- @module 'blink.cmp'
806+
--- @type blink.cmp.Config
807+
opts = {
808+
keymap = {
809+
-- 'default' (recommended) for mappings similar to built-in completions
810+
-- <c-y> to accept ([y]es) the completion.
811+
-- This will auto-import if your LSP supports it.
812+
-- This will expand snippets if the LSP sent a snippet.
813+
-- 'super-tab' for tab to accept
814+
-- 'enter' for enter to accept
815+
-- 'none' for no mappings
816+
--
817+
-- For an understanding of why the 'default' preset is recommended,
818+
-- you will need to read `:help ins-completion`
831819
--
832820
-- No, but seriously. Please read `:help ins-completion`, it is really good!
833-
mapping = cmp.mapping.preset.insert {
834-
-- Select the [n]ext item
835-
['<C-n>'] = cmp.mapping.select_next_item(),
836-
-- Select the [p]revious item
837-
['<C-p>'] = cmp.mapping.select_prev_item(),
838-
839-
-- Scroll the documentation window [b]ack / [f]orward
840-
['<C-b>'] = cmp.mapping.scroll_docs(-4),
841-
['<C-f>'] = cmp.mapping.scroll_docs(4),
842-
843-
-- Accept ([y]es) the completion.
844-
-- This will auto-import if your LSP supports it.
845-
-- This will expand snippets if the LSP sent a snippet.
846-
['<C-y>'] = cmp.mapping.confirm { select = true },
847-
848-
-- If you prefer more traditional completion keymaps,
849-
-- you can uncomment the following lines
850-
--['<CR>'] = cmp.mapping.confirm { select = true },
851-
--['<Tab>'] = cmp.mapping.select_next_item(),
852-
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
853-
854-
-- Manually trigger a completion from nvim-cmp.
855-
-- Generally you don't need this, because nvim-cmp will display
856-
-- completions whenever it has completion options available.
857-
['<C-Space>'] = cmp.mapping.complete {},
858-
859-
-- Think of <c-l> as moving to the right of your snippet expansion.
860-
-- So if you have a snippet that's like:
861-
-- function $name($args)
862-
-- $body
863-
-- end
864-
--
865-
-- <c-l> will move you to the right of each of the expansion locations.
866-
-- <c-h> is similar, except moving you backwards.
867-
['<C-l>'] = cmp.mapping(function()
868-
if luasnip.expand_or_locally_jumpable() then
869-
luasnip.expand_or_jump()
870-
end
871-
end, { 'i', 's' }),
872-
['<C-h>'] = cmp.mapping(function()
873-
if luasnip.locally_jumpable(-1) then
874-
luasnip.jump(-1)
875-
end
876-
end, { 'i', 's' }),
821+
--
822+
-- All presets have the following mappings:
823+
-- <tab>/<s-tab>: move to right/left of your snippet expansion
824+
-- <c-space>: Open menu or open docs if already open
825+
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
826+
-- <c-e>: Hide menu
827+
-- <c-k>: Toggle signature help
828+
--
829+
-- See :h blink-cmp-config-keymap for defining your own keymap
830+
preset = 'default',
877831

878-
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
879-
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
880-
},
881-
sources = {
882-
{
883-
name = 'lazydev',
884-
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
885-
group_index = 0,
886-
},
887-
{ name = 'nvim_lsp' },
888-
{ name = 'luasnip' },
889-
{ name = 'path' },
890-
{ name = 'nvim_lsp_signature_help' },
832+
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
833+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
834+
},
835+
836+
appearance = {
837+
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
838+
-- Adjusts spacing to ensure icons are aligned
839+
nerd_font_variant = 'mono',
840+
},
841+
842+
completion = {
843+
-- By default, you may press `<c-space>` to show the documentation.
844+
-- Optionally, set `auto_show = true` to show the documentation after a delay.
845+
documentation = { auto_show = false, auto_show_delay_ms = 500 },
846+
},
847+
848+
sources = {
849+
default = { 'lsp', 'path', 'snippets', 'lazydev' },
850+
providers = {
851+
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
891852
},
892-
}
893-
end,
853+
},
854+
855+
snippets = { preset = 'luasnip' },
856+
857+
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
858+
-- which automatically downloads a prebuilt binary when enabled.
859+
--
860+
-- By default, we use the Lua implementation instead, but you may enable
861+
-- the rust implementation via `'prefer_rust_with_warning'`
862+
--
863+
-- See :h blink-cmp-config-fuzzy for more information
864+
fuzzy = { implementation = 'lua' },
865+
866+
-- Shows a signature help window while you type arguments for a function
867+
signature = { enabled = true },
868+
},
894869
},
895870

896871
{ -- 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)