blink.cmp
This commit is contained in:
@@ -2,25 +2,23 @@ local uc = vim.api.nvim_create_user_command
|
||||
local ac = vim.api.nvim_create_autocmd
|
||||
local aug = vim.api.nvim_create_augroup
|
||||
|
||||
-- User commands
|
||||
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
||||
|
||||
-- Auto commands
|
||||
ac("TextYankPost", {
|
||||
desc = "Highlight when yanking text",
|
||||
group = aug("highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
ac("LspAttach", {
|
||||
desc = "Notify user about attached LSP clients",
|
||||
group = aug("LSPOnAttach", { clear = true }),
|
||||
callback = function(event)
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client then
|
||||
vim.notify(client.name .. " attached", vim.log.levels.INFO, {})
|
||||
end
|
||||
end,
|
||||
desc = "Highlight when yanking text",
|
||||
group = aug("highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
ac("LspAttach", {
|
||||
desc = "Notify user about attached LSP clients",
|
||||
group = aug("LSPOnAttach", { clear = true }),
|
||||
callback = function(event)
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client then
|
||||
vim.notify(client.name .. " attached", vim.log.levels.INFO, {})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -90,12 +90,21 @@ local function rename_without_default()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- defaults are:
|
||||
-- grn → Rename symbol
|
||||
-- gra → Code actions
|
||||
-- grr → Find references
|
||||
-- gri → Go to implementation
|
||||
-- grt → Go to type definition
|
||||
-- gO → Document symbols
|
||||
callback = function(ev)
|
||||
map("n", "gd", vim.lsp.buf.definition, { buffer = ev.buf, desc = "goto definition" })
|
||||
map("n", "gD", vim.lsp.buf.declaration, { buffer = ev.buf, desc = "goto declaration" })
|
||||
map("n", "gfr", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" })
|
||||
map("n", "grd", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" })
|
||||
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol" })
|
||||
map("i", "<C-Space>", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" })
|
||||
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol from zero" })
|
||||
map("n", "gRN", vim.lsp.buf.rename, { buffer = ev.buf, desc = "rename symbol" })
|
||||
-- map("i", "<C-Space>", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" })
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require("romanzy.plugins.rose-pine")
|
||||
require("romanzy.plugins.mini")
|
||||
require("romanzy.plugins.blink-cmp")
|
||||
require("romanzy.plugins.lazygit")
|
||||
require("romanzy.plugins.oil")
|
||||
require("romanzy.plugins.telescope")
|
||||
|
||||
32
nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua
Normal file
32
nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
vim.pack.add({ 'https://github.com/saghen/blink.lib', 'https://github.com/saghen/blink.cmp' })
|
||||
|
||||
local cmp = require('blink.cmp')
|
||||
-- cmp.build():pwait()
|
||||
cmp.setup({
|
||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- C-space: Open menu or open docs if already open
|
||||
-- C-n/C-p or Up/Down: Select next/previous item
|
||||
-- C-e: Hide menu
|
||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
keymap = { preset = 'default' },
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = { documentation = { auto_show = false } },
|
||||
|
||||
-- (Default) list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = { default = { 'lsp', 'path', 'snippets', 'buffer' } },
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"`
|
||||
-- See the fuzzy documentation for more information
|
||||
-- fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
fuzzy = { implementation = "lua" }
|
||||
})
|
||||
@@ -15,9 +15,6 @@ vim.pack.add({
|
||||
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect", "popup", "fuzzy" }
|
||||
vim.opt.pumheight = 8
|
||||
|
||||
local diag_inline_enabled = true
|
||||
|
||||
local function diag_virtual_text()
|
||||
@@ -59,7 +56,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local managed_servers = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
{
|
||||
"plugins": {
|
||||
"blink.cmp": {
|
||||
"rev": "bda905a4bf1b3edfa708b0be193b8c63d8620c96",
|
||||
"src": "https://github.com/saghen/blink.cmp"
|
||||
},
|
||||
"blink.lib": {
|
||||
"rev": "5876dd95deeb70aadbe9f1c0b7117a135061cdac",
|
||||
"src": "https://github.com/saghen/blink.lib"
|
||||
},
|
||||
"codam-header.nvim": {
|
||||
"rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193",
|
||||
"src": "https://github.com/BeerB34r/codam-header.nvim"
|
||||
|
||||
Reference in New Issue
Block a user