Skip to content

Commit b226b49

Browse files
committed
Merge 'upstream': feat: switch nvim-cmp for blink.cmp
2 parents f36056b + d350db2 commit b226b49

4 files changed

Lines changed: 108 additions & 17 deletions

File tree

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
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
return {
2+
{ -- Autocompletion
3+
'saghen/blink.cmp',
4+
event = 'VimEnter',
5+
version = '1.*',
6+
dependencies = {
7+
-- Snippet Engine
8+
{
9+
'L3MON4D3/LuaSnip',
10+
version = '2.*',
11+
build = (function()
12+
-- Build Step is needed for regex support in snippets.
13+
-- This step is not supported in many windows environments.
14+
-- Remove the below condition to re-enable on windows.
15+
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
16+
return
17+
end
18+
return 'make install_jsregexp'
19+
end)(),
20+
dependencies = {
21+
-- `friendly-snippets` contains a variety of premade snippets.
22+
-- See the README about individual language/framework/plugin snippets:
23+
-- https://github.com/rafamadriz/friendly-snippets
24+
-- {
25+
-- 'rafamadriz/friendly-snippets',
26+
-- config = function()
27+
-- require('luasnip.loaders.from_vscode').lazy_load()
28+
-- end,
29+
-- },
30+
},
31+
opts = {},
32+
},
33+
'folke/lazydev.nvim',
34+
},
35+
--- @module 'blink.cmp'
36+
--- @type blink.cmp.Config
37+
opts = {
38+
keymap = {
39+
-- 'default' (recommended) for mappings similar to built-in completions
40+
-- <c-y> to accept ([y]es) the completion.
41+
-- This will auto-import if your LSP supports it.
42+
-- This will expand snippets if the LSP sent a snippet.
43+
-- 'super-tab' for tab to accept
44+
-- 'enter' for enter to accept
45+
-- 'none' for no mappings
46+
--
47+
-- For an understanding of why the 'default' preset is recommended,
48+
-- you will need to read `:help ins-completion`
49+
--
50+
-- No, but seriously. Please read `:help ins-completion`, it is really good!
51+
--
52+
-- All presets have the following mappings:
53+
-- <tab>/<s-tab>: move to right/left of your snippet expansion
54+
-- <c-space>: Open menu or open docs if already open
55+
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
56+
-- <c-e>: Hide menu
57+
-- <c-k>: Toggle signature help
58+
--
59+
-- See :h blink-cmp-config-keymap for defining your own keymap
60+
preset = 'default',
61+
62+
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
63+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
64+
},
65+
66+
appearance = {
67+
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
68+
-- Adjusts spacing to ensure icons are aligned
69+
nerd_font_variant = 'mono',
70+
},
71+
72+
completion = {
73+
-- By default, you may press `<c-space>` to show the documentation.
74+
-- Optionally, set `auto_show = true` to show the documentation after a delay.
75+
documentation = { auto_show = false, auto_show_delay_ms = 500 },
76+
},
77+
78+
sources = {
79+
default = { 'lsp', 'path', 'snippets', 'lazydev' },
80+
providers = {
81+
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
82+
},
83+
},
84+
85+
snippets = { preset = 'luasnip' },
86+
87+
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
88+
-- which automatically downloads a prebuilt binary when enabled.
89+
--
90+
-- By default, we use the Lua implementation instead, but you may enable
91+
-- the rust implementation via `'prefer_rust_with_warning'`
92+
--
93+
-- See :h blink-cmp-config-fuzzy for more information
94+
fuzzy = { implementation = 'lua' },
95+
96+
-- Shows a signature help window while you type arguments for a function
97+
signature = { enabled = true },
98+
},
99+
},
100+
}
101+
-- vim: ts=2 sts=2 sw=2 et

lua/kickstart/plugins/lspconfig.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ return {
2626
-- Useful status updates for LSP.
2727
{ 'j-hui/fidget.nvim', opts = {} },
2828

29-
-- Allows extra capabilities provided by nvim-cmp
30-
'hrsh7th/cmp-nvim-lsp',
29+
-- Allows extra capabilities provided by blink.cmp
30+
'saghen/blink.cmp',
3131
},
3232
config = function()
3333
-- Brief aside: **What is LSP?**
@@ -194,10 +194,9 @@ return {
194194

195195
-- LSP servers and clients are able to communicate to each other what features they support.
196196
-- By default, Neovim doesn't support everything that is in the LSP specification.
197-
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
198-
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
199-
local capabilities = vim.lsp.protocol.make_client_capabilities()
200-
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
197+
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
198+
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
199+
local capabilities = require('blink.cmp').get_lsp_capabilities()
201200

202201
-- Enable the following language servers
203202
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.

lua/lazy-plugins.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require('lazy').setup({
2020
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
2121
--
2222

23-
2423
-- modular approach: using `require 'path/name'` will
2524
-- include a plugin definition from file lua/path/name.lua
2625

@@ -34,7 +33,7 @@ require('lazy').setup({
3433

3534
require 'kickstart/plugins/conform',
3635

37-
require 'kickstart/plugins/cmp',
36+
require 'kickstart/plugins/blink-cmp',
3837

3938
require 'kickstart/plugins/tokyonight',
4039

0 commit comments

Comments
 (0)