configured lsp plugins
This commit is contained in:
5
init.lua
5
init.lua
@@ -24,6 +24,7 @@ require("lazy").setup({
|
||||
'TamaMcGlinn/vim-termhere', --simple terminal QOL
|
||||
"smjonas/inc-rename.nvim", --lsp plugin for renaming variable
|
||||
'basola21/PDFview', -- rendering pdfs in nvim
|
||||
'preservim/nerdtree',
|
||||
{ 'norcalli/nvim-colorizer.lua', config = function() require('colorizer').setup{"*"} end,}, -- preview colors
|
||||
{'NMAC427/guess-indent.nvim', config = function() require('guess-indent').setup {} end,}, -- Detect tabstop and shiftwidth automatically
|
||||
{ 'edluffy/hologram.nvim', auto_display = true,}, --image viewer
|
||||
@@ -35,7 +36,7 @@ require("lazy").setup({
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
-- install = { colorscheme = { "habamax" } },
|
||||
install = { colorscheme = { "miniautumn" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
@@ -45,3 +46,5 @@ if theme_ok then
|
||||
matugen.setup()
|
||||
end
|
||||
|
||||
-- setup lsp
|
||||
require("config.lsp")
|
||||
|
||||
@@ -10,15 +10,18 @@
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "0074b551a17338ccdcd299bd86687cc651bcb33d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"mini.nvim": { "branch": "main", "commit": "9d359222b3643f1fccbd8f3180445842e1cae00b" },
|
||||
"mini.pick": { "branch": "main", "commit": "8521fe21df86e08d9e4b3c3f3a7d50e47954e1af" },
|
||||
"neogit": { "branch": "master", "commit": "8fd90675caf8b847280ca56f464b66030adad876" },
|
||||
"nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-dap": { "branch": "master", "commit": "a9d8cb68ee7184111dc66156c4a2ebabfbe01bc5" },
|
||||
"nvim-java": { "branch": "main", "commit": "602a5f7fa92f9c1d425a2159133ff9de86842f0a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d8bf4c47385340ab2029402201d4d7c9f99f437a" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "4e91b5d0394329a229725b021a8ea217099826ef" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "350586c9e873143c3f65e3c2667bd0324964e89c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
|
||||
@@ -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
47
lua/config/lsp.lua
Normal 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" },
|
||||
})
|
||||
|
||||
@@ -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'})
|
||||
|
||||
@@ -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
7
lua/plugins/lsp.lua
Normal 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"
|
||||
},
|
||||
}
|
||||
34
lua/plugins/treesitter.lua
Normal file
34
lua/plugins/treesitter.lua
Normal 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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user