re-structure neovim plugins
also delete unused ones
This commit is contained in:
parent
ea5957f6d4
commit
071be15dc1
47 changed files with 155 additions and 274 deletions
84
config/nvim/lua/aleidk/plugins-ide/ai.lua
Normal file
84
config/nvim/lua/aleidk/plugins-ide/ai.lua
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
return {
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = true, auto_refresh = true },
|
||||
})
|
||||
end,
|
||||
},
|
||||
"hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer
|
||||
"nvim-telescope/telescope.nvim", -- Optional: For using slash commands
|
||||
{ "stevearc/dressing.nvim", opts = {} }, -- Optional: Improves `vim.ui.select`
|
||||
},
|
||||
opts = {
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "copilot",
|
||||
},
|
||||
inline = {
|
||||
adapter = "copilot",
|
||||
},
|
||||
agent = { adapter = "copilot" },
|
||||
},
|
||||
display = {
|
||||
action_palette = {
|
||||
prompt = " "
|
||||
},
|
||||
chat = {
|
||||
window = {
|
||||
layout = "float",
|
||||
height = 0.8,
|
||||
width = 0.8,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>at",
|
||||
function()
|
||||
require("codecompanion").toggle()
|
||||
end,
|
||||
desc = "Toggle AI chat",
|
||||
mode = { "n", "v" }
|
||||
},
|
||||
{
|
||||
"<leader>aa",
|
||||
"<CMD>CodeCompanion<CR>",
|
||||
desc = "Run an inline prompt",
|
||||
mode = { "n", "v" }
|
||||
},
|
||||
{
|
||||
"<leader>aA",
|
||||
function()
|
||||
require("codecompanion").actions()
|
||||
end,
|
||||
desc = "Open AI actions",
|
||||
mode = { "n", "v" }
|
||||
},
|
||||
{
|
||||
"<leader>av",
|
||||
function()
|
||||
require("codecompanion").add()
|
||||
end,
|
||||
desc = "Add visual selection to chat",
|
||||
mode = "v"
|
||||
},
|
||||
{
|
||||
"<leader>ae",
|
||||
function()
|
||||
require("codecompanion").prompt("explain")
|
||||
end,
|
||||
desc = "Explain code",
|
||||
mode = "v"
|
||||
},
|
||||
}
|
||||
}
|
||||
15
config/nvim/lua/aleidk/plugins-ide/color-picker.lua
Normal file
15
config/nvim/lua/aleidk/plugins-ide/color-picker.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
-- Color Picker
|
||||
"uga-rosa/ccc.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
auto_enable = true,
|
||||
lsp = true,
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>uc", "<CMD>CccPick<CR>", desc = "Open Color picker" },
|
||||
{ "<leader>uC", "<CMD>CccHighlighterToggle<CR>", desc = "Toggle Color highlight" },
|
||||
},
|
||||
},
|
||||
}
|
||||
120
config/nvim/lua/aleidk/plugins-ide/completion.lua
Normal file
120
config/nvim/lua/aleidk/plugins-ide/completion.lua
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
---@diagnostic disable: missing-fields
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip",
|
||||
"davidsierradz/cmp-conventionalcommits",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"petertriho/cmp-git",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"windwp/nvim-autopairs",
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
config = function()
|
||||
require("copilot_cmp").setup()
|
||||
end
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||
local cmp = require("cmp")
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local defaults = require("cmp.config.default")()
|
||||
local window_opts = {
|
||||
border = "rounded",
|
||||
side_padding = 1,
|
||||
-- fix colors for catppuccin colorscheme
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
|
||||
}
|
||||
local opts = {
|
||||
visible_docs = false,
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-o>"] = function()
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
else
|
||||
cmp.open_docs()
|
||||
end
|
||||
end,
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<BR>"] = cmp.mapping.abort(),
|
||||
["<C-CR>"] = cmp.mapping.confirm({ select = false }), -- Confirm only if selected an item
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
-- Auto confirms first item
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "conventionalcommits" },
|
||||
{ name = "copilot" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(_, item)
|
||||
local icons = require("aleidk.constants").icons.kinds
|
||||
if icons[item.kind] then
|
||||
item.kind = icons[item.kind] .. item.kind
|
||||
end
|
||||
return item
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(window_opts),
|
||||
documentation = cmp.config.window.bordered(window_opts),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "CmpGhostText",
|
||||
},
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require("copilot_cmp.comparators").prioritize,
|
||||
|
||||
-- Below is the default comparitor list and order for nvim-cmp
|
||||
cmp.config.compare.offset,
|
||||
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.recently_used,
|
||||
cmp.config.compare.locality,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup(opts)
|
||||
end,
|
||||
}
|
||||
44
config/nvim/lua/aleidk/plugins-ide/database.lua
Normal file
44
config/nvim/lua/aleidk/plugins-ide/database.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
return {
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
{ "tpope/vim-dadbod", lazy = true },
|
||||
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
||||
},
|
||||
cmd = {
|
||||
"DBUI",
|
||||
"DBUIToggle",
|
||||
"DBUIAddConnection",
|
||||
"DBUIFindBuffer",
|
||||
},
|
||||
keys = {
|
||||
{ "<Leader>ud", "<CMD>DBUIToggle<CR>", desc = "Toggle DB UI" },
|
||||
},
|
||||
init = function()
|
||||
-- Your DBUI configuration
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
vim.g.db_ui_force_echo_notifications = 1
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"sql",
|
||||
"mysql",
|
||||
"plsql",
|
||||
},
|
||||
command = [[setlocal omnifunc=vim_dadbod_completion#omni]],
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"sql",
|
||||
"mysql",
|
||||
"plsql",
|
||||
},
|
||||
callback = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require("cmp").setup.buffer({
|
||||
sources = { { name = "vim-dadbod-completion" }, { name = "buffer" } },
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
15
config/nvim/lua/aleidk/plugins-ide/doc-gen.lua
Normal file
15
config/nvim/lua/aleidk/plugins-ide/doc-gen.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"danymat/neogen",
|
||||
opts = { snippet_engine = "luasnip" },
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
version = "*", -- stable releases
|
||||
keys = {
|
||||
{
|
||||
"gcd",
|
||||
function()
|
||||
require("neogen").generate()
|
||||
end,
|
||||
desc = "Generate comment docstring",
|
||||
},
|
||||
},
|
||||
}
|
||||
120
config/nvim/lua/aleidk/plugins-ide/formatter.lua
Normal file
120
config/nvim/lua/aleidk/plugins-ide/formatter.lua
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- log_level = vim.log.levels.DEBUG,
|
||||
|
||||
-- See aviable formatters in: https://github.com/stevearc/conform.nvim#formatters
|
||||
-- Formatters can be installed by mason
|
||||
formatters_by_ft = {
|
||||
-- Conform will run multiple formatters sequentially
|
||||
-- Use a stop_after_first = true to run only the first available formatter
|
||||
-- Use the "_" filetype to run formatters on filetypes that don't
|
||||
-- have other formatters configured.
|
||||
["_"] = { "trim_whitespace" },
|
||||
blade = { "blade-formatter" },
|
||||
css = { "prettierd", "prettier" },
|
||||
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 },
|
||||
lua = { "stylua" },
|
||||
markdown = { "markdownlint" },
|
||||
nim = { "nimpretty" },
|
||||
php = { "pint" },
|
||||
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 },
|
||||
xml = { "lemminx" },
|
||||
zsh = { "shfmt" }
|
||||
},
|
||||
formatters = {
|
||||
djlint = {
|
||||
prepend_args = {
|
||||
"--format-css",
|
||||
"--indent-css",
|
||||
"2",
|
||||
"--format-js",
|
||||
"--indent-js",
|
||||
"2",
|
||||
"--indent",
|
||||
"2",
|
||||
"--preserve-blank-lines",
|
||||
"--quiet"
|
||||
}
|
||||
}
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
return { timeout_ms = 2000, lsp_fallback = true }
|
||||
end,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("conform").setup(opts)
|
||||
|
||||
local function toggleAutoFormat()
|
||||
-- to make this global, change b to g
|
||||
if vim.b.disable_autoformat == nil then
|
||||
vim.b.disable_autoformat = true
|
||||
print("Autoformat set to: " .. tostring(not vim.b.disable_autoformat))
|
||||
return
|
||||
end
|
||||
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
print("Autoformat set to: " .. tostring(not vim.b.disable_autoformat))
|
||||
end
|
||||
|
||||
MAP("n", "<leader>uf", toggleAutoFormat, "Toggle auto format")
|
||||
|
||||
vim.api.nvim_create_user_command("Fmt", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
|
||||
local function callback(err, did_edit)
|
||||
if not did_edit then
|
||||
vim.notify("The file was not formatted:\n" .. tostring(err), vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
if args.bang then
|
||||
vim.cmd("w")
|
||||
end
|
||||
end
|
||||
|
||||
require("conform").format(
|
||||
{
|
||||
async = true,
|
||||
lsp_format = "fallback",
|
||||
range = range,
|
||||
formatters = args.fargs
|
||||
},
|
||||
callback
|
||||
)
|
||||
end, {
|
||||
range = true,
|
||||
bang = true,
|
||||
force = true,
|
||||
desc = "Format the document",
|
||||
nargs = '*',
|
||||
-- complete = function()
|
||||
-- local formatters = require('conform').formatters_by_ft
|
||||
--
|
||||
-- return vim.tbl_keys(formatters)
|
||||
-- end
|
||||
})
|
||||
end,
|
||||
}
|
||||
97
config/nvim/lua/aleidk/plugins-ide/git.lua
Normal file
97
config/nvim/lua/aleidk/plugins-ide/git.lua
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
on_attach = function(buffer)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, desc)
|
||||
vim.keymap.set(mode, "<leader>g" .. l, r, { buffer = buffer, desc = desc })
|
||||
end
|
||||
|
||||
-- stylua: ignore start
|
||||
map("n", "j", gs.next_hunk, "Next Hunk")
|
||||
map("n", "k", gs.prev_hunk, "Prev Hunk")
|
||||
map({ "n", "v" }, "s", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
|
||||
map({ "n", "v" }, "r", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
|
||||
map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk")
|
||||
map("n", "R", gs.reset_buffer, "Reset Buffer")
|
||||
map("n", "<TAB>", gs.preview_hunk, "Preview Hunk")
|
||||
map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line")
|
||||
map("n", "d", gs.diffthis, "Diff This")
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
29
config/nvim/lua/aleidk/plugins-ide/linters.lua
Normal file
29
config/nvim/lua/aleidk/plugins-ide/linters.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters.gitlint.stdin = true
|
||||
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" },
|
||||
-- astro = { "eslint_d" },
|
||||
python = { "ruff" },
|
||||
sh = { "shellcheck" },
|
||||
NeogitCommitMessage = { "gitlint" },
|
||||
gitcommit = { "gitlint" },
|
||||
markdown = { "markdownlint" },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
callback = function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
219
config/nvim/lua/aleidk/plugins-ide/lsp.lua
Normal file
219
config/nvim/lua/aleidk/plugins-ide/lsp.lua
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
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 = {} },
|
||||
},
|
||||
|
||||
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
|
||||
|
||||
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"
|
||||
},
|
||||
},
|
||||
html = {},
|
||||
["nil_ls"] = {},
|
||||
marksman = {},
|
||||
pyright = {},
|
||||
phpactor = {},
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
completeUnimported = true,
|
||||
usePlaceholders = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ruff = {},
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- 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")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
-- automatic_installation = { exclude = { "astro", "phpactor", "rust_analyzer", "sqlls" } },
|
||||
automatic_installation = false,
|
||||
})
|
||||
|
||||
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,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
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,
|
||||
}
|
||||
27
config/nvim/lua/aleidk/plugins-ide/luasnip.lua
Normal file
27
config/nvim/lua/aleidk/plugins-ide/luasnip.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
opts = {
|
||||
history = true,
|
||||
delete_check_events = "TextChanged",
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"<tab>",
|
||||
function()
|
||||
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
||||
end,
|
||||
expr = true,
|
||||
silent = true,
|
||||
mode = "i",
|
||||
},
|
||||
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
||||
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
||||
},
|
||||
}
|
||||
9
config/nvim/lua/aleidk/plugins-ide/mason.lua
Normal file
9
config/nvim/lua/aleidk/plugins-ide/mason.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
keys = { { "<leader>um", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||
build = ":MasonUpdate",
|
||||
opts = {
|
||||
ensure_installed = {},
|
||||
},
|
||||
}
|
||||
8
config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua
Normal file
8
config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"nosduco/remote-sshfs.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("remote-sshfs").setup({})
|
||||
require("telescope").load_extension("remote-sshfs")
|
||||
end,
|
||||
}
|
||||
145
config/nvim/lua/aleidk/plugins-ide/task-runner.lua
Normal file
145
config/nvim/lua/aleidk/plugins-ide/task-runner.lua
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
local function term_get_effective_line_count(bufnr)
|
||||
local linecount = vim.api.nvim_buf_line_count(bufnr)
|
||||
|
||||
local non_blank_lines = linecount
|
||||
for i = linecount, 1, -1 do
|
||||
local line = vim.api.nvim_buf_get_lines(bufnr, i - 1, i, true)[1]
|
||||
non_blank_lines = i
|
||||
if line ~= "" then
|
||||
break
|
||||
end
|
||||
end
|
||||
return non_blank_lines
|
||||
end
|
||||
|
||||
-- This is a copy of the original util function of overseer with the change that
|
||||
-- vim.api.nvim_win_set_cursor(winid, { lnum, 0 }) column is set to 0 so the output is visible
|
||||
-- the rest is the same
|
||||
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 })
|
||||
vim.api.nvim_win_set_cursor(winid, { lnum, 0 })
|
||||
vim.api.nvim_set_option_value("scrolloff", scrolloff, { scope = "local", win = winid })
|
||||
end
|
||||
|
||||
local open_split = function(task, horizontal)
|
||||
local original_window = vim.api.nvim_get_current_win()
|
||||
if horizontal then
|
||||
-- horizontal split across all vertical splits
|
||||
vim.cmd([[botright split]])
|
||||
else
|
||||
-- vertical split across all horizontal splits
|
||||
vim.cmd([[vert botright split]])
|
||||
end
|
||||
|
||||
-- Update tasks buffer options
|
||||
vim.api.nvim_win_set_buf(0, task:get_bufnr())
|
||||
vim.api.nvim_set_option_value("number", false, { scope = "local", win = 0 })
|
||||
vim.api.nvim_set_option_value("relativenumber", false, { scope = "local", win = 0 })
|
||||
vim.api.nvim_set_option_value("signcolumn", "no", { scope = "local", win = 0 })
|
||||
scroll_to_end(0)
|
||||
|
||||
-- Go back to the original window
|
||||
vim.api.nvim_set_current_win(original_window)
|
||||
end
|
||||
|
||||
return {
|
||||
"stevearc/overseer.nvim",
|
||||
keys = {
|
||||
{ "<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>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" },
|
||||
},
|
||||
opts = {
|
||||
actions = {
|
||||
["hsplit"] = {
|
||||
desc = "open terminal in a horizontal split",
|
||||
condition = function(task)
|
||||
local bufnr = task:get_bufnr()
|
||||
return bufnr and vim.api.nvim_buf_is_valid(bufnr)
|
||||
end,
|
||||
run = function(task)
|
||||
open_split(task, true)
|
||||
end,
|
||||
},
|
||||
["vsplit"] = {
|
||||
desc = "open terminal in a vertical split",
|
||||
condition = function(task)
|
||||
local bufnr = task:get_bufnr()
|
||||
return bufnr and vim.api.nvim_buf_is_valid(bufnr)
|
||||
end,
|
||||
run = function(task)
|
||||
open_split(task, false)
|
||||
end,
|
||||
},
|
||||
["close win"] = {
|
||||
desc = "open terminal in a vertical split",
|
||||
condition = function(task)
|
||||
local bufnr = task:get_bufnr()
|
||||
return bufnr and vim.api.nvim_buf_is_valid(bufnr)
|
||||
end,
|
||||
run = function(task)
|
||||
local buf = task:get_bufnr()
|
||||
-- iterar sobre todas las windows y ver si la window tiene attach el buf que quiero cerrar
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
if buf == vim.api.nvim_win_get_buf(win) then
|
||||
vim.api.nvim_win_close(win, false)
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
task_list = {
|
||||
direction = "bottom",
|
||||
bindings = {
|
||||
["?"] = "ShowHelp",
|
||||
["g?"] = "ShowHelp",
|
||||
["<CR>"] = "RunAction",
|
||||
["<C-e>"] = "Edit",
|
||||
["o"] = "Open",
|
||||
["<C-v>"] = "OpenVsplit",
|
||||
["<C-s>"] = "OpenSplit",
|
||||
["<C-f>"] = "OpenFloat",
|
||||
["<C-q>"] = "OpenQuickFix",
|
||||
["<TAB>"] = "TogglePreview",
|
||||
["p"] = "TogglePreview",
|
||||
["<C-l>"] = "IncreaseAllDetail",
|
||||
["<C-h>"] = "DecreaseAllDetail",
|
||||
["L"] = "IncreaseDetail",
|
||||
["H"] = "DecreaseDetail",
|
||||
["["] = "DecreaseWidth",
|
||||
["]"] = "IncreaseWidth",
|
||||
["{"] = "PrevTask",
|
||||
["}"] = "NextTask",
|
||||
["<C-u>"] = "ScrollOutputUp",
|
||||
["<C-d>"] = "ScrollOutputDown",
|
||||
["q"] = "Close",
|
||||
["d"] = "<CMD>OverseerQuickAction dispose<CR>",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
24
config/nvim/lua/aleidk/plugins-ide/trouble.lua
Normal file
24
config/nvim/lua/aleidk/plugins-ide/trouble.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
cmd = { "TroubleToggle", "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",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("trouble").setup({
|
||||
mode = "document_diagnostics",
|
||||
action_keys = {
|
||||
open_split = "s",
|
||||
open_vsplit = "v",
|
||||
open_tab = "t",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
23
config/nvim/lua/aleidk/plugins-ide/ts-node-action.lua
Normal file
23
config/nvim/lua/aleidk/plugins-ide/ts-node-action.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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,
|
||||
},
|
||||
{
|
||||
"Wansmer/treesj",
|
||||
cmd = { "TSJToggle" },
|
||||
keys = {
|
||||
{ "<leader>lm", "<CMD>TSJToggle<CR>", desc = "Toggle treesitter join" },
|
||||
},
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {
|
||||
use_default_keymaps = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
18
config/nvim/lua/aleidk/plugins-ide/typescript-tools.lua
Normal file
18
config/nvim/lua/aleidk/plugins-ide/typescript-tools.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"pmizio/typescript-tools.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
|
||||
opts = {
|
||||
init_options = {
|
||||
preferences = {
|
||||
disableSuggestions = true,
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
-- array of strings("fix_all"|"add_missing_imports"|"remove_unused"|
|
||||
-- "remove_unused_imports"|"organize_imports") -- or string "all"
|
||||
-- to include all supported code actions
|
||||
-- specify commands exposed as code_actions
|
||||
expose_as_code_action = "all",
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue