diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/nvim/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/lsp-config.lua | 83 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/mason.lua | 27 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/plugins.lua | 14 | ||||
-rw-r--r-- | .config/nvim/plugin/packer_compiled.lua | 50 |
5 files changed, 175 insertions, 1 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c24a27d..32d509b 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -11,4 +11,6 @@ require("justsaumit.which-key-config") require("justsaumit.colorizer-config") require("justsaumit.telescope-config") require("justsaumit.nvim-comment-config") +require("justsaumit.mason") +require("justsaumit.lsp-config") print ("while(!(succeed = try() ) );") diff --git a/.config/nvim/lua/justsaumit/lsp-config.lua b/.config/nvim/lua/justsaumit/lsp-config.lua new file mode 100644 index 0000000..f4db75f --- /dev/null +++ b/.config/nvim/lua/justsaumit/lsp-config.lua @@ -0,0 +1,83 @@ +local on_attach = function(client, bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + local function buf_set_option(...) + vim.api.nvim_buf_set_option(bufnr, ...) + end + + buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") + + local opts = { noremap = true, silent = true } + + buf_set_keymap("n", "gd", ":lua vim.lsp.buf.definition()<CR>", opts) --> jumps to the definition of the symbol under the cursor + buf_set_keymap("n", "<leader>lh", ":lua vim.lsp.buf.hover()<CR>", opts) --> information about the symbol under the cursos in a floating window + buf_set_keymap("n", "gi", ":lua vim.lsp.buf.implementation()<CR>", opts) --> lists all the implementations for the symbol under the cursor in the quickfix window + buf_set_keymap("n", "<leader>rn", ":lua vim.lsp.util.rename()<CR>", opts) --> renaname old_fname to new_fname + buf_set_keymap("n", "<leader>ca", ":lua vim.lsp.buf.code_action()<CR>", opts) --> selects a code action available at the current cursor position + buf_set_keymap("n", "gr", ":lua vim.lsp.buf.references()<CR>", opts) --> lists all the references to the symbl under the cursor in the quickfix window + buf_set_keymap("n", "<leader>ld", ":lua vim.diagnostic.open_float()<CR>", opts) + buf_set_keymap("n", "[d", ":lua vim.diagnostic.goto_prev()<CR>", opts) + buf_set_keymap("n", "]d", ":lua vim.diagnostic.goto_next()<CR>", opts) + buf_set_keymap("n", "<leader>lq", ":lua vim.diagnostic.setloclist()<CR>", opts) + buf_set_keymap("n", "<leader>lf", ":lua vim.lsp.buf.formatting()<CR>", opts) --> formats the current buffer +end + +---@diagnostic disable-next-line: undefined-global +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + +require("lspconfig")["clangd"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["pyright"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["bashls"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["cssls"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["gopls"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["html"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["lua_ls"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["marksman"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["rust_analyzer"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["tsserver"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) + +require("lspconfig")["yamlls"].setup({ + on_attach = on_attach, + capabilities = capabilities, +}) diff --git a/.config/nvim/lua/justsaumit/mason.lua b/.config/nvim/lua/justsaumit/mason.lua new file mode 100644 index 0000000..9698b00 --- /dev/null +++ b/.config/nvim/lua/justsaumit/mason.lua @@ -0,0 +1,27 @@ +require("mason").setup({ + options = { + ensure_installed = { "clangd", "clangd-format", "codelldb", "lua-language-server" }, -- not an option from mason.nvim + PATH = "skip" + }, + ui = { + icons = { + package_pending = " ", + package_installed = " ", + package_uninstalled = " ", + }, + keymaps = { + toggle_server_expand = "<CR>", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "<C-c>", + }, + }, + max_concurrent_installers = 10, +}) +require("mason-lspconfig").setup ({ + ensure_installed = { "lua_ls", "clangd", "pyright", "rust_analyzer" }, +}) diff --git a/.config/nvim/lua/justsaumit/plugins.lua b/.config/nvim/lua/justsaumit/plugins.lua index c4649fe..4d0edd9 100644 --- a/.config/nvim/lua/justsaumit/plugins.lua +++ b/.config/nvim/lua/justsaumit/plugins.lua @@ -61,8 +61,20 @@ return packer.startup(function(use) use {'akinsho/bufferline.nvim', tag = "v2.*", requires = 'nvim-tree/nvim-web-devicons'} --Nvim-tree File explorer for nvim use {'nvim-tree/nvim-tree.lua', requires = { 'nvim-tree/nvim-web-devicons'}} ---Whick-key - displays a popup with possible key bindings +--Which-key - displays a popup with possible key bindings use 'folke/which-key.nvim' +--Mason-nvim Portable Package manager for LSP and DAP servers, linters and formatters + use { "williamboman/mason.nvim", run = ":MasonUpdate"} -- :MasonUpdate updates registry contents +--lsp + use("williamboman/mason-lspconfig.nvim") + use("neovim/nvim-lspconfig") --> Collection of configurations for built-in LSP client + use("jose-elias-alvarez/null-ls.nvim") --> inject lsp diagnistocs, formattings, code actions, and more ... + use("tami5/lspsaga.nvim") --> icons for LSP diagnostics + use("onsails/lspkind-nvim") --> vscode-like pictograms for neovim lsp completion items + use("hrsh7th/nvim-cmp") --> Autocompletion plugin + use("hrsh7th/cmp-nvim-lsp") --> LSP source for nvim-cmp + use("saadparwaiz1/cmp_luasnip") --> Snippets source for nvim-cmp + use("L3MON4D3/LuaSnip") --> Snippets plugin --HTML -- use 'windwp/nvim-ts-autotag' --Markdown + Zenmode diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index 8f4534b..725dc9d 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -74,6 +74,11 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + LuaSnip = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, ["bufferline.nvim"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/bufferline.nvim", @@ -84,11 +89,51 @@ _G.packer_plugins = { path = "/home/saumit/.local/share/nvim/site/pack/packer/start/catppuccin", url = "https://github.com/catppuccin/nvim" }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + cmp_luasnip = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["lspkind-nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + url = "https://github.com/tami5/lspsaga.nvim" + }, ["lualine.nvim"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/lualine.nvim", url = "https://github.com/nvim-lualine/lualine.nvim" }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["null-ls.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + url = "https://github.com/jose-elias-alvarez/null-ls.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, ["nvim-colorizer.lua"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", @@ -104,6 +149,11 @@ _G.packer_plugins = { path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-lastplace", url = "https://github.com/ethanholz/nvim-lastplace" }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, ["nvim-tree.lua"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", |