feat: update nvim configs

1) add yank highlight
2) add mappings for lsp
This commit is contained in:
hhhh hgfh 2025-10-19 14:30:11 +03:00
parent 7d16827113
commit becfea4c41
4 changed files with 26 additions and 4 deletions

View file

@ -29,6 +29,7 @@
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"ui": { "branch": "v3.0", "commit": "03b9718140375e7f3f5e4f3e04bc2b6c907440ec" }, "ui": { "branch": "v3.0", "commit": "03b9718140375e7f3f5e4f3e04bc2b6c907440ec" },
"vim-highlightedyank": { "branch": "master", "commit": "285a61425e79742997bbde76a91be6189bc988fb" },
"volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" },
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
} }

View file

@ -4,7 +4,7 @@ local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities local capabilities = require("nvchad.configs.lspconfig").capabilities
-- Новый способ настройки LSP для Neovim 0.11+ -- clangd lsp server
vim.lsp.config('clangd', { vim.lsp.config('clangd', {
on_attach = on_attach, on_attach = on_attach,
on_init = on_init, on_init = on_init,
@ -13,11 +13,22 @@ vim.lsp.config('clangd', {
"clangd", "clangd",
"--background-index", "--background-index",
"--clang-tidy", "--clang-tidy",
"--header-insertion=iwyu", "--experemental-modules-support",
"--all-scopes-completion",
"--completion-style=detailed", "--completion-style=detailed",
"--function-arg-placeholders=1", "--header-insertion=iwyu",
"--limit-references=5",
"--malloc-trim",
"--pch-storage=disk",
}, },
filetypes = { "c", "cpp", "objc", "objcpp" }, filetypes = { "c", "cpp", "objc", "objcpp" },
init_options = {
fallbackFlags = {'-std=c++20'},
}
})
vim.diagnostic.config({
virtual_text = false,
}) })
vim.lsp.enable('clangd') vim.lsp.enable('clangd')

View file

@ -15,3 +15,9 @@ map('n', '<leader>di', '<cmd>DapStepInto<CR>', { desc = 'Step into' })
map('n', '<leader>do', '<cmd>DapStepOut<CR>', { desc = 'Step out' }) map('n', '<leader>do', '<cmd>DapStepOut<CR>', { desc = 'Step out' })
map('n', '<leader>dq', '<cmd>DapTerminate<CR>', { desc = 'Stop debug' }) map('n', '<leader>dq', '<cmd>DapTerminate<CR>', { desc = 'Stop debug' })
map('n', '<leader>du', '<cmd>lua require("dapui").toggle()<CR>', { desc = 'Toggle DAP UI' }) map('n', '<leader>du', '<cmd>lua require("dapui").toggle()<CR>', { desc = 'Toggle DAP UI' })
-- LSP
map('n', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true, desc = 'Open diagnostic' })
map('n', '[l', '<cmd>DapContinue<CR>', { noremap = true, silent = true, desc = 'Go to prev diagnostic' })
map('n', ']l', '<cmd>DapStepOver<CR>', { noremap = true, silent = true, desc = 'Go to next diagnostic' })
map('n', '<leader>lt', '<cmd>DapStepInto<CR>', { noremap = true, silent = true, desc = 'Open toggle' })

View file

@ -12,7 +12,11 @@ return {
require "configs.lspconfig" require "configs.lspconfig"
end, end,
}, },
-- Yank highlight
{
"machakann/vim-highlightedyank",
event = "VeryLazy",
},
-- These are for C/C++ Debbuger -- These are for C/C++ Debbuger
{ {
"nvim-neotest/nvim-nio", "nvim-neotest/nvim-nio",