use blink.cmp in neovim_unstable
This commit is contained in:
parent
2bd9b3d518
commit
a8771d5166
9 changed files with 95 additions and 36 deletions
|
|
@ -16,6 +16,7 @@ end
|
|||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("aleidk.options")
|
||||
require("aleidk.autocmds")
|
||||
require("aleidk.keymaps")
|
||||
|
||||
-- Setup lazy.nvim
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
|
||||
"blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" },
|
||||
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
|
||||
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
|
||||
"conform.nvim": { "branch": "master", "commit": "6632e7d788a85bf8405ea0c812d343fc308b7b8c" },
|
||||
|
|
@ -11,7 +13,7 @@
|
|||
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
|
||||
"neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" },
|
||||
"nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ff6471d4f837354d8257dfa326b031dd8858b16e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a56f4b9dde5daf3d4c7bb50cf78ab609537f2259" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9be6836ebeb88a536055bf1ce0961eef68da4bc6" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
cmd = { "rust-analyzer" },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { "cargo.toml" },
|
||||
}
|
||||
|
|
@ -6,14 +6,29 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||
return
|
||||
end
|
||||
|
||||
vim.bo[args.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
||||
|
||||
-- Prefer LSP folding if client supports it
|
||||
if client:supports_method('textDocument/foldingRange') then
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||
end
|
||||
|
||||
if client:supports_method 'textDocument/completion' then
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = args.buf, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n\n" .. msg)
|
||||
end, { buffer = args.buf, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -157,22 +157,4 @@ vim.lsp.enable({
|
|||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = { current_line = true },
|
||||
on_attach = function(_, bufnr)
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n\n" .. msg)
|
||||
end, { buffer = bufnr, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
return {
|
||||
"saghen/blink.cmp",
|
||||
lazy = false,
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"echasnovski/mini.nvim",
|
||||
"folke/lazydev.nvim",
|
||||
{ "saghen/blink.compat", version = "*", },
|
||||
},
|
||||
opts = function()
|
||||
local window_options = {
|
||||
border = "rounded",
|
||||
winblend = vim.o.pumblend,
|
||||
}
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
return {
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
completion = {
|
||||
accept = { auto_brackets = { enabled = true }, },
|
||||
-- Show documentation when selecting a completion item
|
||||
documentation = { auto_show = true, auto_show_delay_ms = 500 },
|
||||
|
||||
-- Display a preview of the selected item on the current line
|
||||
ghost_text = { enabled = true },
|
||||
},
|
||||
keymap = {
|
||||
preset = "enter",
|
||||
["<C-j>"] = { 'select_next', 'fallback' },
|
||||
["<C-k>"] = { 'select_prev', 'fallback' },
|
||||
["<C-u>"] = { 'scroll_documentation_up', 'fallback' },
|
||||
["<C-d>"] = { 'scroll_documentation_down', 'fallback' },
|
||||
},
|
||||
sources = {
|
||||
providers = {
|
||||
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
|
||||
luasnip = {
|
||||
name = 'luasnip',
|
||||
module = 'blink.compat.source',
|
||||
score_offset = -3,
|
||||
opts = {
|
||||
use_show_condition = false,
|
||||
show_autosnippets = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
default = {
|
||||
"lsp",
|
||||
"path",
|
||||
"snippets",
|
||||
"buffer",
|
||||
"dadbod",
|
||||
"lazydev",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ return {
|
|||
NeogitCommitMessage = { "gitlint" },
|
||||
gitcommit = { "gitlint" },
|
||||
markdown = { "markdownlint" },
|
||||
javascript = { "biomejs" },
|
||||
typescript = { "biomejs" },
|
||||
javascriptreact = { "biomejs" },
|
||||
typescriptreact = { "biomejs" },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ return {
|
|||
},
|
||||
config = function()
|
||||
require('mini.icons').setup()
|
||||
require('mini.bracketed').setup() -- [] movement for various stuff
|
||||
require('mini.bracketed').setup({
|
||||
diagnostic = { options = { severity = vim.diagnostic.severity.ERROR } },
|
||||
})
|
||||
require("mini.ai").setup({})
|
||||
require('mini.cursorword').setup() -- Highlight word under cursor
|
||||
require('mini.extra').setup()
|
||||
|
|
@ -17,14 +19,9 @@ return {
|
|||
require('mini.splitjoin').setup()
|
||||
require("mini.align").setup({})
|
||||
require('mini.animate').setup()
|
||||
require('mini.notify').setup({
|
||||
-- Notifications about LSP progress
|
||||
lsp_progress = {
|
||||
-- Whether to enable showing
|
||||
enable = false,
|
||||
}
|
||||
})
|
||||
require('mini.notify').setup()
|
||||
vim.notify = require('mini.notify').make_notify()
|
||||
vim.keymap.set('n', '<Leader>un', require('mini.notify').show_history, { desc = 'Show notifications', silent = true })
|
||||
require('mini.statusline').setup({})
|
||||
require('mini.diff').setup({ view = { style = 'sign' } })
|
||||
|
||||
|
|
@ -160,7 +157,6 @@ return {
|
|||
{ mode = "n", keys = "<Leader>l", desc = "+LSP" },
|
||||
{ mode = "n", keys = "<Leader>r", desc = "+Replace" },
|
||||
{ mode = "n", keys = "<Leader>u", desc = "+UI & Config" },
|
||||
{ mode = "n", keys = "<Leader>un", desc = "+Noice" },
|
||||
{ mode = "n", keys = "<Leader>w", desc = "+Workspace" },
|
||||
{ mode = "n", keys = "<Leader>p", desc = "+Run stuff" },
|
||||
{ mode = "n", keys = "<Leader>z", desc = "+ZK" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue