feat: updated neovim configuration to match the configuration from nixvim

This commit is contained in:
Ceferino Patino 2025-07-02 19:38:58 -05:00
commit b42b49b525
Signed by: c4patino
SSH key fingerprint: SHA256:9fQ9TsujGrdNNi76mnsu63v7dS5JOmHRZEqBOl49OR8
31 changed files with 1296 additions and 1094 deletions

1
.gitignore vendored
View file

@ -70,4 +70,3 @@ tags
[._]*.un~
# End of https://www.toptal.com/developers/gitignore/api/direnv,vim,lua

1047
init.lua

File diff suppressed because it is too large Load diff

View file

@ -1,44 +1,53 @@
{
"LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" },
"NvChad": { "branch": "v2.5", "commit": "4a2cefa5c17e971b45a5089862d031e2f6f0a8fc" },
"base46": { "branch": "v2.5", "commit": "89cb656606a2f47ae9f814530c961be4cdb6e117" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" },
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
"copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "f074844b60f9e151970fbcdbeb8a2cd52b6ef25a" },
"gv.vim": { "branch": "master", "commit": "b6bb6664e2c95aa584059f195eb3a9f3cb133994" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" },
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
"nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-numbertoggle": { "branch": "main", "commit": "c5827153f8a955886f1b38eaea6998c067d2992f" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-tree.lua": { "branch": "master", "commit": "48d0e82f9434691cc50d970898142a8c084a49d6" },
"nvim-treesitter": { "branch": "master", "commit": "2d5133f67429f82547ea5fad33a0b1e7d4f78a1c" },
"nvim-ufo": { "branch": "main", "commit": "1b5f2838099f283857729e820cc05e2b19df7a2c" },
"nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"promise-async": { "branch": "main", "commit": "28c1d5a295eb5310afa2523d4ae9aa41ec5a9de2" },
"telescope.nvim": { "branch": "master", "commit": "10b8a82b042caf50b78e619d92caf0910211973d" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"ui": { "branch": "v2.5", "commit": "60a18fbc5e152703f3d8e4cbc3224d7c2ba247c0" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
"LuaSnip": { "branch": "master", "commit": "eda5be8f0ce9816278671f0b578cdbb8b762c701" },
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3ee68bc9f65b21a21582a3d80e270c7e4f2992" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "73e0143385d8a2185944b42ed44d728b94ee19a3" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "1c75a797b4017fec6491f509cf196c8c8833f26f" },
"nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" },
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-lspconfig": { "branch": "master", "commit": "d8f03bfd5b54b10352276a0ed1f2ffe9c2e0676f" },
"nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" },
"nvim-numbertoggle": { "branch": "main", "commit": "4b898b84d6f31f76bd563330d76177d5eb299efa" },
"nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" },
"nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rustaceanvim": { "branch": "master", "commit": "322224d00a731d75eed6b700d38e460fd30f6e3c" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"typescript-tools.nvim": { "branch": "master", "commit": "3c501d7c7f79457932a8750a2a1476a004c5c1a9" },
"undotree": { "branch": "master", "commit": "15d91b0afe04ea9ba5cd53e30190d1602af9a925" },
"vimtex": { "branch": "master", "commit": "7f2633027c8f496a85284de0c11aa32f1e07e049" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
}

View file

@ -1,12 +1,12 @@
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
local mkAutocmd = vim.api.nvim_create_autocmd
mkAutocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 50 })
end,
})
-- Set 2-space tabs for specific filetypes
vim.api.nvim_create_autocmd("FileType", {
mkAutocmd("FileType", {
pattern = { "astro", "javascript", "javascriptreact", "nix", "tex", "typescript", "typescriptreact" },
callback = function()
vim.opt_local.tabstop = 2
@ -15,8 +15,7 @@ vim.api.nvim_create_autocmd("FileType", {
end,
})
-- Enable wrap and ZenMode toggle for LaTeX files
vim.api.nvim_create_autocmd("FileType", {
mkAutocmd("FileType", {
pattern = "tex",
callback = function()
vim.opt_local.wrap = true

113
lua/languages/cmp.lua Normal file
View file

@ -0,0 +1,113 @@
return {
"hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local kind_icons = {
Text = "󰊄",
Method = "",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "󱀍",
Class = "",
Interface = "",
Module = "󰕳",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
}),
performance = {
debounce = 60,
fetching_timeout = 200,
max_view_entries = 30,
},
window = {
completion = {
border = "rounded",
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
},
documentation = {
border = "rounded",
},
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(_, vim_item)
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind] or "", vim_item.kind)
return vim_item
end,
},
})
-- `/` and `?` cmdline uses buffer source
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- `:` cmdline uses path and cmdline source
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
-- gitcommit filetype config
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "cmp_git" },
}, {
{ name = "buffer" },
}),
})
end,
}

80
lua/languages/conform.lua Normal file
View file

@ -0,0 +1,80 @@
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
},
},
config = function()
local conform = require("conform")
local notify = require("notify")
conform.setup({
notify_on_error = true,
default_format_opts = {
lsp_format = "fallback",
},
formatters_by_ft = {
astro = { "prettierd", "prettier" },
cabal = { "ormolu" },
haskell = { "ormolu" },
javascript = { "prettierd", "prettier" },
javascriptreact = { "prettierd", "prettier" },
typescript = { "prettierd", "prettier" },
typescriptreact = { "prettierd", "prettier" },
lua = { "stylua" },
nix = { "alejandra" },
racket = { "raco_fmt" },
},
formatters = {
raco_fmt = {
command = "raco",
args = { "fmt" },
},
},
format_on_save = function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { lsp_format = "fallback" }
end,
})
local function show_notification(message, level)
notify(message, level, { title = "conform.nvim" })
end
vim.api.nvim_create_user_command("FormatToggle", function(args)
local is_global = not args.bang
if is_global then
vim.g.disable_autoformat = not vim.g.disable_autoformat
show_notification(
vim.g.disable_autoformat and "Autoformat-on-save disabled globally"
or "Autoformat-on-save enabled globally",
"info"
)
else
vim.b.disable_autoformat = not vim.b.disable_autoformat
show_notification(
vim.b.disable_autoformat and "Autoformat-on-save disabled for this buffer"
or "Autoformat-on-save enabled for this buffer",
"info"
)
end
end, { desc = "Toggle autoformat-on-save", bang = true })
-- Keybindings
vim.keymap.set("n", "<leader>ff", "<cmd>FormatToggle<cr>", {
silent = true,
desc = "Conform Toggle autoformat",
})
vim.keymap.set({ "n", "v" }, "<leader>f", function()
require("conform").format({ lsp_format = "fallback" })
end, { silent = true, desc = "Conform Format" })
end,
}

68
lua/languages/dap.lua Normal file
View file

@ -0,0 +1,68 @@
return {
{
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
-- Signs
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DapBreakpoint" })
vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition" })
vim.fn.sign_define("DapLogPoint", { text = "", texthl = "DapLogPoint" })
-- Keymaps
local map = vim.keymap.set
local function with_opts(desc)
return vim.tbl_extend("force", { silent = true }, { desc = desc })
end
map("n", "<leader>db", ":DapToggleBreakpoint<CR>", with_opts("Toggle Breakpoint"))
map("n", "<leader>dc", "<cmd>DapContinue<CR>", with_opts("Continue"))
map(
"n",
"<leader>da",
"<cmd>lua require('dap').continue({ before = get_args })<CR>",
with_opts("Run with Args")
)
map("n", "<leader>dC", "<cmd>lua require('dap').run_to_cursor()<CR>", with_opts("Run to Cursor"))
map("n", "<leader>dg", "<cmd>lua require('dap').goto_()<CR>", with_opts("Go to Line (no execute)"))
map("n", "<leader>di", ":DapStepInto<CR>", with_opts("Step Into"))
map("n", "<leader>dj", "<cmd>lua require('dap').down()<CR>", with_opts("Down"))
map("n", "<leader>dk", "<cmd>lua require('dap').up()<CR>", with_opts("Up"))
map("n", "<leader>dl", "<cmd>lua require('dap').run_last()<CR>", with_opts("Run Last"))
map("n", "<leader>do", ":DapStepOut<CR>", with_opts("Step Out"))
map("n", "<leader>dO", ":DapStepOver<CR>", with_opts("Step Over"))
map("n", "<leader>dp", "<cmd>lua require('dap').pause()<CR>", with_opts("Pause"))
map("n", "<leader>dr", ":DapToggleRepl<CR>", with_opts("Toggle REPL"))
map("n", "<leader>ds", "<cmd>lua require('dap').session()<CR>", with_opts("Session"))
map("n", "<leader>dt", ":DapTerminate<CR>", with_opts("Terminate"))
map("n", "<leader>du", "<cmd>lua require('dapui').toggle()<CR>", with_opts("Dap UI"))
map({ "n", "v" }, "<leader>de", "<cmd>lua require('dapui').eval()<CR>", with_opts("Eval"))
end,
},
{
"rcarriga/nvim-dap-ui",
dependencies = { "mfussenegger/nvim-dap" },
config = function()
require("dapui").setup({
floating = {
mappings = {
close = { "<ESC>", "q" },
},
},
})
end,
},
{
"theHamsta/nvim-dap-virtual-text",
dependencies = { "mfussenegger/nvim-dap" },
config = true,
},
{
"mfussenegger/nvim-dap-python",
ft = "python",
dependencies = { "mfussenegger/nvim-dap" },
config = function()
require("dap-python").setup("~/.virtualenvs/debugpy/bin/python")
end,
},
}

4
lua/languages/init.lua Normal file
View file

@ -0,0 +1,4 @@
return {
{ "windwp/nvim-autopairs", event = "InsertEnter", opts = {} },
{ "kylechui/nvim-surround", event = "VeryLazy", opts = {} },
}

168
lua/languages/lsp.lua Normal file
View file

@ -0,0 +1,168 @@
return {
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"mason-org/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
config = function()
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
callback = function(event)
-- NOTE: This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
local function client_supports_method(client, method, bufnr)
if vim.fn.has("nvim-0.11") == 1 then
return client:supports_method(method, bufnr)
else
return client.supports_method(method, { bufnr = bufnr })
end
end
local client = vim.lsp.get_client_by_id(event.data.client_id)
if
client
and client_supports_method(
client,
vim.lsp.protocol.Methods.textDocument_documentHighlight,
event.buf
)
then
local highlight_augroup =
vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd("LspDetach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
end,
})
end
end,
})
vim.diagnostic.config({
severity_sort = true,
float = { border = "rounded", source = "if_many" },
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
text = {
[vim.diagnostic.severity.ERROR] = "󰅚 ",
[vim.diagnostic.severity.WARN] = "󰀪 ",
[vim.diagnostic.severity.INFO] = "󰋽 ",
[vim.diagnostic.severity.HINT] = "󰌶 ",
},
} or {},
virtual_text = {
source = "if_many",
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,
},
})
local border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
require("lspconfig.ui.windows").default_options = {
border = border,
}
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.offsetEncoding = { "utf-16" }
local servers = {
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
},
},
},
},
pylsp = {
settings = {
configurationSources = { "pycodestyle" },
plugins = {
pyflakes = { enabled = true },
mccabe = { enabled = true },
pycodestyle = { enabled = true },
pydocstyle = { enabled = true },
yapf = { enabled = true },
},
},
},
astro = {},
clangd = {},
csharp_ls = {},
gopls = {},
hls = { settings = { haskell = { formattingProvider = "ormolu" } } },
java_language_server = {},
nixd = {},
sqls = {},
zls = {},
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
require("mason-lspconfig").setup({
ensure_installed = {},
automatic_installation = false,
handlers = {
function(server_name)
local server = servers[server_name] or {}
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
require("lspconfig")[server_name].setup(server)
end,
},
})
end,
},
{
"mrcjkb/rustaceanvim",
version = "^6",
ft = { "rust" },
config = function()
vim.g.rustaceanvim = {
tools = {
autoSetHints = true,
hover_with_actions = true,
},
}
end,
},
{
"pmizio/typescript-tools.nvim",
ft = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
opts = {
separate_diagnostic_server = true,
expose_as_code_action = "all",
},
},
}

12
lua/languages/lspkind.lua Normal file
View file

@ -0,0 +1,12 @@
return {
{
"onsails/lspkind.nvim",
lazy = true,
config = function()
require("lspkind").init({
maxwidth = 50,
ellipsis_char = "...",
})
end,
},
}

83
lua/languages/lspsaga.lua Normal file
View file

@ -0,0 +1,83 @@
return {
{
"nvimdev/lspsaga.nvim",
event = "LspAttach",
config = function()
require("lspsaga").setup({
beacon = { enable = true },
ui = {
border = "rounded",
code_action = "💡",
},
hover = {
open_cmd = "!floorp",
open_link = "gx",
},
diagnostic = {
border_follow = true,
diagnostic_only_current = false,
show_code_action = true,
},
symbol_in_winbar = {
enable = true,
},
code_action = {
extend_gitsigns = false,
show_server_name = true,
only_in_cursor = true,
num_shortcut = true,
keys = {
exec = "<CR>",
quit = { "<Esc>", "q" },
},
},
lightbulb = {
enable = false,
sign = false,
virtual_text = true,
},
implement = {
enable = false,
},
rename = {
auto_save = false,
keys = {
exec = "<CR>",
quit = { "<C-k>", "<Esc>" },
select = "x",
},
},
outline = {
auto_close = true,
auto_preview = true,
close_after_jump = true,
layout = "normal",
win_position = "right",
keys = {
jump = "e",
quit = "q",
toggle_or_jump = "o",
},
},
scroll_preview = {
scroll_down = "<C-f>",
scroll_up = "<C-b>",
},
})
local keymap = vim.keymap.set
local function with_opts(desc)
return vim.tbl_extend("force", { silent = true }, { desc = desc })
end
keymap("n", "gd", "<cmd>Lspsaga finder def<CR>", with_opts("Goto Definition"))
keymap("n", "gr", "<cmd>Lspsaga finder ref<CR>", with_opts("Goto References"))
keymap("n", "gI", "<cmd>Lspsaga finder imp<CR>", with_opts("Goto Implementation"))
keymap("n", "gT", "<cmd>Lspsaga peek_type_definition<CR>", with_opts("Type Definition"))
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>", with_opts("Hover"))
keymap("n", "<leader>cw", "<cmd>Lspsaga outline<CR>", with_opts("Outline"))
keymap("n", "<leader>cr", "<cmd>Lspsaga rename<CR>", with_opts("Rename"))
keymap("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", with_opts("Code Action"))
end,
},
}

View file

@ -0,0 +1,4 @@
return {
"L3MON4D3/LuaSnip",
event = "InsertEnter",
}

View file

@ -0,0 +1,14 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
},
})
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
end,
}

View file

@ -0,0 +1,64 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
lazy = false,
keys = {
{
"<leader>a",
function()
require("harpoon"):list():add()
end,
desc = "Harpoon Add File",
},
{
"<C-e>",
function()
require("harpoon").ui:toggle_quick_menu(require("harpoon"):list())
end,
desc = "Harpoon Toggle Quick Menu",
},
{
"<C-j>",
function()
require("harpoon"):list():select(1)
end,
desc = "Harpoon to File 1",
},
{
"<C-k>",
function()
require("harpoon"):list():select(2)
end,
desc = "Harpoon to File 2",
},
{
"<C-l>",
function()
require("harpoon"):list():select(3)
end,
desc = "Harpoon to File 3",
},
{
"<C-;>",
function()
require("harpoon"):list():select(4)
end,
desc = "Harpoon to File 4",
},
},
config = function()
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
},
})
if require("lazy.core.config").plugins["telescope.nvim"] then
local telescope = require("telescope")
telescope.load_extension("harpoon")
end
end,
}

View file

@ -0,0 +1,80 @@
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
keys = {
{ "<leader>pv", "<cmd>NvimTreeToggle<cr>", desc = "Toggle NvimTree" },
},
config = function()
require("nvim-web-devicons").setup({})
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = true,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
},
sort_by = "case_sensitive",
filters = {
custom = { "__pycache__" },
exclude = {},
},
git = {
enable = true,
ignore = true,
},
view = {
side = "right",
width = 60,
number = true,
relativenumber = true,
preserve_window_proportions = true,
},
renderer = {
root_folder_label = false,
indent_width = 2,
highlight_git = true,
indent_markers = {
enable = true,
},
icons = {
glyphs = {
default = "󰈚",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
})
end,
}

View file

@ -0,0 +1,102 @@
return {
"nvim-telescope/telescope.nvim",
event = "VimEnter",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
{ "nvim-telescope/telescope-ui-select.nvim" },
},
keys = {
{
"<leader>pws",
function()
local word = vim.fn.expand("<cword>")
require("telescope.builtin").grep_string({ search = word })
end,
desc = "Telescope Live grep word under cursor",
},
{
"<leader>pWs",
function()
local word = vim.fn.expand("<cWORD>")
require("telescope.builtin").grep_string({ search = word })
end,
desc = "Telescope Live grep WORD under cursor",
},
{
"<leader>pf",
"<cmd>Telescope find_files<cr>",
desc = "Telescope Find project files",
},
{
"<leader>pa",
"<cmd>Telescope find_files follow=true no_ignore=true hidden=true<cr>",
desc = "Telescope Find all files",
},
{
"<leader>pz",
"<cmd>Telescope current_buffer_fuzzy_find<cr>",
desc = "Telescope Find in buffer",
},
{
"<leader>ps",
"<cmd>Telescope live_grep<cr>",
desc = "Telescope Live grep",
},
{
"ws",
"<cmd>Telescope lsp_document_symbols ignore_symbols='variable'<cr>",
desc = "Telescope LSP Document symbols",
},
{
"<leader>tt",
"<cmd>Telescope diagnostics<cr>",
desc = "Telescope Diagnostics",
},
{
"<leader>tf",
"<cmd>Telescope diagnostics bufnr=0<cr>",
desc = "Telescope Diagnostics in buffer",
},
{
"<leader>:",
"<cmd>Telescope command_history<cr>",
desc = "Telescope Command history",
},
},
config = function()
local telescope = require("telescope")
telescope.setup({
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
sorting_strategy = "ascending",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.65,
},
width = 0.75,
height = 0.80,
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
-- Load extensions
pcall(telescope.load_extension("fzf"))
pcall(telescope.load_extension("ui-select"))
end,
}

32
lua/plugins.lua Normal file
View file

@ -0,0 +1,32 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "languages" },
{ import = "navigation" },
{ import = "ui" },
{ import = "utils" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "tokyonight" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

81
lua/ui/alpha.lua Normal file
View file

@ -0,0 +1,81 @@
local function mkPadding(val)
return { type = "padding", val = val }
end
local function mkButton(label, shortcut, command)
return {
type = "button",
val = label,
on_press = function()
local key = vim.api.nvim_replace_termcodes(shortcut, true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end,
opts = {
keymap = {
"n",
shortcut,
command,
{
noremap = true,
silent = true,
nowait = true,
},
},
shortcut = shortcut,
position = "center",
cursor = 3,
width = 38,
align_shortcut = "right",
hl_shortcut = "Keyword",
},
}
end
return {
"goolord/alpha-nvim",
dependencies = { "nvim-lua/plenary.nvim" },
event = "VimEnter",
config = function()
local layout = {
mkPadding(4),
{
opts = {
hl = "AlphaHeader",
position = "center",
},
type = "text",
val = {
[[▓██ ██▓ █ ██ ███▄ ▄███▓▓█████ ██▒ █▓ ██▓ ███▄ ▄███▓]],
[[ ▒██ ██▒ ██ ▓██▒▓██▒▀█▀ ██▒▓█ ▀▓██░ █▒▓██▒▓██▒▀█▀ ██▒]],
[[ ▒██ ██░▓██ ▒██░▓██ ▓██░▒███ ▓██ █▒░▒██▒▓██ ▓██░]],
[[ ░ ▐██▓░▓▓█ ░██░▒██ ▒██ ▒▓█ ▄ ▒██ █░░░██░▒██ ▒██ ]],
[[ ░ ██▒▓░▒▒█████▓ ▒██▒ ░██▒░▒████▒ ▒▀█░ ░██░▒██▒ ░██▒]],
[[ ██▒▒▒ ░▒▓▒ ▒ ▒ ░ ▒░ ░ ░░░ ▒░ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░]],
[[ ▓██ ░▒░ ░░▒░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ░]],
[[ ▒ ▒ ░░ ░░░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ]],
[[ ░ ░ ░ ░ ░ ░ ░ ░ ░ ]],
[[ ]],
[[ git@github.com:c4patino ]],
},
},
mkPadding(2),
mkButton(" Find File", "f", ":Telescope find_files<CR>"),
mkPadding(1),
mkButton(" New File", "n", ":ene <BAR> startinsert<CR>"),
mkPadding(1),
mkButton("󰈚 Recent Files", "r", ":Telescope oldfiles<CR>"),
mkPadding(1),
mkButton("󰈭 Find Word", "g", ":Telescope live_grep<CR>"),
mkPadding(1),
mkButton(" Restore Session", "s", ":lua require('persistence').load()<CR>"),
mkPadding(1),
mkButton(" Quit Neovim", "q", ":qa<CR>"),
}
require("alpha").setup({
layout = layout,
})
end,
}

89
lua/ui/fidget.lua Normal file
View file

@ -0,0 +1,89 @@
return {
"j-hui/fidget.nvim",
event = "VeryLazy",
config = function()
require("fidget").setup({
logger = {
level = vim.log.levels.WARN, -- "off", "error", "warn", "info", "debug", "trace"
float_precision = 0.01,
},
progress = {
poll_rate = 0,
suppress_on_insert = true,
ignore_done_already = false,
ignore_empty_message = false,
clear_on_detach = function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end,
notification_group = function(msg)
return msg.lsp_client.name
end,
ignore = {},
lsp = {
progress_ringbuf_size = 0,
},
display = {
render_limit = 16,
done_ttl = 3,
done_icon = "",
done_style = "Constant",
progress_ttl = math.huge,
progress_icon = {
pattern = "dots",
period = 1,
},
progress_style = "WarningMsg",
group_style = "Title",
icon_style = "Question",
priority = 30,
skip_history = true,
format_message = require("fidget.progress.display").default_format_message,
format_annote = function(msg)
return msg.title
end,
format_group_name = function(group)
return tostring(group)
end,
overrides = {
rust_analyzer = {
name = "rust-analyzer",
},
},
},
},
notification = {
poll_rate = 10,
filter = "info",
history_size = 128,
override_vim_notify = true,
redirect = function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end,
configs = {
default = require("fidget.notification").default_config,
},
window = {
normal_hl = "Comment",
winblend = 0,
border = "none",
zindex = 45,
max_width = 0,
max_height = 0,
x_padding = 1,
y_padding = 0,
align = "bottom",
relative = "editor",
},
view = {
stack_upwards = true,
icon_separator = " ",
group_separator = "---",
group_separator_hl = "Comment",
},
},
})
end,
}

View file

@ -0,0 +1,8 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = "BufReadPost",
opts = {
scope = { enabled = false },
},
}

35
lua/ui/init.lua Normal file
View file

@ -0,0 +1,35 @@
return {
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
config = function()
vim.cmd([[colorscheme tokyonight-night]])
end,
},
{
"stevearc/dressing.nvim",
event = "VeryLazy",
config = function()
require("dressing").setup()
end,
},
{
"sitiom/nvim-numbertoggle",
event = "BufEnter",
},
{
"norcalli/nvim-colorizer.lua",
event = "BufReadPost",
config = function()
require("colorizer").setup()
end,
},
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = function()
require("gitsigns").setup()
end,
},
}

36
lua/ui/lualine.lua Normal file
View file

@ -0,0 +1,36 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = "VeryLazy",
config = function()
require("lualine").setup({
options = {
globalstatus = true,
always_divide_middle = true,
theme = "auto",
ignore_focus = { "nvim-tree" },
component_separators = {
left = "|",
right = "|",
},
},
extensions = { "fzf" },
sections = {
lualine_a = { "mode" },
lualine_b = {
{ "branch", icon = "", icons_enabled = true },
{ "diff" },
{ "diagnostics" },
},
lualine_c = { "filename" },
lualine_x = { "filetype" },
lualine_y = { "location" },
lualine_z = {
function()
return "" .. os.date("%R")
end,
},
},
})
end,
}

48
lua/ui/noice.lua Normal file
View file

@ -0,0 +1,48 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
opts = {
notify = {
enabled = false,
},
messages = {
enabled = true,
},
lsp = {
message = {
enabled = true,
},
progress = {
enabled = false,
view = "mini",
},
},
popupmenu = {
enabled = true,
backend = "nui",
},
format = {
filter = {
pattern = { ":%s*%%s*s:%s*", ":%s*%%s*s!%s*", ":%s*%%s*s/%s*", "%s*s:%s*", ":%s*s!%s*", ":%s*s/%s*" },
icon = "",
lang = "regex",
},
replace = {
pattern = {
":%s*%%s*s:%w*:%s*",
":%s*%%s*s!%w*!%s*",
":%s*%%s*s/%w*/%s*",
"%s*s:%w*:%s*",
":%s*s!%w*!%s*",
":%s*s/%w*/%s*",
},
icon = "󱞪",
lang = "regex",
},
},
},
}

45
lua/ui/nvim-notify.lua Normal file
View file

@ -0,0 +1,45 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
keys = {
{
"<leader>un",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Dismiss All Notifications",
},
},
config = function()
local notify = require("notify")
notify.setup({
background_color = "#000000",
fps = 60,
render = "default",
timeout = 500,
top_down = false,
})
-- Filter out noisy or redundant messages
local filtered_message = { "No information available" }
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(message, level, opts)
for _, msg in ipairs(filtered_message) do
if message == msg then
return
end
end
local merged_opts = vim.tbl_extend("force", {
on_open = function(win)
local buf = vim.api.nvim_win_get_buf(win)
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
end,
}, opts or {})
return notify(message, level, merged_opts)
end
end,
}

10
lua/utils/init.lua Normal file
View file

@ -0,0 +1,10 @@
return {
{
"folke/persistence.nvim",
lazy = false,
config = function()
require("persistence").setup()
end,
},
{ "folke/which-key.nvim", event = "VeryLazy" },
}

8
lua/utils/lazygit.lua Normal file
View file

@ -0,0 +1,8 @@
return {
{
"kdheepak/lazygit.nvim",
keys = {
{ "<leader>gg", "<cmd>LazyGit<CR>", desc = "LazyGit Toggle window" },
},
},
}

View file

@ -0,0 +1,7 @@
return {
"folke/todo-comments.nvim",
event = "VeryLazy",
keys = {
{ "<leader>tc", "<cmd>TodoTelescope<cr>", desc = "Telescope Find todo comments" },
},
}

16
lua/utils/toggleterm.lua Normal file
View file

@ -0,0 +1,16 @@
return {
"akinsho/toggleterm.nvim",
keys = {
{ "<A-i>", "<cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
},
opts = {
open_mapping = "<A-i>",
direction = "float",
float_opts = {
border = "curved",
},
winbar = {
enabled = true,
},
},
}

11
lua/utils/undotree.lua Normal file
View file

@ -0,0 +1,11 @@
return {
"mbbill/undotree",
keys = {
{ "<leader>u", "<cmd>UndotreeToggle<cr>", desc = "Undotree Toggle window" },
},
config = function()
vim.g.undotree_WindowLayout = 4
vim.g.undotree_DiffpaneHeight = 15
vim.g.undotree_SplitWidth = 40
end,
}

7
lua/utils/vimtex.lua Normal file
View file

@ -0,0 +1,7 @@
return {
"lervag/vimtex",
ft = { "tex", "latex" },
config = function()
vim.g.vimtex_view_method = "zathura"
end,
}

13
lua/utils/zenmode.lua Normal file
View file

@ -0,0 +1,13 @@
return {
"folke/zen-mode.nvim",
keys = {
{ "<leader>zz", "<cmd>ZenMode<cr>", desc = "Toggle Zen Mode" },
},
config = function()
require("zen-mode").setup({
window = {
width = 150,
},
})
end,
}