chore: move plugins to an upper level

This commit is contained in:
Mariano Z. 2024-12-22 12:16:36 -03:00
parent 9569774c7b
commit 99bcb4ca97
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
50 changed files with 69 additions and 69 deletions

25
lua/plugins/ai.lua Normal file
View file

@ -0,0 +1,25 @@
local M = {
"Exafunction/codeium.vim",
cmd = "CodeiumEnable",
keys = {
{ "<leader>ce", "<cmd>CodeiumEnable<cr>", desc = "Codeium Enable" },
},
}
M.config = function()
vim.g.codeium_disable_bindings = 1
imap("<Tab>", function()
return vim.fn["codeium#Accept"]()
end, { expr = true, silent = true, desc = "[codeium] Accept completion" })
imap("<M-;>", function()
return vim.fn["codeium#CycleCompletions"](1)
end, { expr = true, silent = true, desc = "[codeium] Cycle completions" })
imap("<M-,>", function()
return vim.fn["codeium#CycleCompletions"](-1)
end, { expr = true, silent = true, desc = "[codeium] Cycle completions" })
end
return M

31
lua/plugins/blankline.lua Normal file
View file

@ -0,0 +1,31 @@
local M = {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
}
M.config = function()
require("ibl").setup({
indent = {
char = "",
tab_char = "",
},
scope = { enabled = false },
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
})
end
return M

35
lua/plugins/chezmoi.lua Normal file
View file

@ -0,0 +1,35 @@
return {
{
"alker0/chezmoi.vim",
lazy = false,
init = function()
-- This option is required.
vim.g["chezmoi#use_tmp_buffer"] = true
-- add other options here if needed.
end,
},
{
"xvzc/chezmoi.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("chezmoi").setup({
-- your configurations
edit = {
watch = true, -- Set true to automatically apply on save.
force = true, -- Set true to force apply. Works only when watch = true.
},
notification = {
on_open = true, -- vim.notify when start editing chezmoi-managed file.
on_apply = true, -- vim.notify on apply.
},
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
callback = function()
-- invoke with vim.schedule() for better startup time
vim.schedule(require("chezmoi.commands.__edit").watch)
end,
})
end,
},
}

31
lua/plugins/colorizer.lua Normal file
View file

@ -0,0 +1,31 @@
local M = {
"norcalli/nvim-colorizer.lua",
branch = "master",
}
M.config = function()
require("colorizer").setup({
filetypes = {
"typescript",
"typescriptreact",
"javascript",
"javascriptreact",
"css",
"html",
"astro",
"lua",
"go",
"golang",
"bash",
"sh",
},
user_default_options = {
names = false,
rgb_fn = true,
hsl_fn = true,
tailwind = "both",
},
})
end
return M

38
lua/plugins/comments.lua Normal file
View file

@ -0,0 +1,38 @@
local M = {
{
"numToStr/Comment.nvim",
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
event = "VeryLazy",
},
},
{ "folke/todo-comments.nvim" },
}
M.config = function()
vim.g.skip_ts_context_commentstring_module = true
require("ts_context_commentstring").setup({
enable_autocmd = false,
})
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
opleader = {
line = "gc",
block = "gC",
},
mappings = {
basic = true,
},
})
require("todo-comments").setup({
keywords = {
FUCK = { icon = "󰇷 ", color = "error" },
SHITTY = { icon = "󰇷 ", color = "error" },
},
})
end
return M

View file

@ -0,0 +1,81 @@
local M = {
"saghen/blink.cmp",
dependencies = "rafamadriz/friendly-snippets",
version = "v0.*",
}
M.config = function()
require("blink.cmp").setup({
keymap = {
["<C-space>"] = {
"show",
"show_documentation",
"hide_documentation",
},
["<C-d>"] = { "hide", "fallback" },
["<C-c>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
},
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "mono",
},
signature = {
enabled = true,
window = {
border = "single",
},
},
completion = {
list = {
-- Controls how the completion items are selected
-- 'preselect' will automatically select the first item in the completion list
-- 'manual' will not select any item by default
-- 'auto_insert' will not select any item by default, and insert the completion items automatically when selecting them
selection = "auto_insert",
},
menu = {
border = "single",
draw = {
components = {
kind_icon = {
ellipsis = false,
text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
return kind_icon
end,
highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
return hl
end,
},
},
},
},
},
fuzzy = {
-- When enabled, allows for a number of typos relative to the length of the query
-- Disabling this matches the behavior of fzf
use_typo_resistance = true,
-- Frecency tracks the most recently/frequently used items and boosts the score of the item
use_frecency = true,
-- Proximity bonus boosts the score of items matching nearby words
use_proximity = true,
-- Controls which sorts to use and in which order, falling back to the next sort if the first one returns nil
-- You may pass a function instead of a string to customize the sorting
sorts = { "score", "sort_text" },
},
})
end
return M

18
lua/plugins/db.lua Normal file
View file

@ -0,0 +1,18 @@
local M = {
"tpope/vim-dadbod",
cmd = {
"DBUI",
},
dependencies = {
"kristijanhusak/vim-dadbod-ui",
"kristijanhusak/vim-dadbod-completion",
},
}
M.config = function()
vim.g.db_ui_use_nerd_fonts = 1
-- g:db_ui_save_location
vim.g.db_ui_save_location = "~/Sync/saved_queries"
end
return M

121
lua/plugins/diagnostics.lua Normal file
View file

@ -0,0 +1,121 @@
local M = {
"folke/trouble.nvim",
branch = "main",
}
local function setup_keymaps(trouble)
-- Diagnostic navigation
nmap("[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
nmap("]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
-- Trouble specific navigation
nmap("<a-k>", function()
trouble.previous({ skip_groups = true, jump = true })
end, { desc = "Previous trouble item" })
nmap("<a-j>", function()
trouble.next({ skip_groups = true, jump = true })
end, { desc = "Next trouble item" })
-- Trouble mode toggles
nmap("<leader>tt", "<cmd>TroubleToggle<cr>", { desc = "Toggle trouble" })
nmap("<leader>tw", "<cmd>TroubleToggle workspace_diagnostics<cr>", { desc = "Workspace diagnostics" })
nmap("<leader>td", "<cmd>TroubleToggle document_diagnostics<cr>", { desc = "Document diagnostics" })
nmap("<leader>tq", "<cmd>TroubleToggle quickfix<cr>", { desc = "Quickfix list" })
nmap("<leader>tl", "<cmd>TroubleToggle loclist<cr>", { desc = "Location list" })
end
local function setup_diagnostic_config()
vim.diagnostic.config({
virtual_text = {
prefix = "",
suffix = "",
format = function(diagnostic)
local icons = {
[vim.diagnostic.severity.ERROR] = " ",
[vim.diagnostic.severity.WARN] = " ",
[vim.diagnostic.severity.HINT] = " ",
[vim.diagnostic.severity.INFO] = " ",
}
local icon = icons[diagnostic.severity] or ""
return string.format("%s %s", icon, diagnostic.message)
end,
},
underline = false,
update_in_insert = false,
signs = {
active = true,
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = true,
header = "",
prefix = "",
format = function(diagnostic)
local severity = vim.diagnostic.severity[diagnostic.severity]
return string.format("%s: %s", severity:lower(), diagnostic.message)
end,
},
severity_sort = true,
})
end
function M.config()
local trouble = require("trouble")
trouble.setup({
position = "bottom",
height = 10,
width = 50,
icons = true,
mode = "workspace_diagnostics",
fold_open = "",
fold_closed = "",
group = true,
padding = true,
action_keys = {
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
toggle_mode = "m", -- toggle between "workspace" and "document" mode
toggle_preview = "P", -- toggle auto_preview
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
},
auto_preview = true,
auto_fold = false,
auto_jump = { "lsp_definitions" },
signs = {
-- Icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
use_diagnostic_signs = false,
})
-- Setup keymaps
setup_keymaps(trouble)
-- Setup diagnostic configuration
setup_diagnostic_config()
end
return M

59
lua/plugins/env.lua Normal file
View file

@ -0,0 +1,59 @@
local M = {
{
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
cloak_character = "*",
highlight_group = "Comment",
patterns = {
{
file_pattern = {
".env*",
"wrangler.toml",
".dev.vars",
},
cloak_pattern = "=.+",
},
},
})
nmap("<Leader>cc", ":CloakToggle<cr>")
end,
},
{
"philosofonusus/ecolog.nvim",
keys = {
{ "<leader>ge", "<cmd>EcologGoto<cr>", desc = "Go to env file" },
{ "<leader>ep", "<cmd>EcologPeek<cr>", desc = "Ecolog peek variable" },
{ "<leader>es", "<cmd>EcologSelect<cr>", desc = "Switch env file" },
},
-- Lazy loading is done internally
lazy = false,
opts = {
integrations = {
blink_cmp = true,
},
-- Enables shelter mode for sensitive values
shelter = {
configuration = {
partial_mode = false, -- false by default, disables partial mode, for more control check out shelter partial mode
mask_char = "*", -- Character used for masking
},
modules = {
cmp = true, -- Mask values in completion
peek = false, -- Mask values in peek view
files = false, -- Mask values in files
telescope = false, -- Mask values in telescope
},
},
-- true by default, enables built-in types (database_url, url, etc.)
types = true,
path = vim.fn.getcwd(), -- Path to search for .env files
preferred_environment = "development", -- Optional: prioritize specific env files
},
},
}
M.config = function() end
return M

22
lua/plugins/flash.lua Normal file
View file

@ -0,0 +1,22 @@
local M = {
"folke/flash.nvim",
opts = {
jump = {
autojump = true,
},
modes = {
char = {
jump_labels = true,
multi_line = false,
},
},
},
}
M.config = function()
nmap("<leader>ff", function()
require("flash").jump()
end, { desc = "Flash" })
end
return M

53
lua/plugins/fold.lua Normal file
View file

@ -0,0 +1,53 @@
local M = {
"bbjornstad/pretty-fold.nvim",
}
M.config = function()
local global_setup = {
sections = {
left = { "content" },
right = {
" ",
function()
return ("[%dL]"):format(vim.v.foldend - vim.v.foldstart)
end,
"[",
"percentage",
"]",
},
},
matchup_patterns = {
{ "{", "}" },
{ "%(", ")" },
{ "%[", "]" },
},
process_comment_signs = ({ "delete", "spaces", false })[2],
}
local function ft_setup(lang, options) -- {{{
local opts = vim.tbl_deep_extend("force", global_setup, options)
if opts and opts.matchup_patterns and global_setup.matchup_patterns then
opts.matchup_patterns = vim.list_extend(opts.matchup_patterns, global_setup.matchup_patterns)
end
require("pretty-fold").ft_setup(lang, opts)
end -- }}}
require("pretty-fold").setup(global_setup)
ft_setup("lua", {
matchup_patterns = {
{ "^%s*do$", "end" },
{ "^%s*if", "end" },
{ "^%s*for", "end" },
{ "function[^%(]*%(", "end" },
},
})
ft_setup("vim", {
matchup_patterns = {
{ "^%s*function!?[^%(]*%(", "endfunction" },
},
})
end
return M

38
lua/plugins/format.lua Normal file
View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = {
"BufReadPre",
"BufNewFile",
},
config = function()
require("conform").setup({
formatters_by_ft = {
graphql = { "prettierd", "prettier" },
njk = { "prettierd", "prettier" },
html = { "prettierd", "prettier" },
typescript = { "prettierd", "prettier" },
lua = { "stylua" },
javascript = { "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier" },
sh = { "shfmt" },
bash = { "shfmt" },
tex = { "latexindent" },
go = { "gofumpt", "goimports-reviser", "golines" },
cs = { "csharpier" },
templ = { "templ" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
async = false,
},
notify_on_error = false,
})
end,
}

72
lua/plugins/fzf.lua Normal file
View file

@ -0,0 +1,72 @@
local M = {
"ibhagwan/fzf-lua",
}
M.config = function()
local config = require("fzf-lua.config")
local actions = require("trouble.sources.fzf").actions
config.defaults.actions.files["ctrl-q"] = actions.open
local fzf_lua = require("fzf-lua")
-- Basic fzf-lua setup
fzf_lua.setup({
layout = "fzf-vim",
keymap = {
fzf = {
["CTRL-Q"] = "select-all+accept",
},
},
grep = {
fzf_opts = {
["--history"] = vim.fn.stdpath("data") .. "/fzf-lua-grep-history",
},
},
})
nmap("K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
nmap("gd", function()
fzf_lua.lsp_definitions({ jump_to_single_result = true })
end, { desc = "Goto Definition" })
nmap("gr", function()
fzf_lua.lsp_references({ ignore_current_line = true })
end, { desc = "Goto References" })
nmap("gi", function()
fzf_lua.lsp_implementations({ jump_to_single_result = true })
end, { desc = "Goto Implementation" })
nmap("<leader>D", fzf_lua.lsp_typedefs, { desc = "Type Definition" })
nmap("<leader>ca", fzf_lua.lsp_code_actions, { desc = "Code Action" })
nmap("<leader>ds", fzf_lua.lsp_document_symbols, { desc = "Document Symbols" })
nmap("<leader>ws", fzf_lua.lsp_workspace_symbols, { desc = "Workspace Symbols" })
nmap("<leader>ic", fzf_lua.lsp_incoming_calls, { desc = "Incoming Calls" })
nmap("<leader>oc", fzf_lua.lsp_outgoing_calls, { desc = "Outgoing Calls" })
-- keys = {
nmap("<leader>/", function()
fzf_lua.files({
cwd_prompt = false,
silent = true,
})
end, { desc = "Find Files" })
nmap(";", fzf_lua.buffers, { desc = "Find Buffers" })
nmap("gf", fzf_lua.live_grep, { desc = "Find Live Grep" })
nmap("sb", fzf_lua.grep_curbuf, { desc = "Search Current Buffer" })
nmap("gw", fzf_lua.grep_cword, { desc = "Search word under cursor" })
nmap("gW", fzf_lua.grep_cWORD, { desc = "Search WORD under cursor" })
nmap("sk", fzf_lua.keymaps, { desc = "Search Keymaps" })
nmap("sh", fzf_lua.help_tags, { desc = "Search help" })
-- Automatic sizing of height/width of vim.ui.select
fzf_lua.register_ui_select(function(_, items)
local min_h, max_h = 0.60, 0.80
local h = (#items + 4) / vim.o.lines
if h < min_h then
h = min_h
elseif h > max_h then
h = max_h
end
return { winopts = { height = h, width = 0.80, row = 0.40 } }
end)
end
return M

30
lua/plugins/git.lua Normal file
View file

@ -0,0 +1,30 @@
local M = {
{ "lewis6991/gitsigns.nvim" },
{
"ruifm/gitlinker.nvim",
},
}
M.config = function()
require("gitsigns").setup({
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
current_line_blame = true,
signs = {
add = { text = icons.ui.BoldLineMiddle },
change = { text = icons.ui.BoldLineDashedMiddle },
delete = { text = icons.ui.TriangleShortArrowRight },
topdelete = { text = icons.ui.TriangleShortArrowRight },
changedelete = { text = icons.ui.BoldLineMiddle },
},
})
require("gitlinker").setup({
message = false,
console_log = false,
})
nmap("<leader>gy", "<cmd>lua require('gitlinker').get_buf_range_url('n')<cr>")
namp("<leader>gY", "<cmd>lua require('gitlinker').get_buf_range_url('n', 'blame')<cr>")
end
return M

35
lua/plugins/harpoon.lua Normal file
View file

@ -0,0 +1,35 @@
local M = {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
},
}
M.config = function()
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
sync_on_ui_close = true,
},
})
nmap("<leader>a", function()
harpoon:list():add()
end, { desc = "Harpoon: Append" })
nmap("<leader>h", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "Harpoon: Toggle Quick Menu" })
for i = 1, 4 do
nmap("<leader>" .. i, function()
harpoon:list():select(i)
end, { desc = "Harpoon: Select " .. i })
end
end
return M

View file

@ -0,0 +1,3 @@
local M = { "ethanholz/nvim-lastplace" }
return M

44
lua/plugins/lint.lua Normal file
View file

@ -0,0 +1,44 @@
local M = {
"mfussenegger/nvim-lint",
event = {
"BufReadPre",
"BufNewFile",
},
}
M.config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = {
"eslint_d",
},
typescript = {
"eslint_d",
},
javascriptreact = {
"eslint_d",
},
typescriptreact = {
"eslint_d",
},
-- go = {
-- "revive",
-- },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave", "BufEnter" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
nmap("<leader>ll", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end
return M

View file

@ -0,0 +1,13 @@
return {
"olexsmir/gopher.nvim",
ft = "go",
config = function(_, opts)
require("gopher").setup(opts)
vim.keymap.set("n", "<leader>gmt", ":GoMod tidy<cr>", {
desc = "[Go] Tidy",
})
end,
build = function()
vim.cmd([[silent! GoInstallDeps]])
end,
}

View file

@ -0,0 +1,9 @@
return {
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View file

@ -0,0 +1,10 @@
return {
"yioneko/nvim-vtsls",
dependencies = {
"dmmulroy/ts-error-translator.nvim",
},
config = function()
require("ts-error-translator").setup()
end,
ft = { "typescript", "javascript", "jsx", "tsx", "json" },
}

139
lua/plugins/lsp/init.lua Normal file
View file

@ -0,0 +1,139 @@
local M = {
"neovim/nvim-lspconfig",
dependencies = {
"saghen/blink.cmp",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
require("plugins.lsp.extras.lazydev"),
require("plugins.lsp.extras.gopher"),
require("plugins.lsp.extras.typescript"),
},
}
local function setup_autocommands(client, bufnr)
if client.server_capabilities.documentHighlightProvider then
local group = vim.api.nvim_create_augroup("LSPDocumentHighlight", { clear = true })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
group = group,
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
group = group,
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})
end
end
local function setup_keymaps(bufnr)
local keymaps = {
{ "<C-h>", vim.lsp.buf.signature_help, "Signature Help" },
{ "<leader>cw", vim.lsp.buf.rename, "Rename" },
{ "<leader>r", vim.lsp.buf.rename, "Rename" },
{ "vd", vim.diagnostic.open_float, "Open Diagnostics" },
{ "<leader>lr", ":LspRestart<CR>", "Restart LSP" },
{ "<leader>li", ":LspInfo<CR>", "LSP Info" },
}
for _, map in ipairs(keymaps) do
nmap(map[1], map[2], {
buffer = bufnr,
desc = map[3],
})
end
end
local function on_attach(client, bufnr)
setup_autocommands(client, bufnr)
setup_keymaps(bufnr)
end
local BORDER = "rounded"
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = BORDER }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = BORDER }),
}
function M.config()
require("mason").setup({
max_concurrent_installers = 4,
})
-- Ensure all tools are installed
local ensure_installed = {
-- LSP servers
"gopls",
"graphql-language-service-cli",
"html-lsp",
"htmx-lsp",
"json-lsp",
"lua-language-server",
"omnisharp",
"vtsls",
"yaml-language-server",
-- Formatters
"prettierd",
"shfmt",
"stylua",
"latexindent",
-- Additional tools
"eslint_d",
"templ",
}
local registry = require("mason-registry")
for _, tool in ipairs(ensure_installed) do
if not registry.is_installed(tool) then
vim.cmd("MasonInstall " .. tool)
end
end
require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = {
"gopls",
"html",
"htmx",
"jsonls",
"lua_ls",
"omnisharp",
"yamlls",
"graphql",
},
handlers = {
function(server_name)
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- Enable folding capabilities
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local base_opts = {
on_attach = on_attach,
capabilities = capabilities,
handlers = handlers,
flags = {
debounce_text_changes = 150,
},
}
-- Try to load server-specific configuration
local ok, server_opts = pcall(require, "plugins.lsp.servers." .. server_name)
if ok then
base_opts = vim.tbl_deep_extend("force", base_opts, server_opts)
end
-- Set up the LSP server
require("lspconfig")[server_name].setup(base_opts)
end,
},
})
end
return M

View file

@ -0,0 +1,15 @@
return {
settings = {
gopls = {
gofumpt = true, -- https://github.com/mvdan/gofumpt a stricter gofmt
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
flags = {
debounce_text_changes = 150, -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#change-detection
},
}

View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

View file

@ -0,0 +1,16 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
},
},
setup = {
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
end,
},
},
},
}

View file

@ -0,0 +1,21 @@
return {
settings = {
Lua = {
format = {
enable = false,
},
hint = {
enable = false,
arrayIndex = "Disable", -- "Enable" | "Auto" | "Disable"
await = true,
paramName = "Disable", -- "All" | "Literal" | "Disable"
paramType = true,
semicolon = "All", -- "All" | "SameLine" | "Disable"
setType = false,
},
telemetry = {
enable = false,
},
},
},
}

View file

@ -0,0 +1,7 @@
return {
settings = {
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
}

View file

@ -0,0 +1,21 @@
return {
settings = {
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = "",
},
schemas = require("schemastore").yaml.schemas({
-- additional schemas (not in the catalog)
extra = {
url = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json",
name = "Argo CD Application",
fileMatch = "argocd-application.yaml",
},
}),
},
},
}

20
lua/plugins/markdown.lua Normal file
View file

@ -0,0 +1,20 @@
local M = {
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && yarn install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
},
{
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
opts = {},
},
}
M.config = function() end
return M

24
lua/plugins/mini.lua Normal file
View file

@ -0,0 +1,24 @@
return {
"echasnovski/mini.nvim",
config = function()
require("mini.icons").setup()
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require("mini.ai").setup({ n_lines = 500 })
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup({})
end,
init = function()
package.preload["nvim-web-devicons"] = function()
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
}

19
lua/plugins/navic.lua Normal file
View file

@ -0,0 +1,19 @@
local M = {
"SmiteshP/nvim-navic",
}
M.config = function()
require("nvim-navic").setup({
icons = icons.kind,
highlight = true,
lsp = {
auto_attach = true,
},
click = true,
separator = " " .. icons.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
})
end
return M

69
lua/plugins/oil.lua Normal file
View file

@ -0,0 +1,69 @@
local M = {
"stevearc/oil.nvim",
}
M.config = function()
local function max_height()
local height = vim.fn.winheight(0)
if height >= 40 then
return 30
elseif height >= 30 then
return 20
else
return 10
end
end
require("oil").setup({
keymaps = {
["<C-p>"] = false,
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = "actions.select_split",
["<C-t>"] = "actions.select_tab",
["<C-c>"] = "actions.close",
["<C-l>"] = "actions.refresh",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["g."] = "actions.toggle_hidden",
},
-- Set to false if you still want to use netrw.
default_file_explorer = true,
delete_to_trash = true,
-- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
skip_confirm_for_simple_edits = true,
view_options = {
natural_order = true,
-- Show files and directories that start with "."
show_hidden = false,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name)
local ignore_folders = { "node_modules", "dist", "build", "coverage" }
return vim.startswith(name, ".") or vim.tbl_contains(ignore_folders, name)
end,
wrap = true,
},
-- Configuration for the floating window in oil.open_float
float = {
padding = 2,
max_width = 120,
max_height = max_height(),
border = "rounded",
win_options = {
winblend = 0,
},
},
})
vim.keymap.set("n", "-", function()
require("oil").open()
end)
end
return M

7
lua/plugins/schema.lua Normal file
View file

@ -0,0 +1,7 @@
local M = {
"b0o/schemastore.nvim",
}
M.config = function() end
return M

20
lua/plugins/snips.lua Normal file
View file

@ -0,0 +1,20 @@
local M = {
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
-- "saadparwaiz1/cmp_luasnip",
},
build = "make install_jsregexp",
}
M.config = function()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.fn.stdpath("config") .. "/lua/plugins/snippets/" })
require("luasnip").config.set_config({
history = true,
updateevents = "TextChanged,TextChangedI",
})
end
return M

22
lua/plugins/spectre.lua Normal file
View file

@ -0,0 +1,22 @@
local M = {
"nvim-pack/nvim-spectre",
}
M.config = function()
require("spectre").setup()
nmap("<leader>S", '<cmd>lua require("spectre").toggle()<CR>', {
desc = "Toggle Spectre",
})
nmap("<leader>sw", '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sw", '<esc><cmd>lua require("spectre").open_visual()<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sp", '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = "[Spectre] Search on current file",
})
end
return M

4
lua/plugins/sudo.lua Normal file
View file

@ -0,0 +1,4 @@
return {
"lambdalisue/suda.vim",
lazy = false,
}

9
lua/plugins/tpope.lua Normal file
View file

@ -0,0 +1,9 @@
local M = {
"tpope/vim-sleuth",
}
M.config = function()
vim.g.sleuth_automatic = 1
end
return M

View file

@ -0,0 +1,24 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "c", "lua", "typescript", "go", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
ignore_install = {},
modules = {},
sync_install = false,
auto_install = false,
highlight = {
enable = true,
disable = function(_, buf)
local max_filesize = 100 * 1024
local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
})
end,
}

14
lua/plugins/ui/alpha.lua Normal file
View file

@ -0,0 +1,14 @@
local M = {
"goolord/alpha-nvim",
}
M.config = function()
local startify = require("alpha.themes.startify")
startify.section.bottom_buttons.val = {
startify.button("e", "New file", "<cmd>ene <CR>"),
startify.button("q", "Quit", "<cmd>q <CR>"),
}
require("alpha").setup(startify.config)
end
return M

32
lua/plugins/ui/colors.lua Normal file
View file

@ -0,0 +1,32 @@
local M = {
{
"EdenEast/nightfox.nvim",
enabled = true,
priority = 1000,
config = function()
vim.cmd("colorscheme nightfox")
end,
},
{
"rose-pine/neovim",
name = "rose-pine",
enabled = false,
priority = 1000,
opts = {
variant = "auto",
dark_variant = "main",
groups = {
border = "muted",
panel = "surface",
error = "love",
hint = "iris",
info = "foam",
},
},
config = function()
vim.cmd("colorscheme rose-pine")
end,
},
}
return M

View file

@ -0,0 +1,9 @@
local M = {
"stevearc/dressing.nvim",
}
M.config = function()
require("dressing").setup()
end
return M

11
lua/plugins/ui/init.lua Normal file
View file

@ -0,0 +1,11 @@
local M = {
require("plugins.ui.colors"),
require("plugins.ui.alpha"),
require("plugins.ui.dressing"),
require("plugins.ui.whichkey"),
require("plugins.ui.noice"),
require("plugins.ui.scroll"),
require("plugins.ui.status"),
}
return M

93
lua/plugins/ui/noice.lua Normal file
View file

@ -0,0 +1,93 @@
local M = {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
}
M.config = function()
local noice = require("noice")
noice.setup({
routes = {
{
filter = {
event = "msg_show",
any = {
{ find = "%d+L, %d+B" },
{ find = "; after #%d+" },
{ find = "; before #%d+" },
{ find = "%d fewer lines" },
{ find = "%d more lines" },
},
},
opts = { skip = true },
},
},
lsp = {
progress = { enabled = true },
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
hover = { silent = true },
signature = {
auto_open = { throttle = vim.api.nvim_get_option_value("updatetime", { scope = "global" }) },
},
},
cmdline = {
format = {
cmdline = { icon = "" },
search_down = { icon = " " },
search_up = { icon = " " },
},
},
messages = {
enabled = false,
},
popupmenu = { enabled = true },
presets = {
bottom_search = true,
long_message_to_split = true,
lsp_doc_border = true,
},
throttle = 1000,
views = {
split = {
enter = true,
size = "25%",
win_options = {
signcolumn = "no",
number = false,
relativenumber = false,
list = false,
wrap = false,
},
},
popup = { border = { style = "rounded" } },
hover = {
border = { style = "rounded" },
position = { row = 2, col = 2 },
},
mini = {
timeout = 3000,
position = { row = -2 },
border = { style = "rounded" },
win_options = {
winblend = vim.api.nvim_get_option_value("winblend", { scope = "global" }),
},
},
cmdline_popup = { border = { style = "rounded" } },
confirm = {
border = {
style = "rounded",
padding = { 0, 1 },
},
},
},
})
end
return M

41
lua/plugins/ui/scroll.lua Normal file
View file

@ -0,0 +1,41 @@
local M = {
"karb94/neoscroll.nvim",
}
M.config = function()
require("neoscroll").setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { "<C-u>", "<C-d>" },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers.
})
local neoscroll = require("neoscroll")
local t = {
["<C-u>"] = function()
neoscroll.ctrl_u({ duration = 50 })
end,
["<C-k>"] = function()
neoscroll.ctrl_u({ duration = 50 })
end,
["<C-d>"] = function()
neoscroll.ctrl_d({ duration = 50 })
end,
["<C-j>"] = function()
neoscroll.ctrl_d({ duration = 50 })
end,
}
local modes = { "n", "v", "x" }
for key, func in pairs(t) do
vim.keymap.set(modes, key, func)
end
end
return M

66
lua/plugins/ui/status.lua Normal file
View file

@ -0,0 +1,66 @@
local M = {
"nvim-lualine/lualine.nvim",
}
function M.config()
local lualine = require("lualine")
local mode = "mode"
local filetype = { "filetype", icon_only = true }
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn", "info", "hint" },
symbols = {
error = icons.diagnostics.Error,
hint = icons.diagnostics.Hint,
info = icons.diagnostics.Info,
warn = icons.diagnostics.Warning,
},
colored = true,
update_in_insert = false,
always_visible = false,
}
local diff = {
"diff",
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
symbols = {
added = icons.git.LineAdded .. " ",
modified = icons.git.LineModified .. " ",
removed = icons.git.LineRemoved .. " ",
},
colored = true,
always_visible = false,
}
lualine.setup({
options = {
theme = "auto",
globalstatus = true,
section_separators = "",
component_separators = "",
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
},
sections = {
lualine_a = { mode },
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { diff, diagnostics, filetype },
lualine_y = {},
lualine_z = {},
},
})
end
return M

View file

@ -0,0 +1,25 @@
local M = {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 500
end,
}
M.config = function()
require("which-key").setup({
win = {
border = "single",
},
plugins = {
marks = true,
registers = true,
spelling = {
enabled = false,
},
},
})
end
return M

13
lua/plugins/undo.lua Normal file
View file

@ -0,0 +1,13 @@
local M = {
"mbbill/undotree",
cmd = {
"UndotreeToggle",
},
}
M.config = function()
vim.opt.undodir = vim.fn.expand("~/.config/undodir")
nmap("<leader>u", "<cmd>UndotreeToggle<cr>", { desc = "Toggle undo tree" })
end
return M