configured lsp plugins

This commit is contained in:
venus
2026-03-10 02:12:25 -05:00
parent d223037865
commit be84313c2c
8 changed files with 106 additions and 15 deletions

View File

@@ -23,4 +23,11 @@ vim.api.nvim_create_autocmd("VimLeave", {
set_kitty_opacity(default_opacity)
end,
})
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})

47
lua/config/lsp.lua Normal file
View File

@@ -0,0 +1,47 @@
-- lsp config
require('lspconfig')
local lsp_servers = {
'clangd',
'pyright',
'lua_ls',
}
for _, server in ipairs(lsp_servers) do
local config = {}
-- Special settings for Lua
if server == 'lua_ls' then
config.settings = {
Lua = {
diagnostics = {
-- Tell the language server that 'vim' is a global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
},
}
end
-- Apply the config and enable
vim.lsp.config(server, config)
vim.lsp.enable(server)
end
-- highlight error messages
vim.diagnostic.config({
virtual_text = {
prefix = '',
spacing = 4,
},
-- Show signs in the gutter (left side)
signs = true,
-- Underline the actual code that has the error
underline = true,
-- Don't update diagnostics while typing (keeps it less distracting)
update_in_insert = true,
-- Better looking border for float windows
float = { border = "rounded" },
})

View File

@@ -1,11 +1,3 @@
-- [[ Basic Autocommands ]]
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})
-- move betwwen buffer easier
vim.keymap.set('n', '<Tab>', ':bnext<CR>')
vim.keymap.set('n', '<S-Tab>', ':bprev<CR>')
@@ -15,11 +7,8 @@ vim.keymap.set('n', '<leader>x', ':bdelete<CR>')
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
vim.keymap.set("n", "<leader>a", ":IncRename ", {desc = 'ren[a]me variable under cursor'})
-- vim.keymap.set("n", "<leader>a", ":IncRename ", {desc = 'ren[A]me variable under cursor'})
vim .keymap.set('n','<leader>r','<cmd>TermExec cmd="clear && make"<CR>', { desc = '[r]un make in terminal' })
vim .keymap .set('n','<leader>n', '<cmd>ToggleTerm direction=vertical name=compile size=70<CR>', { desc = 'open a [n]ew terminal' })
vim.keymap.set('n','<leader>t', '<cmd>ToggleTerm<CR>', {desc = '[T]oggle all terminals'})
@@ -41,7 +30,6 @@ vim.keymap.set("n", "<leader>l", function()
-- Return logic
end, { desc = "Run [L]ast command in terminal 1" })
-- more keybinds
-- TIP: Disable arrow keys in normal mode
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
@@ -63,3 +51,4 @@ vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
vim.keymap.set("n", "<leader>e", "<cmd>NERDTreeToggle<CR>", {desc = 'open [E]xplorer'})

View File

@@ -57,5 +57,6 @@ vim.opt.termguicolors = true -- required for colorizer
--set background color on entering and leaving nvim
require('autocommands')
vim.env.PATH = vim.fn.stdpath("data") .. "/mason/bin" .. ":" .. vim.env.PATH

7
lua/plugins/lsp.lua Normal file
View File

@@ -0,0 +1,7 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
{ "mason-org/mason.nvim", config = true }, -- The "App Store"
{ "mason-org/mason-lspconfig.nvim", config = true }, -- The "Bridge"
},
}

View File

@@ -0,0 +1,34 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = {
indent = { enable = true },
highlight = { enable = true },
folds = { enable = true },
ensure_installed = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
}
}