Skip to content

Commit 93ec167

Browse files
Merge branch 'master' into apply_changes
2 parents d602cca + d350db2 commit 93ec167

2 files changed

Lines changed: 103 additions & 136 deletions

File tree

init.lua

Lines changed: 102 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
188188
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
189189
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
190190

191-
-- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes
191+
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
192192
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
193193
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
194194
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
@@ -330,15 +330,12 @@ require('lazy').setup({
330330

331331
-- Document existing key chains
332332
spec = {
333-
{ '<leader>a', group = 'Ai' },
334-
{ '<leader>c', group = 'Code', mode = { 'n', 'x' } },
335-
{ '<leader>d', group = 'Document' },
336-
{ '<leader>r', group = 'Rename' },
337-
{ '<leader>s', group = 'Search' },
338-
{ '<leader>w', group = 'Workspace' },
339-
{ '<leader>t', group = 'Tests' },
340-
{ '<leader>g', group = 'Git' },
341-
{ '<leader>h', group = 'Git Hunk', mode = { 'n', 'v' } },
333+
{ '<leader>a', group = '[A]i' },
334+
{ '<leader>s', group = '[S]earch' },
335+
{ '<leader>t', group = '[T]oggle' },
336+
{ '<leader>g', group = '[G]it' },
337+
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
338+
{ '<leader>t', group = '[T]ests' },
342339
},
343340
},
344341
},
@@ -353,7 +350,6 @@ require('lazy').setup({
353350
{ -- Fuzzy Finder (files, lsp, etc)
354351
'nvim-telescope/telescope.nvim',
355352
event = 'VimEnter',
356-
branch = '0.1.x',
357353
dependencies = {
358354
'nvim-lua/plenary.nvim',
359355
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
@@ -485,8 +481,8 @@ require('lazy').setup({
485481
-- Useful status updates for LSP.
486482
{ 'j-hui/fidget.nvim', opts = {} },
487483

488-
-- Allows extra capabilities provided by nvim-cmp
489-
'hrsh7th/cmp-nvim-lsp',
484+
-- Allows extra capabilities provided by blink.cmp
485+
'saghen/blink.cmp',
490486
},
491487
config = function()
492488
-- Brief aside: **What is LSP?**
@@ -531,42 +527,42 @@ require('lazy').setup({
531527
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
532528
end
533529

534-
-- Jump to the definition of the word under your cursor.
535-
-- This is where a variable was first declared, or where a function is defined, etc.
536-
-- To jump back, press <C-t>.
537-
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' })
538537

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

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

546-
-- Jump to the type of the word under your cursor.
547-
-- Useful when you're not sure what type a variable is and you want to see
548-
-- the definition of its *type*, not where it was *defined*.
549-
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')
550553

551554
-- Fuzzy find all the symbols in your current document.
552555
-- Symbols are things like variables, functions, types, etc.
553-
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')
554557

555558
-- Fuzzy find all the symbols in your current workspace.
556559
-- Similar to document symbols, except searches over your entire project.
557-
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
558-
559-
-- Rename the variable under your cursor.
560-
-- Most Language Servers support renaming across files, etc.
561-
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
562-
563-
-- Execute a code action, usually your cursor needs to be on top of an error
564-
-- or a suggestion from your LSP for this to activate.
565-
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')
566561

567-
-- WARN: This is not Goto Definition, this is Goto Declaration.
568-
-- For example, in C this would take you to the header.
569-
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')
570566

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

654650
-- LSP servers and clients are able to communicate to each other what features they support.
655651
-- By default, Neovim doesn't support everything that is in the LSP specification.
656-
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
657-
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
658-
local capabilities = vim.lsp.protocol.make_client_capabilities()
659-
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()
660655

661656
-- Enable the following language servers
662657
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -820,12 +815,14 @@ require('lazy').setup({
820815
},
821816

822817
{ -- Autocompletion
823-
'hrsh7th/nvim-cmp',
824-
event = 'InsertEnter',
818+
'saghen/blink.cmp',
819+
event = 'VimEnter',
820+
version = '1.*',
825821
dependencies = {
826-
-- Snippet Engine & its associated nvim-cmp source
822+
-- Snippet Engine
827823
{
828824
'L3MON4D3/LuaSnip',
825+
version = '2.*',
829826
build = (function()
830827
-- Build Step is needed for regex support in snippets.
831828
-- This step is not supported in many windows environments.
@@ -846,96 +843,74 @@ require('lazy').setup({
846843
end,
847844
},
848845
},
846+
opts = {},
849847
},
850-
'saadparwaiz1/cmp_luasnip',
851-
852-
-- Adds other completion capabilities.
853-
-- nvim-cmp does not ship with all sources by default. They are split
854-
-- into multiple repos for maintenance purposes.
855-
'hrsh7th/cmp-nvim-lsp',
856-
'hrsh7th/cmp-path',
857-
'hrsh7th/cmp-nvim-lsp-signature-help',
848+
'folke/lazydev.nvim',
858849
},
859-
config = function()
860-
-- See `:help cmp`
861-
local cmp = require 'cmp'
862-
local luasnip = require 'luasnip'
863-
luasnip.config.setup {}
864-
865-
cmp.setup {
866-
snippet = {
867-
expand = function(args)
868-
luasnip.lsp_expand(args.body)
869-
end,
870-
},
871-
completion = { completeopt = 'menu,menuone,noinsert' },
872-
873-
-- For an understanding of why these mappings were
874-
-- chosen, you will need to read `:help ins-completion`
850+
--- @module 'blink.cmp'
851+
--- @type blink.cmp.Config
852+
opts = {
853+
keymap = {
854+
-- 'default' (recommended) for mappings similar to built-in completions
855+
-- <c-y> to accept ([y]es) the completion.
856+
-- This will auto-import if your LSP supports it.
857+
-- This will expand snippets if the LSP sent a snippet.
858+
-- 'super-tab' for tab to accept
859+
-- 'enter' for enter to accept
860+
-- 'none' for no mappings
861+
--
862+
-- For an understanding of why the 'default' preset is recommended,
863+
-- you will need to read `:help ins-completion`
875864
--
876865
-- No, but seriously. Please read `:help ins-completion`, it is really good!
877-
mapping = cmp.mapping.preset.insert {
878-
-- Select the [n]ext item
879-
['<C-n>'] = cmp.mapping.select_next_item(),
880-
-- Select the [p]revious item
881-
['<C-p>'] = cmp.mapping.select_prev_item(),
882-
883-
-- Scroll the documentation window [b]ack / [f]orward
884-
['<C-b>'] = cmp.mapping.scroll_docs(-4),
885-
['<C-f>'] = cmp.mapping.scroll_docs(4),
886-
887-
-- Accept ([y]es) the completion.
888-
-- This will auto-import if your LSP supports it.
889-
-- This will expand snippets if the LSP sent a snippet.
890-
['<C-y>'] = cmp.mapping.confirm { select = true },
891-
892-
-- If you prefer more traditional completion keymaps,
893-
-- you can uncomment the following lines
894-
--['<CR>'] = cmp.mapping.confirm { select = true },
895-
--['<Tab>'] = cmp.mapping.select_next_item(),
896-
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
897-
898-
-- Manually trigger a completion from nvim-cmp.
899-
-- Generally you don't need this, because nvim-cmp will display
900-
-- completions whenever it has completion options available.
901-
['<C-Space>'] = cmp.mapping.complete {},
902-
903-
-- Think of <c-l> as moving to the right of your snippet expansion.
904-
-- So if you have a snippet that's like:
905-
-- function $name($args)
906-
-- $body
907-
-- end
908-
--
909-
-- <c-l> will move you to the right of each of the expansion locations.
910-
-- <c-h> is similar, except moving you backwards.
911-
['<C-l>'] = cmp.mapping(function()
912-
if luasnip.expand_or_locally_jumpable() then
913-
luasnip.expand_or_jump()
914-
end
915-
end, { 'i', 's' }),
916-
['<C-h>'] = cmp.mapping(function()
917-
if luasnip.locally_jumpable(-1) then
918-
luasnip.jump(-1)
919-
end
920-
end, { 'i', 's' }),
866+
--
867+
-- All presets have the following mappings:
868+
-- <tab>/<s-tab>: move to right/left of your snippet expansion
869+
-- <c-space>: Open menu or open docs if already open
870+
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
871+
-- <c-e>: Hide menu
872+
-- <c-k>: Toggle signature help
873+
--
874+
-- See :h blink-cmp-config-keymap for defining your own keymap
875+
preset = 'default',
921876

922-
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
923-
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
924-
},
925-
sources = {
926-
{
927-
name = 'lazydev',
928-
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
929-
group_index = 0,
930-
},
931-
{ name = 'copilot' },
932-
{ name = 'nvim_lsp' },
933-
{ name = 'luasnip' },
934-
{ name = 'path' },
935-
{ name = 'nvim_lsp_signature_help' },
877+
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
878+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
879+
},
880+
881+
appearance = {
882+
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
883+
-- Adjusts spacing to ensure icons are aligned
884+
nerd_font_variant = 'mono',
885+
},
886+
887+
completion = {
888+
-- By default, you may press `<c-space>` to show the documentation.
889+
-- Optionally, set `auto_show = true` to show the documentation after a delay.
890+
documentation = { auto_show = false, auto_show_delay_ms = 500 },
891+
},
892+
893+
sources = {
894+
default = { 'copilot', 'lsp', 'path', 'snippets', 'lazydev' },
895+
providers = {
896+
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
936897
},
937-
}
938-
end,
898+
},
899+
900+
snippets = { preset = 'luasnip' },
901+
902+
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
903+
-- which automatically downloads a prebuilt binary when enabled.
904+
--
905+
-- By default, we use the Lua implementation instead, but you may enable
906+
-- the rust implementation via `'prefer_rust_with_warning'`
907+
--
908+
-- See :h blink-cmp-config-fuzzy for more information
909+
fuzzy = { implementation = 'lua' },
910+
911+
-- Shows a signature help window while you type arguments for a function
912+
signature = { enabled = true },
913+
},
939914
},
940915

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