neovim plugin cleanup

This commit is contained in:
Alexander Navarro 2024-11-22 16:54:43 -03:00
parent 4a5a878a7f
commit 7c0c670e29
13 changed files with 311 additions and 360 deletions

View file

@ -2,7 +2,6 @@ return {
{
-- Color Picker
"uga-rosa/ccc.nvim",
event = "VeryLazy",
opts = {
auto_enable = true,
lsp = true,

View file

@ -1,6 +1,7 @@
return {
"stevearc/conform.nvim",
event = "VeryLazy",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
opts = {
-- log_level = vim.log.levels.DEBUG,
@ -13,13 +14,13 @@ return {
-- have other formatters configured.
["_"] = { "trim_whitespace" },
blade = { "blade-formatter" },
css = { "prettierd", "prettier" },
css = { "biome" },
go = { "gofumpt", "goimports_reviser", "golines" },
html = { "djlint", "prettierd", stop_after_first = true },
javascript = { "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier", stop_after_first = true },
jsonc = { "prettierd", "prettier", stop_after_first = true },
javascript = { "biome" },
javascriptreact = { "biome" },
json = { "biome" },
jsonc = { "biome" },
lua = { "stylua" },
markdown = { "markdownlint" },
nim = { "nimpretty" },
@ -27,8 +28,8 @@ return {
python = { "ruff_format", "ruff_organize_imports" },
scss = { "prettierd", "prettier", stop_after_first = true },
sh = { "shfmt" },
typescript = { "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
typescript = { "biome" },
typescriptreact = { "biome" },
xml = { "lemminx" },
zsh = { "shfmt" }
},

View file

@ -32,66 +32,4 @@ return {
end,
},
},
{
"kdheepak/lazygit.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>gG", ":LazyGit<CR>", desc = "Lazygit" },
},
},
{
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"nvim-telescope/telescope.nvim", -- optional
"sindrets/diffview.nvim", -- optional
},
config = true,
opts = {
disable_line_numbers = false,
console_timeout = 8000,
graph_style = "unicode",
kind = "tab",
ignored_settings = {
"NeogitPushPopup--force",
"NeogitPullPopup--rebase",
"NeogitCommitPopup--allow-empty",
"NeogitCommitPopup--reuse-message",
"NeogitRevertPopup--no-edit",
},
},
keys = {
{
"<leader>gg",
function()
require("neogit").open()
end,
desc = "Neogit",
},
{
"<leader>gc",
function()
require("neogit").open({ "commit" })
end,
desc = "Commit",
},
{
"<leader>gp",
function()
require("neogit").open({ "pull" })
end,
desc = "Pull",
},
{
"<leader>gP",
function()
require("neogit").open({ "push" })
end,
desc = "Push",
},
},
},
}

View file

@ -2,12 +2,10 @@ return {
{
"ckolkey/ts-node-action",
dependencies = { "nvim-treesitter" },
event = "VeryLazy",
config = function()
require("ts-node-action").setup({})
vim.keymap.set({ "n" }, "<leader>lA", require("ts-node-action").node_action, { desc = "Node Action" })
end,
opts = {},
keys = {
{ "<leader>ls", function() require("ts-node-action").node_action() end, desc = "Node Action" }
}
},
{
"Wansmer/treesj",

View file

@ -8,10 +8,10 @@ return {
lint.linters.gitlint.args = { "--contrib", "contrib-title-conventional-commits", "--msg-filename", "-" }
lint.linters_by_ft = {
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
javascript = { "biomejs" },
typescript = { "biomejs" },
javascriptreact = { "biomejs" },
typescriptreact = { "biomejs" },
-- astro = { "eslint_d" },
python = { "ruff" },
sh = { "shellcheck" },

View file

@ -1,253 +1,214 @@
return { {
-- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile", "BufWritePre" },
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim" },
"williamboman/mason-lspconfig.nvim",
-- Additional lua configuration, makes nvim stuff amazing!
{ "folke/neodev.nvim", opts = {} },
return {
-- LSP Plugins
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
{
-- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile", "BufWritePre" },
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim", config = true },
"williamboman/mason-lspconfig.nvim",
},
config = function()
-- LSP settings.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
config = function()
-- LSP settings.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
nmap("<leader>lr", vim.lsp.buf.rename, "Rename")
-- stylua: ignore
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" })
nmap("<leader>ld", vim.lsp.buf.type_definition, "Go to type definition")
nmap("<leader>lf", function()
vim.lsp.buf.format()
end, "Format")
nmap("gd", vim.lsp.buf.definition, "Go to definition")
nmap("gr", require("telescope.builtin").lsp_references, "Goto References")
nmap("gI", vim.lsp.buf.implementation, "Go to Implementation")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
-- nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "Goto Declaration")
nmap("<leader>lj", vim.diagnostic.goto_next, "Go to next diagnostic")
nmap("<leader>lk", vim.diagnostic.goto_prev, "Go to prev diagnostic")
nmap("<leader>lK", function()
-- execute twice to enter the float inmediatly
vim.diagnostic.open_float()
vim.diagnostic.open_float()
end, "Hover current diagnostic")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = "Format current buffer with LSP" })
end
nmap("<leader>lr", vim.lsp.buf.rename, "Rename")
-- stylua: ignore
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" })
nmap("<leader>ld", vim.lsp.buf.type_definition, "Go to type definition")
nmap("<leader>lf", function()
vim.lsp.buf.format()
end, "Format")
nmap("gd", vim.lsp.buf.definition, "Go to definition")
nmap("gr", require("telescope.builtin").lsp_references, "Goto References")
nmap("gI", vim.lsp.buf.implementation, "Go to Implementation")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
-- nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "Goto Declaration")
nmap("<leader>lj", vim.diagnostic.goto_next, "Go to next diagnostic")
nmap("<leader>lk", vim.diagnostic.goto_prev, "Go to prev diagnostic")
nmap("<leader>lK", function()
-- execute twice to enter the float inmediatly
vim.diagnostic.open_float()
vim.diagnostic.open_float()
end, "Hover current diagnostic")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = "Format current buffer with LSP" })
end
-- Enable the following language servers
-- To see options and cofigurations: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local servers = {
astro = {},
bashls = {},
cssls = {},
dockerls = {},
emmet_ls = {
filetypes = {
"astro",
"css",
"eruby",
"html",
"htmldjango",
"javascriptreact",
"less",
"pug",
"sass",
"scss",
"svelte",
"typescriptreact",
"vue",
"htmlangular",
"php",
"blade"
-- Enable the following language servers
-- To see options and cofigurations: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local servers = {
astro = {},
bashls = {},
cssls = {},
dockerls = {},
emmet_ls = {
filetypes = {
"astro",
"css",
"eruby",
"html",
"htmldjango",
"javascriptreact",
"less",
"pug",
"sass",
"scss",
"svelte",
"typescriptreact",
"vue",
"htmlangular",
"php",
"blade"
},
},
},
html = {},
["nil_ls"] = {},
marksman = {},
pyright = {},
phpactor = {},
gopls = {
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
html = {},
marksman = {},
pyright = {},
phpactor = {},
gopls = {
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
},
},
ruff = {},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
ruff = {},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
prefix = "self",
},
cargo = {
buildScripts = {
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
},
sqlls = {},
yamlls = {},
tsserver = {
init_options = {
preferences = {
disableSuggestions = true,
},
},
},
lua_ls = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
sqlls = {},
yamlls = {},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
diagnostics = { disable = { 'missing-fields' } },
},
},
},
},
}
}
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
-- automatic_installation = { exclude = { "astro", "phpactor", "rust_analyzer", "sqlls" } },
automatic_installation = false,
})
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
automatic_installation = false,
})
mason_lspconfig.setup_handlers({
function(server_name)
local _border = "single"
mason_lspconfig.setup_handlers({
function(server_name)
local _border = "single"
local default_config = {
capabilities = capabilities,
on_attach = on_attach,
handlers = {
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = _border,
}),
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = _border,
max_width = 200,
max_height = 200,
focus = true,
}),
},
}
local default_config = {
capabilities = capabilities,
on_attach = on_attach,
handlers = {
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = _border,
}),
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = _border,
max_width = 200,
max_height = 200,
focus = true,
}),
},
}
require("lspconfig")[server_name].setup(
vim.tbl_deep_extend("force", default_config, servers[server_name] or {})
)
end,
})
vim.diagnostic.config({
update_in_insert = false,
underline = true,
float = {
source = true
},
virtual_text = {
severity = vim.diagnostic.severity.ERROR,
source = true,
spacing = -1,
prefix = nil,
format = function(diagnostic)
-- show small error code instead of whole error that probably won't fit in the screen
-- to see the whole error use other keybindings
return tostring(diagnostic.code)
require("lspconfig")[server_name].setup(
vim.tbl_deep_extend("force", default_config, servers[server_name] or {})
)
end,
virt_text_hide = true
},
severity_sort = true,
})
})
-- Customize gutter icons
local signs = require("aleidk.constants").icons.diagnostics
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end,
},
{
'stevearc/aerial.nvim',
-- Optional dependencies
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons"
},
opts = {
close_on_select = false,
show_guides = true,
autojump = true,
highlight_on_hover = true,
layout = {
default_direction = "float",
},
float = {
relative = "editor",
},
nav = {
preview = true,
keymaps = {
["q"] = "actions.close",
vim.diagnostic.config({
update_in_insert = false,
underline = true,
float = {
source = true
},
},
},
virtual_text = {
severity = vim.diagnostic.severity.ERROR,
source = true,
spacing = -1,
prefix = nil,
format = function(diagnostic)
-- show small error code instead of whole error that probably won't fit in the screen
-- to see the whole error use other keybindings
return tostring(diagnostic.code)
end,
virt_text_hide = true
},
severity_sort = true,
})
keys = {
{ "<leader>ll", function() require("aerial").toggle() end, desc = "Open syntax tree" },
{ "<leader>lL", function() require("aerial").nav_toggle() end, desc = "Open syntax tree navigation" },
{ "<leader>fl", "<CMD>Telescope aerial<CR>", desc = "Find in syntax tree" },
}
}
-- Customize gutter icons
local signs = require("aleidk.constants").icons.diagnostics
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end,
},
}

View file

@ -1,8 +0,0 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
build = ":MasonUpdate",
opts = {
ensure_installed = {},
},
}

View file

@ -1,6 +1,7 @@
return {
"nosduco/remote-sshfs.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
cmd = { "RemoteSSHFSConnec" },
config = function()
require("remote-sshfs").setup({})
require("telescope").load_extension("remote-sshfs")

View file

@ -19,13 +19,11 @@ local scroll_to_end = function(winid)
winid = winid or 0
local bufnr = vim.api.nvim_win_get_buf(winid)
local lnum = vim.api.nvim_buf_line_count(bufnr)
local last_line = vim.api.nvim_buf_get_lines(bufnr, -2, -1, true)[1]
-- Hack: terminal buffers add a bunch of empty lines at the end. We need to ignore them so that
-- we don't end up scrolling off the end of the useful output.
local not_much_output = lnum < vim.o.lines + 6
if vim.bo[bufnr].buftype == "terminal" and not_much_output then
lnum = term_get_effective_line_count(bufnr)
last_line = vim.api.nvim_buf_get_lines(bufnr, lnum - 1, lnum, true)[1]
end
local scrolloff = vim.api.nvim_get_option_value("scrolloff", { scope = "local", win = winid })
vim.api.nvim_set_option_value("scrolloff", 0, { scope = "local", win = winid })
@ -57,22 +55,22 @@ end
return {
"stevearc/overseer.nvim",
keys = {
{ "<leader>pO", "<CMD>OverseerQuickAction hsplit<CR>", desc = "Open task in a hsplit" },
{ "<leader>pO", "<CMD>OverseerQuickAction hsplit<CR>", desc = "Open task in a hsplit" },
{
"<leader>pQ",
"<CMD>OverseerQuickAction close win<CR><CMD>OverseerQuickAction dispose<CR>",
desc = "Close and dispose task's windows",
},
{ "<leader>pW", "<CMD>OverseerQuickAction unwatch<CR>", desc = "Unwatch task" },
{ "<leader>pW", "<CMD>OverseerQuickAction unwatch<CR>", desc = "Unwatch task" },
{ "<leader>pf", "<CMD>OverseerQuickAction open float<CR>", desc = "Open task in a float window" },
{ "<leader>pl", "<CMD>OverseerLoadBundle<CR>", desc = "Load tasks" },
{ "<leader>pm", "<CMD>OverseerTaskAction<CR>", desc = "Manage task" },
{ "<leader>po", "<CMD>OverseerQuickAction vsplit<CR>", desc = "Open task in a vsplit" },
{ "<leader>pp", "<CMD>OverseerRun<CR>", desc = "Run task" },
{ "<leader>pq", "<CMD>OverseerQuickAction close win<CR>", desc = "Close task's windows" },
{ "<leader>ps", "<CMD>OverseerSaveBundle<CR>", desc = "Save tasks" },
{ "<leader>pt", "<CMD>OverseerToggle<CR>", desc = "Toggle tasks list" },
{ "<leader>pw", "<CMD>OverseerQuickAction watch<CR>", desc = "Watch task" },
{ "<leader>pl", "<CMD>OverseerLoadBundle<CR>", desc = "Load tasks" },
{ "<leader>pm", "<CMD>OverseerTaskAction<CR>", desc = "Manage task" },
{ "<leader>po", "<CMD>OverseerQuickAction vsplit<CR>", desc = "Open task in a vsplit" },
{ "<leader>pp", "<CMD>OverseerRun<CR>", desc = "Run task" },
{ "<leader>pq", "<CMD>OverseerQuickAction close win<CR>", desc = "Close task's windows" },
{ "<leader>ps", "<CMD>OverseerSaveBundle<CR>", desc = "Save tasks" },
{ "<leader>pt", "<CMD>OverseerToggle<CR>", desc = "Toggle tasks list" },
{ "<leader>pw", "<CMD>OverseerQuickAction watch<CR>", desc = "Watch task" },
},
opts = {
actions = {

View file

@ -1,24 +1,80 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = { "TroubleToggle", "Trouble" },
cmd = { "Trouble" },
keys = {
{ "<leader>fq", "<CMD>TroubleToggle<CR>", desc = "Toggle trouble" },
{ "<leader>fd", "<CMD>TroubleToggle workspace_diagnostics<CR>", desc = "Find diagnostics" },
{
"<leader>fD",
"<CMD>TroubleToggle document_diagnostics<CR>",
desc = "Find diagnostics in workspace",
"<cmd>Trouble diagnostics open<cr>",
desc = "Find diagnostics (Trouble)",
},
{
"<leader>fd",
"<cmd>Trouble diagnostics open filter.buf=0<cr>",
desc = "Find buffer diagnostics (Trouble)",
},
{
"<leader>ll",
"<cmd>Trouble symbols open<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>li",
"<cmd>Trouble lsp open<cr>",
desc = "LSP info of node (Trouble)",
},
{
"<leader>fq",
"<cmd>Trouble qflist open<cr>",
desc = "Quickfix List (Trouble)",
},
},
config = function()
require("trouble").setup({
mode = "document_diagnostics",
action_keys = {
open_split = "s",
open_vsplit = "v",
open_tab = "t",
opts = function()
---@type trouble.Window.opts
local win_opts = {
-- size = { width = 30, height = 0.5 },
minimal = true,
border = "rounded",
position = "bottom",
}
---@type trouble.Config
return {
focus = false,
---@type trouble.Window.opts
preview = {
type = "split",
relative = "win",
position = "top",
},
})
end,
---@type table<string, trouble.Action.spec|false>
keys = {
["<cr>"] = "jump_close",
["<2-leftmouse>"] = "jump_close",
["<c-v>"] = "jump_split_close",
["<c-s>"] = "jump_vsplit_close",
["v"] = "jump_split_close",
["s"] = "jump_vsplit_close",
["<c-k>"] = "cancel", -- hack to fool myself into thinking I move to the avobe window
},
win = win_opts,
---@type table<string, trouble.Mode>
modes = {
symbols = {
focus = true,
win = win_opts
},
lsp_references = {
focus = true,
win = win_opts
},
lsp = {
focus = true,
win = win_opts
},
}
}
end
}