Update to Latest

This commit is contained in:
Ayush Dumasia 2025-02-23 00:38:43 +05:30
parent d1bbbcbb15
commit 71d6a8ab3b
157 changed files with 3467 additions and 5151 deletions

View file

@ -0,0 +1,68 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{ "antosha417/nvim-lsp-file-operations", config = true },
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
},
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Change the Diagnostic symbols in the sign column (gutter)
local signs = { Error = "", Warn = "", Hint = "󰠠", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
require("mason-lspconfig").setup_handlers({
-- default handler for installed servers
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
})
end,
})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Code action" })
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.declaration, { desc = "Go to declaration" }) -- go to declaration
vim.keymap.set("n", "<leader>co", vim.lsp.buf.rename, { desc = "Change all occurrence" }) -- smart rename
vim.keymap.set("n", "<leader>dp", vim.diagnostic.goto_prev, { desc = "Go to prev diagnostic" }) -- jump to previous diagnostic in buffer
vim.keymap.set("n", "<leader>dn", vim.diagnostic.goto_next, { desc = "Go to next diagnostic" }) -- jump to next diagnostic in buffer
vim.keymap.set("n", "<leader>lr", ":LspRestart<CR>", { desc = "Restart LSP" }) -- mapping to restart lsp if necessary
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then
return
end
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id })
end,
})
end
end,
})
end,
}

View file

@ -0,0 +1,6 @@
return {
"williamboman/mason-lspconfig.nvim",
opts = {
auto_install = true,
},
}

View file

@ -0,0 +1,33 @@
return {
"williamboman/mason.nvim",
config = function()
require("mason").setup({
ui = {
check_outdated_packages_on_open = true,
---@since 1.0.0
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
border = "rounded",
---@since 1.0.0
-- Width of the window. Accepts:
-- - Integer greater than 1 for fixed width.
-- - Float in the range of 0-1 for a percentage of screen width.
width = 0.6,
---@since 1.0.0
-- Height of the window. Accepts:
-- - Integer greater than 1 for fixed height.
-- - Float in the range of 0-1 for a percentage of screen height.
height = 0.6,
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
vim.keymap.set("n", "<leader>m", "<cmd>Mason<CR>", { desc = "Mason" })
end,
}

View file

@ -0,0 +1,14 @@
return {
"nvimtools/none-ls.nvim",
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, { desc = "Format file" })
end,
}