Compare commits
6 Commits
8b3598b821
...
7897d5169f
| Author | SHA1 | Date | |
|---|---|---|---|
| 7897d5169f | |||
| 74fa81f857 | |||
| baf089a8e5 | |||
| f23aa495a4 | |||
| af9c944768 | |||
| 165d3ccc20 |
@@ -99,11 +99,11 @@ Diagnostics:
|
|||||||
|
|
||||||
- `g.` open diagnostic float
|
- `g.` open diagnostic float
|
||||||
- `gl` send diagnostics to the location list
|
- `gl` send diagnostics to the location list
|
||||||
- `gle` display error information
|
- `gld` display diagnostic information
|
||||||
- `gie` toggle inline errors
|
- `gid` toggle inline diagnostics
|
||||||
- `gve` toggle virtual line errors
|
- `gvd` toggle virtual line diagnostics
|
||||||
- `]g` jump to next error
|
- `]g` jump to next warning or error
|
||||||
- `[g` jump to previous error
|
- `[g` jump to previous warning or error
|
||||||
|
|
||||||
## Tree-sitter
|
## Tree-sitter
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ local uc = vim.api.nvim_create_user_command
|
|||||||
local ac = vim.api.nvim_create_autocmd
|
local ac = vim.api.nvim_create_autocmd
|
||||||
local aug = vim.api.nvim_create_augroup
|
local aug = vim.api.nvim_create_augroup
|
||||||
|
|
||||||
-- User commands
|
|
||||||
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
||||||
|
|
||||||
-- Auto commands
|
|
||||||
ac("TextYankPost", {
|
ac("TextYankPost", {
|
||||||
desc = "Highlight when yanking text",
|
desc = "Highlight when yanking text",
|
||||||
group = aug("highlight-yank", { clear = true }),
|
group = aug("highlight-yank", { clear = true }),
|
||||||
@@ -13,14 +11,14 @@ ac("TextYankPost", {
|
|||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
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,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
-- 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,34 +90,49 @@ local function rename_without_default()
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
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)
|
callback = function(ev)
|
||||||
map("n", "gd", vim.lsp.buf.definition, { buffer = ev.buf, desc = "goto definition" })
|
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", "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", "grd", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" })
|
||||||
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol" })
|
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol from zero" })
|
||||||
map("i", "<C-Space>", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" })
|
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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
||||||
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
||||||
|
|
||||||
-- diagnostics only on error. g] is used by mini.ai
|
-- diagnostics on warnings and errors.
|
||||||
map("n", "]g", function()
|
map("n", "]g", function()
|
||||||
vim.diagnostic.goto_next({
|
vim.diagnostic.jump({
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
count = 1,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
end, { desc = "next error" })
|
end, { desc = "next warning/error" })
|
||||||
map("n", "[g", function()
|
map("n", "[g", function()
|
||||||
vim.diagnostic.goto_prev({
|
vim.diagnostic.jump({
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
count = -1,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
end, { desc = "prev error" })
|
end, { desc = "prev warning/error" })
|
||||||
|
|
||||||
map("n", "gle", vim.diagnostic.setloclist, { desc = "display error information" })
|
map("n", "gld", vim.diagnostic.setloclist, { desc = "display diagnostic information" })
|
||||||
map("n", "gie", function()
|
map("n", "gid", function()
|
||||||
vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
|
vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
|
||||||
end, { desc = "toggle inline errors" })
|
end, { desc = "toggle inline diagnostics" })
|
||||||
map("n", "gve", function()
|
map("n", "gvd", function()
|
||||||
vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines })
|
vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines })
|
||||||
end, { desc = "toggle virtual line errors" })
|
end, { desc = "toggle virtual line diagnostics" })
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
require("romanzy.plugins.rose-pine")
|
require("romanzy.plugins.rose-pine")
|
||||||
require("romanzy.plugins.mini")
|
require("romanzy.plugins.mini")
|
||||||
|
require("romanzy.plugins.blink-cmp")
|
||||||
require("romanzy.plugins.lazygit")
|
require("romanzy.plugins.lazygit")
|
||||||
require("romanzy.plugins.oil")
|
require("romanzy.plugins.oil")
|
||||||
require("romanzy.plugins.telescope")
|
require("romanzy.plugins.telescope")
|
||||||
|
|||||||
39
nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua
Normal file
39
nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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' },
|
||||||
|
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = false },
|
||||||
|
-- list = {
|
||||||
|
-- selection = {
|
||||||
|
-- preselect = false,
|
||||||
|
-- auto_insert = 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")
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noselect", "popup", "fuzzy" }
|
|
||||||
vim.opt.pumheight = 8
|
|
||||||
|
|
||||||
local diag_inline_enabled = true
|
local diag_inline_enabled = true
|
||||||
|
|
||||||
local function diag_virtual_text()
|
local function diag_virtual_text()
|
||||||
@@ -26,7 +23,7 @@ local function diag_virtual_text()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
severity = vim.diagnostic.severity.WARN,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -46,20 +43,7 @@ end
|
|||||||
|
|
||||||
configure_diagnostics()
|
configure_diagnostics()
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||||
callback = function(ev)
|
|
||||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
||||||
if not client then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.completion.enable(true, client.id, ev.buf, {
|
|
||||||
autotrigger = true,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
local managed_servers = {
|
local managed_servers = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"clangd",
|
"clangd",
|
||||||
|
|||||||
@@ -65,6 +65,13 @@ hipatterns.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
ai.setup({})
|
ai.setup({})
|
||||||
notify.setup({})
|
notify.setup({
|
||||||
|
lsp_progress = {
|
||||||
|
-- the message "lua_ls: processing completion..." and
|
||||||
|
-- "lua_ls: Diagnosing" is very annoying
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
vim.notify = notify.make_notify()
|
vim.notify = notify.make_notify()
|
||||||
surround.setup({})
|
surround.setup({})
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"plugins": {
|
"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": {
|
"codam-header.nvim": {
|
||||||
"rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193",
|
"rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193",
|
||||||
"src": "https://github.com/BeerB34r/codam-header.nvim"
|
"src": "https://github.com/BeerB34r/codam-header.nvim"
|
||||||
|
|||||||
Reference in New Issue
Block a user