From c9354ef576c841603bb88d2702d7f8c8f87b8c58 Mon Sep 17 00:00:00 2001 From: CelticBoozer Date: Sun, 13 Apr 2025 23:35:00 +0300 Subject: [PATCH] Huge commit with full rework. --- README.md | 2 + init.lua | 15 +- lazy-lock.json | 70 +++++--- lua/core/options.lua | 9 +- lua/plugin/editor/autopairs.lua | 20 ++- lua/plugin/editor/autotag.lua | 20 ++- lua/plugin/editor/cmp-dotenv.lua | 8 + lua/plugin/editor/cmp.lua | 83 +++++----- lua/plugin/editor/comment.lua | 34 ++-- lua/plugin/editor/indent-blankline.lua | 4 +- lua/plugin/editor/rainbow-delimiters.lua | 5 +- lua/plugin/editor/reactive.lua | 97 ++++++++++- .../editor/tiny-devicons-auto-colors.lua | 36 ++--- lua/plugin/editor/todo-comments.lua | 41 ++++- lua/plugin/editor/treesitter.lua | 52 +++--- lua/plugin/editor/ufo.lua | 63 +++++--- lua/plugin/lazy.lua | 6 +- lua/plugin/lsp/conform.lua | 23 ++- lua/plugin/lsp/dap-ui.lua | 77 +++++++++ lua/plugin/lsp/dap.lua | 150 ++++++++++++++++++ lua/plugin/lsp/fidget.lua | 24 --- lua/plugin/lsp/garbage-day.lua | 9 ++ lua/plugin/lsp/inc-rename.lua | 28 +++- lua/plugin/lsp/lint.lua | 39 +++-- lua/plugin/lsp/lsp-progress.lua | 6 - lua/plugin/lsp/lsp_signature.lua | 16 +- lua/plugin/lsp/lspconfig.lua | 53 ++++--- lua/plugin/lsp/lspsaga.lua | 48 ++++-- lua/plugin/lsp/mason.lua | 63 ++++---- lua/plugin/lsp/neotest.lua | 37 +++++ lua/plugin/lsp/nvim-jdtls.lua | 30 ---- lua/plugin/lsp/tiny-inline-diagnostic.lua | 15 ++ lua/plugin/theme/bufferline.lua | 8 +- lua/plugin/theme/colorizer.lua | 24 ++- lua/plugin/theme/colorscheme.lua | 44 ++--- lua/plugin/theme/dressing.lua | 14 ++ lua/plugin/theme/lualine.lua | 79 ++++----- lua/plugin/theme/statuscol.lua | 48 +++--- lua/plugin/util/code_runner.lua | 34 ++++ lua/plugin/util/dashboard.lua | 109 +++++++------ lua/plugin/util/decisive.lua | 44 +++++ lua/plugin/util/fine-cmd-line.lua | 14 +- lua/plugin/util/neo-tree.lua | 59 ------- lua/plugin/util/neogit.lua | 83 ++++++++++ lua/plugin/util/notify.lua | 38 +++++ lua/plugin/util/nvim-tree.lua | 81 ++++++++++ lua/plugin/util/peek.lua | 10 -- lua/plugin/util/render-markdown.lua | 24 +++ lua/plugin/util/search.lua | 61 +++++++ lua/plugin/util/sqls.lua | 18 +++ lua/plugin/util/surround.lua | 9 ++ lua/plugin/util/telescope.lua | 56 ++++--- lua/plugin/util/which-key.lua | 40 +++-- 53 files changed, 1512 insertions(+), 568 deletions(-) create mode 100644 lua/plugin/editor/cmp-dotenv.lua create mode 100644 lua/plugin/lsp/dap-ui.lua create mode 100644 lua/plugin/lsp/dap.lua delete mode 100644 lua/plugin/lsp/fidget.lua create mode 100644 lua/plugin/lsp/garbage-day.lua delete mode 100644 lua/plugin/lsp/lsp-progress.lua create mode 100644 lua/plugin/lsp/neotest.lua delete mode 100644 lua/plugin/lsp/nvim-jdtls.lua create mode 100644 lua/plugin/lsp/tiny-inline-diagnostic.lua create mode 100644 lua/plugin/theme/dressing.lua create mode 100644 lua/plugin/util/code_runner.lua create mode 100644 lua/plugin/util/decisive.lua delete mode 100644 lua/plugin/util/neo-tree.lua create mode 100644 lua/plugin/util/neogit.lua create mode 100644 lua/plugin/util/notify.lua create mode 100644 lua/plugin/util/nvim-tree.lua delete mode 100644 lua/plugin/util/peek.lua create mode 100644 lua/plugin/util/render-markdown.lua create mode 100644 lua/plugin/util/search.lua create mode 100644 lua/plugin/util/sqls.lua create mode 100644 lua/plugin/util/surround.lua diff --git a/README.md b/README.md index 3744273..cba36e1 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,5 @@ Nerd fonts - lazy, whichkey python3 deno rg - lspsaga, + +ueberzug (for media previews), docker-cli diff --git a/init.lua b/init.lua index 88ba3bf..56f257b 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,17 @@ +-- init.lua require("core.options") + +-- Bootstrap and setup lazy.nvim through its own plugin spec require("plugin.lazy") -require("telescope").load_extension("media_files") +-- Safe telescope extension loading +vim.api.nvim_create_autocmd("User", { + pattern = "LazyDone", + callback = function() + pcall(function() + require("telescope").load_extension("media_files") + require("telescope").load_extension("docker") + require("telescope").load_extension("undo") + end) + end, +}) diff --git a/lazy-lock.json b/lazy-lock.json index 62e9674..6c8e0f7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,56 +1,74 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-dotenv": { "branch": "main", "commit": "4dd53aab60982f1f75848aec5e6214986263325e" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" }, + "code_runner.nvim": { "branch": "main", "commit": "ca64b5bb70730fca03c57d8edee6623863f3fbcb" }, + "conform.nvim": { "branch": "master", "commit": "eebc724d12c5579d733d1f801386e0ceb909d001" }, "dashboard-nvim": { "branch": "master", "commit": "000448d837f6e7a47f8f342f29526c4d7e49e9ce" }, + "decisive.nvim": { "branch": "main", "commit": "ead9188df6411a52d8859552b8332cb864d22171" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "fine-cmdline.nvim": { "branch": "main", "commit": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e" }, + "garbage-day.nvim": { "branch": "main", "commit": "750ef08ae6031ee3683014c5349144340c08ead6" }, "gruvbox-material": { "branch": "master", "commit": "146f40fd42cbef30fed69b4ef51329aeeaceb909" }, - "image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" }, - "inc-rename.nvim": { "branch": "main", "commit": "f9b9e5b9a75074810f40881b7e254b5bbeaf122e" }, - "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, + "inc-rename.nvim": { "branch": "main", "commit": "87ebe7bee0b83d3b6e4f1494c74abed21b318175" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" }, - "lsp_signature.nvim": { "branch": "master", "commit": "02629e5bc38f6cb1a49bb43ff4a441f23335a933" }, + "lsp_signature.nvim": { "branch": "master", "commit": "15bb33cdb47e85278e168cad11acb1b6fa9c6488" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, - "lspsaga.nvim": { "branch": "main", "commit": "6063935cf68de9aa6dd79f8e1caf5df0a9385de3" }, - "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, + "lspsaga.nvim": { "branch": "main", "commit": "778d56ff9b387dacd14ae648ed5604394b486f51" }, + "lualine.nvim": { "branch": "master", "commit": "86fe39534b7da729a1ac56c0466e76f2c663dc42" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "5639d58a3d11ff7c05c8e31e159bfedae55d7961" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" }, - "neo-tree.nvim": { "branch": "main", "commit": "40dd57777a96d0728f6758874b141f409466e2da" }, + "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, + "neogit": { "branch": "master", "commit": "97f83f1dc51dee41e08e3c7a8adf00e1083e3178" }, + "neotest": { "branch": "master", "commit": "747775fc22dfeb6102bdde6559ccb5126dac0ff8" }, + "neotest-bash": { "branch": "main", "commit": "57eab5b80a5296dc3fc5b22112b3ed78da3a5732" }, + "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, + "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, + "neotest-rust": { "branch": "main", "commit": "e1cb22ecf0341fb894ef2ebde344389fe6e6fc8e" }, "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, - "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, - "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-jdtls": { "branch": "master", "commit": "2f7bff9b8d2ee1918b36ca55f19547d9d335a268" }, - "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, - "nvim-lspconfig": { "branch": "master", "commit": "fd26f8626c03b424f7140d454031d1dcb8d23513" }, - "nvim-treesitter": { "branch": "master", "commit": "59573f96164ab3725a2358fe8ffe69e8291d9549" }, + "nvim-dap": { "branch": "master", "commit": "7aade9e99bef5f0735cf966e715b3ce45515d786" }, + "nvim-dap-ui": { "branch": "master", "commit": "7c9207dcc2dfb52d3c3435f02a59948f5076eb9e" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, + "nvim-lint": { "branch": "master", "commit": "5b1bdf306bd3e565908145279e8bbfc594dac3b3" }, + "nvim-lspconfig": { "branch": "master", "commit": "f9b6a702b7430aff0770c04771f2dba78163d2c6" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, + "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, + "nvim-tree.lua": { "branch": "master", "commit": "5bea2b37523a31288e0fcab42f3be5c1bd4516bb" }, + "nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-ufo": { "branch": "main", "commit": "a52c92c3bbaa10f0c9b547a50adaa8c7d8b29f94" }, - "nvim-web-devicons": { "branch": "master", "commit": "ab4cfee554e501f497bce0856788d43cf2eb93d7" }, - "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, + "nvim-ufo": { "branch": "main", "commit": "a026364df62e88037b26d37c9f14c17c006fd577" }, + "nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "c2255b20bb1accb0e83e70f995adf99b78dee13d" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "351e449683070a2bb946bbd603555faf5a195e9a" }, "reactive.nvim": { "branch": "master", "commit": "e0a22a42811ca1e7aa7531f931c55619aad68b5d" }, + "render-markdown.nvim": { "branch": "main", "commit": "8bb0d4725cc4909a603158d44ff28b6158ad9278" }, + "search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" }, + "sqls.nvim": { "branch": "main", "commit": "d1bc5421ef3e8edc5101e37edbb7de6639207a09" }, "statuscol.nvim": { "branch": "main", "commit": "c399884e8f64019ec9bb581251f9710915b7f996" }, "telescope-docker.nvim": { "branch": "main", "commit": "4219840291d9e3e64f6b8eefa11e8deb14357581" }, "telescope-media-files.nvim": { "branch": "master", "commit": "0826c7a730bc4d36068f7c85cf4c5b3fd9fb570a" }, "telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" }, - "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "842983e91e0b8825f1084b8323c7806c8bf64c74" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/core/options.lua b/lua/core/options.lua index a86fef7..e488490 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -43,15 +43,8 @@ o.mousemoveevent = true o.termguicolors = true o.background = "dark" --- UFO folding -vim.o.foldcolumn = "1" -- '0' is not bad -vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value -vim.o.foldlevelstart = 99 -vim.o.foldenable = true -vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] - vim.diagnostic.config({ severity_sort = true, -- Sort all diagnostics by severity -- Optional: Reverse sort order (highest first is default) - severity_sort = { reverse = false } + severity_sort = { reverse = false }, }) diff --git a/lua/plugin/editor/autopairs.lua b/lua/plugin/editor/autopairs.lua index 4ff76bf..2f22718 100644 --- a/lua/plugin/editor/autopairs.lua +++ b/lua/plugin/editor/autopairs.lua @@ -1,10 +1,18 @@ --- INFO: pair {}/[]/() +-- INFO: Automatic bracket/parenthesis completion +-- NOTE: Smart pair management with LSP/cmp integration + return { "windwp/nvim-autopairs", - lazy = false, - event = { "InsertEnter" }, - dependencies = { - "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { "hrsh7th/nvim-cmp" }, + opts = { + check_ts = true, -- Use treesitter to check pairs + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + ignored_next_char = "[%w%.]", -- Don't pair if next char is alphanumeric or dot + fast_wrap = { + map = "", -- Alt+e to jump between pairs + offset = -1, -- Offset from pair start + }, + map_cr = false, -- Disable Enter key pairing }, - opts = {}, } diff --git a/lua/plugin/editor/autotag.lua b/lua/plugin/editor/autotag.lua index fa8814c..3fcbebf 100644 --- a/lua/plugin/editor/autotag.lua +++ b/lua/plugin/editor/autotag.lua @@ -1,6 +1,20 @@ --- INFO: autoclose and autorename html tag +-- INFO: Automatic HTML tag closure and renaming +-- NOTE: Works with JSX/TSX/XML and other markup languages + return { "windwp/nvim-ts-autotag", - lazy = false, - opts = {}, + event = "VeryLazy", + opts = { + filetypes = { + "html", + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + "svelte", + "vue", + "xml", + "markdown", + }, + }, } diff --git a/lua/plugin/editor/cmp-dotenv.lua b/lua/plugin/editor/cmp-dotenv.lua new file mode 100644 index 0000000..22ce6b9 --- /dev/null +++ b/lua/plugin/editor/cmp-dotenv.lua @@ -0,0 +1,8 @@ +-- INFO: .env file completions +-- NOTE: Provides environment variable suggestions for .env files + +return { + "SergioRibera/cmp-dotenv", + dependencies = { "hrsh7th/nvim-cmp" }, + config = function() end, +} diff --git a/lua/plugin/editor/cmp.lua b/lua/plugin/editor/cmp.lua index b6c8c3a..bb89a9a 100644 --- a/lua/plugin/editor/cmp.lua +++ b/lua/plugin/editor/cmp.lua @@ -1,64 +1,63 @@ --- INFO: completion engine +-- INFO: .env file completions +-- NOTE: Provides environment variable suggestions for .env files + return { "hrsh7th/nvim-cmp", - lazy = true, - event = { "InsertEnter" }, + event = "InsertEnter", dependencies = { - "neovim/nvim-lspconfig", -- LSP server support - "hrsh7th/cmp-nvim-lsp", -- LSP support for completion - "hrsh7th/cmp-buffer", -- nvim-cmp source for buffer words - "hrsh7th/cmp-path", -- nvim-cmp source for filesystem paths - "hrsh7th/cmp-cmdline", -- nvim-cmp source for vim's cmdline - "L3MON4D3/LuaSnip", -- Snippet support - "saadparwaiz1/cmp_luasnip", -- Snippet support - "onsails/lspkind.nvim", -- Plugin adds vscode-like pictograms to neovim built-in lsp + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind.nvim", + "windwp/nvim-autopairs", + "SergioRibera/cmp-dotenv", -- add dotenv plugin as dependency }, config = function() local cmp = require("cmp") - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + require("nvim-autopairs").setup() + cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done()) cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ + mapping = { + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i", "s" }), - }), - sources = cmp.config.sources({ + }, + sources = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "buffer" }, - { name = "nvim_lsp_signature_help" }, - }), + -- You can comment out the global dotenv source if you want it only in .env files: + { name = "dotenv" }, + }, formatting = { format = require("lspkind").cmp_format({ maxwidth = 50, ellipsis_char = "...", }), }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + experimental = { + ghost_text = { + hl_group = "Comment", + }, + }, }) + + -- Optional: if you want dotenv completions only for .env files, you can remove it from the + -- global sources list above and add it here: + -- + -- cmp.setup.filetype("env", { + -- sources = { + -- { name = "dotenv" }, + -- }, + -- }) end, } diff --git a/lua/plugin/editor/comment.lua b/lua/plugin/editor/comment.lua index aba4549..05783d0 100644 --- a/lua/plugin/editor/comment.lua +++ b/lua/plugin/editor/comment.lua @@ -1,18 +1,34 @@ --- INFO: comment/uncomment strings +-- INFO: Smart comment toggling with context awareness +-- NOTE: Supports language-specific comment styles + return { "numToStr/Comment.nvim", - lazy = true, - event = { "BufReadPre", "BufNewFile" }, + event = "VeryLazy", dependencies = { - "nvim-treesitter/nvim-treesitter", -- For calculating commentstring - "JoosepAlviste/nvim-ts-context-commentstring", -- Context commenting for example, Vue have many different sections + "nvim-treesitter/nvim-treesitter", + "JoosepAlviste/nvim-ts-context-commentstring", }, config = function() - local comment = require("Comment") - local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + -- First ensure treesitter is initialized + require("nvim-treesitter.configs").setup({}) + + -- Then setup context commentstring + require("ts_context_commentstring").setup({}) - comment.setup({ - pre_hook = ts_context_commentstring.create_pre_hook(), + -- Finally configure Comment.nvim + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + toggler = { + line = "cc", + block = "bc", + }, + opleader = { + line = "c", + block = "b", + }, + extra = { + eol = "cA", + }, }) end, } diff --git a/lua/plugin/editor/indent-blankline.lua b/lua/plugin/editor/indent-blankline.lua index f67bab7..6b6d0d7 100644 --- a/lua/plugin/editor/indent-blankline.lua +++ b/lua/plugin/editor/indent-blankline.lua @@ -1,4 +1,6 @@ --- INFO: indentation guides +-- INFO: Visual indentation guides (v3+) +-- NOTE: Modern indentation visualization with treesitter + return { "lukas-reineke/indent-blankline.nvim", lazy = true, diff --git a/lua/plugin/editor/rainbow-delimiters.lua b/lua/plugin/editor/rainbow-delimiters.lua index e93c62d..710daa6 100644 --- a/lua/plugin/editor/rainbow-delimiters.lua +++ b/lua/plugin/editor/rainbow-delimiters.lua @@ -1,7 +1,8 @@ --- INFO: colorize bracket, tags and other delimiters +-- INFO: Syntax-aware delimiter highlighting +-- NOTE: Context-aware bracket/quote colorization return { "hiphish/rainbow-delimiters.nvim", - lazy = false, + event = "VeryLazy", dependencies = { "nvim-treesitter/nvim-treesitter", }, diff --git a/lua/plugin/editor/reactive.lua b/lua/plugin/editor/reactive.lua index 306a501..05c155e 100644 --- a/lua/plugin/editor/reactive.lua +++ b/lua/plugin/editor/reactive.lua @@ -1,10 +1,93 @@ +-- INFO: Reactive UI highlighting +-- NOTE: Dynamic highlights based on context and mode + return { "rasulomaroff/reactive.nvim", - opts = { - builtin = { - cursorline = true, - cursor = true, - modemsg = true, - }, - }, + opts = function() + local mypreset = { + name = "mypreset", + init = function() + vim.opt.cursorline = true + vim.opt.termguicolors = true + end, + static = { + winhl = { + inactive = { + CursorLine = { bg = "#46413e" }, + CursorLineNr = { fg = "#d4be98", bg = "#46413e" }, + }, + }, + }, + modes = { + -- this does not work when whichkey is enabled + no = { + operators = { + [{ "gu", "gU", "g~", "~" }] = { + winhl = { + CursorLine = { bg = "#334155" }, + CursorLineNr = { fg = "#cbd5e1", bg = "#334155" }, + }, + }, + c = { + winhl = { + CursorLine = { bg = "#424a3e" }, + CursorLineNr = { fg = "#d4be98", bg = "#424a3e" }, + }, + }, + d = { + winhl = { + CursorLine = { bg = "#472322" }, + CursorLineNr = { fg = "#d4be98", bg = "#472322" }, + }, + }, + y = { + winhl = { + CursorLine = { bg = "#574833" }, + CursorLineNr = { fg = "#d4be98", bg = "#574833" }, + }, + }, + }, + }, + + i = { + winhl = { + CursorLine = { bg = "#5b534d" }, + CursorLineNr = { fg = "#d4be98", bg = "#5b534d" }, + }, + }, + n = { + winhl = { + CursorLine = { bg = "#404946" }, + CursorLineNr = { fg = "#d4be98", bg = "#404946" }, + }, + }, + [{ "v", "V", "\x16" }] = { + winhl = { + CursorLineNr = { fg = "#d4be98" }, + Visual = { bg = "#0f3a42" }, + }, + }, + [{ "s", "S", "\x13" }] = { + winhl = { + CursorLineNr = { fg = "#d4be98" }, + Visual = { bg = "#0f3a42" }, + }, + }, + R = { + winhl = { + CursorLine = { bg = "#543937" }, + CursorLineNr = { fg = "#d4be98", bg = "#543937" }, + }, + }, + }, + } + require("reactive").add_preset(mypreset) + return { + builtin = { + cursorline = false, + cursor = false, + modemsg = false, + }, + } + end, } diff --git a/lua/plugin/editor/tiny-devicons-auto-colors.lua b/lua/plugin/editor/tiny-devicons-auto-colors.lua index 70591f7..aa3569d 100644 --- a/lua/plugin/editor/tiny-devicons-auto-colors.lua +++ b/lua/plugin/editor/tiny-devicons-auto-colors.lua @@ -1,24 +1,20 @@ --- INFO: updates nvim-web-devicons colors based on colorscheme. +-- INFO: Automatic devicon color adaptation +-- NOTE: Syncs icon colors with current colorscheme + return { "rachartier/tiny-devicons-auto-colors.nvim", - event = "VeryLazy", - dependencies = { - "nvim-tree/nvim-web-devicons", + opts = { + colors = { + "#ea6962", + "#e78a4e", + "#d8a657", + "#a9b665", + "#89b482", + "#7daea3", + "#d3869b", + "#a9b665", + "#d8a657", + }, + color_match_level = 0.85, -- Aggressiveness of color matching (0-1) }, - config = function() - require("tiny-devicons-auto-colors").setup({ - colors = { - "#ea6962", - "#e78a4e", - "#d8a657", - "#a9b665", - "#89b482", - "#7daea3", - "#d3869b", - "#ea6962", - "#a9b665", - "#d8a657", - }, - }) - end, } diff --git a/lua/plugin/editor/todo-comments.lua b/lua/plugin/editor/todo-comments.lua index 3dbf682..a8118b5 100644 --- a/lua/plugin/editor/todo-comments.lua +++ b/lua/plugin/editor/todo-comments.lua @@ -1,16 +1,41 @@ --- INFO: colorize and use icons for TODO comments +-- INFO: Highlight and manage todo comments +-- NOTE: Visualize todos with colored icons and diagnostics + return { "folke/todo-comments.nvim", - lazy = false, + event = "BufReadPost", dependencies = { "nvim-lua/plenary.nvim" }, opts = { + keywords = { + FIX = { icon = " ", color = "fix" }, + TODO = { icon = " ", color = "todo" }, + HACK = { icon = " ", color = "hack" }, + WARN = { icon = " ", color = "warn" }, + PERF = { icon = "󰅒 ", color = "perf" }, + NOTE = { icon = "󰎞 ", color = "note" }, + TEST = { icon = "󰙨 ", color = "test" }, + }, colors = { - error = { "#ea6962" }, - warning = { "#d8a657" }, - info = { "#7daea3" }, - hint = { "#89b482" }, - default = { "#e78a4e" }, - test = { "#d3869b" }, + error = { "DiagnosticError" }, + warning = { "DiagnosticWarn" }, + info = { "DiagnosticInfo" }, + hint = { "DiagnosticHint" }, + default = { "Comment" }, + fix = "#ea6962", + todo = "#e78a4e", + hack = "#d8a657", + warn = "#d8a657", + perf = "#7daea3", + note = "#89b482", + test = "#d3869b", + }, + highlight = { + pattern = [[.*<(KEYWORDS)\s*]], + keyword = "bg", + after = "fg", + }, + search = { + pattern = [[\b(KEYWORDS)\b]], }, }, } diff --git a/lua/plugin/editor/treesitter.lua b/lua/plugin/editor/treesitter.lua index 2042c75..f7276a0 100644 --- a/lua/plugin/editor/treesitter.lua +++ b/lua/plugin/editor/treesitter.lua @@ -1,29 +1,45 @@ --- INFO: better highlighting, creating file tree +-- INFO: Advanced syntax parsing and highlighting +-- NOTE: Provides better code understanding and manipulation + return { "nvim-treesitter/nvim-treesitter", - lazy = true, - event = { "BufReadPre", "BufNewFile" }, + event = "VeryLazy", + build = ":TSUpdate", opts = { ensure_installed = { - "lua", - "python", - "markdown_inline", - "dockerfile", "bash", - "json", - "yaml", - "toml", - "html", "css", - "javascript", - "typescript", + "dockerfile", + "html", "java", - "groovy", + "javascript", + "json", + "lua", + "markdown", + "python", "sql", + "toml", + "typescript", + "yaml", + }, + auto_install = true, + highlight = { + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - build = ":TSUpdate", }, } diff --git a/lua/plugin/editor/ufo.lua b/lua/plugin/editor/ufo.lua index daa6b9a..4fb1425 100644 --- a/lua/plugin/editor/ufo.lua +++ b/lua/plugin/editor/ufo.lua @@ -1,19 +1,29 @@ --- INFO: enable folds +-- INFO: Advanced code folding with LSP integration +-- NOTE: Provides intuitive folding visualization and navigation + return { "kevinhwang91/nvim-ufo", - lazy = true, - event = "BufReadPost", + event = "LspAttach", dependencies = { - "kevinhwang91/promise-async", -- Async support for lua - "luukvbaal/statuscol.nvim", -- For status column + "kevinhwang91/promise-async", + { + "luukvbaal/statuscol.nvim", + config = function() + require("statuscol").setup({ + foldfunc = "builtin", + setopt = true, + }) + end, + }, }, - config = function() - local handler = function(virtText, lnum, endLnum, width, truncate) + opts = { + fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate) local newVirtText = {} local suffix = (" 󰁂 %d "):format(endLnum - lnum) local sufWidth = vim.fn.strdisplaywidth(suffix) local targetWidth = width - sufWidth local curWidth = 0 + for _, chunk in ipairs(virtText) do local chunkText = chunk[1] local chunkWidth = vim.fn.strdisplaywidth(chunkText) @@ -24,7 +34,6 @@ return { local hlGroup = chunk[2] table.insert(newVirtText, { chunkText, hlGroup }) chunkWidth = vim.fn.strdisplaywidth(chunkText) - -- str width returned from truncate() may less than 2nd argument, need padding if curWidth + chunkWidth < targetWidth then suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) end @@ -32,16 +41,34 @@ return { end curWidth = curWidth + chunkWidth end - table.insert(newVirtText, { suffix, "MoreMsg" }) + table.insert(newVirtText, { suffix, "UfoFoldedEllipsis" }) return newVirtText - end - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true, - } - require("ufo").setup({ - fold_virt_text_handler = handler, - }) + end, + provider_selector = function() + return { "treesitter", "indent" } + end, + }, + config = function(_, opts) + -- Configure LSP folding capabilities + -- UFO folding + vim.o.foldcolumn = "1" -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + + -- Link custom highlight group + vim.api.nvim_set_hl(0, "UfoFoldedEllipsis", { link = "Comment" }) + + -- Initialize UFO with merged options + require("ufo").setup(opts) + + -- Key mappings for folding + vim.keymap.set("n", "zE", require("ufo").openAllFolds) + vim.keymap.set("n", "zC", require("ufo").closeAllFolds) + vim.keymap.set("n", "ze", require("ufo").openFoldsExceptKinds) + vim.keymap.set("n", "zc", function() + require("ufo").closeFoldsWith(1) -- Close only immediate fold + end, { desc = "Close current fold" }) end, } diff --git a/lua/plugin/lazy.lua b/lua/plugin/lazy.lua index 29f710d..d052095 100644 --- a/lua/plugin/lazy.lua +++ b/lua/plugin/lazy.lua @@ -1,4 +1,6 @@ --- INFO: Plugin manager +-- INFO: Plugin manager for Neovim +-- NOTE: Essential foundation for plugin management. Handles installation, updates, and lazy loading. + 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" @@ -32,6 +34,6 @@ require("lazy").setup({ }, checker = { enabled = true }, dev = { path = "~/Development/Projects" }, - install = { colorscheme = { "gruvbox-materal" } }, + install = { colorscheme = { "gruvbox-material" } }, ui = { border = "rounded" }, }) diff --git a/lua/plugin/lsp/conform.lua b/lua/plugin/lsp/conform.lua index 88f98d0..b52d706 100644 --- a/lua/plugin/lsp/conform.lua +++ b/lua/plugin/lsp/conform.lua @@ -1,4 +1,6 @@ --- INFO: formatter +-- INFO: Unified file formatting interface +-- NOTE: Handles code formatting through LSP and external tools + return { "stevearc/conform.nvim", lazy = false, @@ -14,16 +16,21 @@ return { }) end, desc = "Format file", + mode = { "n", "v" }, }, }, opts = { + format_on_save = { + timeout_ms = 1000, + lsp_fallback = true, + }, formatters_by_ft = { python = { "ruff" }, lua = { "stylua" }, markdown = { "markdownlint" }, sh = { "shfmt" }, - json = { "prettier" }, - yaml = { "yamlfmt" }, + json = { "jsonlint" }, + yaml = { "yamllint" }, html = { "prettier" }, css = { "prettier" }, javascript = { "prettier" }, @@ -38,5 +45,15 @@ return { ["*"] = { "codespell" }, ["_"] = { "trim_whitespace" }, }, + formatters = { + codespell = { + command = "codespell", + args = { "--write-changes", "$FILENAME" }, + }, + trim_whitespace = { + command = "sed", + args = { "-i", "s/[[:space:]]*$//" }, + }, + }, }, } diff --git a/lua/plugin/lsp/dap-ui.lua b/lua/plugin/lsp/dap-ui.lua new file mode 100644 index 0000000..c64c560 --- /dev/null +++ b/lua/plugin/lsp/dap-ui.lua @@ -0,0 +1,77 @@ +-- INFO: Debug Adapter Protocol UI with interactive elements +-- NOTE: Provides visual debugging interface with variable inspection and REPL + +return { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + }, + keys = { + { + "du", + function() + require("dapui").toggle() + end, + desc = "Toggle Debug UI", + }, + { + "de", + function() + require("dapui").eval() + end, + desc = "Evaluate expression", + mode = { "n", "v" }, + }, + { + "db", + function() + require("dap").toggle_breakpoint() + end, + desc = "Toggle breakpoint", + }, + }, + opts = { + icons = { + expanded = "⯆", + collapsed = "⯈", + circular = "↺", + }, + layouts = { + { + elements = { + { id = "scopes", size = 0.35 }, + { id = "breakpoints", size = 0.15 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 0.25 }, + }, + size = 0.3, + position = "left", + }, + { + elements = { + "repl", + "console", + }, + size = 0.25, + position = "bottom", + }, + }, + }, + config = function(_, opts) + local dapui = require("dapui") + local dap = require("dap") + + dapui.setup(opts) + + -- Auto open/close UI with debug sessions + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + end, +} diff --git a/lua/plugin/lsp/dap.lua b/lua/plugin/lsp/dap.lua new file mode 100644 index 0000000..fac5048 --- /dev/null +++ b/lua/plugin/lsp/dap.lua @@ -0,0 +1,150 @@ +-- INFO: Configures nvim-dap +-- NOTE: 'mfussenegger/nvim-dap' provides the core Debug Adapter Protocol client for Neovim + +return { + "mfussenegger/nvim-dap", + lazy = true, + event = "VeryLazy", + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + }, + keys = { + { + "", + function() + require("dap").continue() + end, + desc = "Start/Continue Debugging", + }, + { + "", + function() + require("dap").step_over() + end, + desc = "Step Over", + }, + { + "", + function() + require("dap").step_into() + end, + desc = "Step Into", + }, + { + "", + function() + require("dap").step_out() + end, + desc = "Step Out", + }, + { + "b", + function() + require("dap").toggle_breakpoint() + end, + desc = "Toggle Breakpoint", + }, + { + "B", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, + desc = "Set Conditional Breakpoint", + }, + { + "lp", + function() + require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) + end, + desc = "Set Log Point", + }, + { + "dr", + function() + require("dap").repl.open() + end, + desc = "Open REPL", + }, + { + "dl", + function() + require("dap").run_last() + end, + desc = "Run Last Debugging Session", + }, + }, + config = function() + local dap = require("dap") + local mason_path = vim.fn.stdpath("data") .. "/mason/packages" + + -- Python (debugpy) + local python_path = mason_path .. "/debugpy/venv/bin/python" + dap.adapters.python = { + type = "executable", + command = python_path, + args = { "-m", "debugpy.adapter" }, + } + dap.configurations.python = { + { + type = "python", + request = "launch", + name = "Launch file", + program = "${file}", + pythonPath = function() + return python_path + end, + }, + } + + -- Bash (bash-debug-adapter) + local bash_adapter_path = mason_path .. "/bash-debug-adapter/bash-debug-adapter" + local bashdb_dir = mason_path .. "/bash-debug-adapter/extension/bashdb_dir" + dap.adapters.bashdb = { + type = "executable", + command = bash_adapter_path, + name = "bashdb", + } + dap.configurations.sh = { + { + type = "bashdb", + request = "launch", + name = "Launch Bash script", + showDebugOutput = true, + pathBashdb = bashdb_dir .. "/bashdb", + pathBashdbLib = bashdb_dir, + trace = true, + file = "${file}", + program = "${file}", + cwd = "${workspaceFolder}", + pathCat = "cat", + pathBash = "/bin/bash", + pathMkfifo = "mkfifo", + pathPkill = "pkill", + args = {}, + env = {}, + terminalKind = "integrated", + }, + } + + -- Firefox Debugging + local firefox_adapter_path = mason_path .. "/firefox-debug-adapter/dist/adapter.bundle.js" + dap.adapters.firefox = { + type = "executable", + command = "node", + args = { firefox_adapter_path }, + } + dap.configurations.javascript = { + { + name = "Launch Firefox", + type = "firefox", + request = "launch", + reAttach = true, + url = "http://localhost:3000", + webRoot = "${workspaceFolder}", + firefoxExecutable = "/usr/bin/firefox", + }, + } + dap.configurations.typescript = dap.configurations.javascript + end, +} diff --git a/lua/plugin/lsp/fidget.lua b/lua/plugin/lsp/fidget.lua deleted file mode 100644 index 0ac1532..0000000 --- a/lua/plugin/lsp/fidget.lua +++ /dev/null @@ -1,24 +0,0 @@ --- NOTE: UI enhancements for LSP progress notifications --- Dependencies: None explicitly required, integrates with LSP clients - -return { - "j-hui/fidget.nvim", - event = "LspAttach", - opts = { - progress = { - display = { - done_icon = "✔", -- Custom icon for completed tasks - progress_icon = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }, - }, - }, - notification = { - window = { - winblend = 10, -- Transparency - border = "rounded", -- Rounded borders for a modern look - }, - }, - logger = { - level = vim.log.levels.WARN, -- Show warnings and errors only - }, - }, -} diff --git a/lua/plugin/lsp/garbage-day.lua b/lua/plugin/lsp/garbage-day.lua new file mode 100644 index 0000000..970b26d --- /dev/null +++ b/lua/plugin/lsp/garbage-day.lua @@ -0,0 +1,9 @@ +-- INFO: Optimize LSP memory usage by managing client lifecycle +-- NOTE: Automatically stops unused LSP clients to save RAM + +return { + "zeioth/garbage-day.nvim", + event = "VeryLazy", + dependencies = { "neovim/nvim-lspconfig" }, + opts = {}, +} diff --git a/lua/plugin/lsp/inc-rename.lua b/lua/plugin/lsp/inc-rename.lua index 8ed3e95..eb55ced 100644 --- a/lua/plugin/lsp/inc-rename.lua +++ b/lua/plugin/lsp/inc-rename.lua @@ -1,15 +1,33 @@ --- NOTE: Interactive LSP rename with preview +-- INFO: Interactive LSP rename with live preview +-- NOTE: Provides real-time renaming previews +-- Dependencies: +-- - 'stevearc/dressing.nvim': Improved UI components + +-- luacheck: globals vim +-- luacheck: ignore 113 return { "smjonas/inc-rename.nvim", - event = "BufReadPre", + event = "LspAttach", dependencies = { - "stevearc/dressing.nvim" + "stevearc/dressing.nvim", }, keys = { - { "rn", ":IncRename ", desc = "Rename symbol" }, + { + "rn", + ":IncRename ", + desc = "Rename symbol", + mode = "n", + }, }, opts = { - input_buffer_type = "dressing", -- Use dressing.nvim if available + input_buffer_type = "dressing", + preview_empty_name = false, + show_hl_groups = true, + hl_group = "Substitute", + preview_prefix = "➤ ", + cmd_name = "IncRename", + borders = "rounded", + clean_postfix_space = true, }, } diff --git a/lua/plugin/lsp/lint.lua b/lua/plugin/lsp/lint.lua index b554cb3..668039a 100644 --- a/lua/plugin/lsp/lint.lua +++ b/lua/plugin/lsp/lint.lua @@ -1,16 +1,11 @@ --- NOTE: Provides linting support for various filetypes +-- INFO: Asynchronous linting integration +-- NOTE: Provides real-time code analysis for various languages return { "mfussenegger/nvim-lint", - event = { "BufReadPre", "BufNewFile" }, + event = "VeryLazy", keys = { - { - "ll", - function() - require("lint").try_lint() - end, - desc = "Lint file", - }, + { "ll", function() require("lint").try_lint() end, desc = "Lint file" }, }, opts = { linters_by_ft = { @@ -20,28 +15,40 @@ return { sh = { "shellcheck" }, json = { "jsonlint" }, yaml = { "yamllint" }, + javascript = { "eslint_d" }, typescript = { "eslint_d" }, javascriptreact = { "eslint_d" }, typescriptreact = { "eslint_d" }, css = { "stylelint" }, java = { "checkstyle" }, sql = { "sqlfluff" }, - markdown = { "markdownlint" }, + markdown = { "markdownlint", "cspell" }, + text = { "cspell" } }, + -- Custom linter configuration (only non-defaults) + linters = { + cspell = { + cmd = "cspell", + args = { "--no-color", "--no-progress", "--no-summary", "stdin" }, + stream = "stdin", + } + } }, config = function(_, opts) local lint = require("lint") + -- Configure linters lint.linters_by_ft = opts.linters_by_ft + for name, config in pairs(opts.linters or {}) do + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, config) + end - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - - vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { - group = lint_augroup, + -- Setup automatic linting + vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { callback = function() lint.try_lint() - lint.try_lint("cspell") -- Ensure cspell is always run end, + group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }) }) - end, + end } diff --git a/lua/plugin/lsp/lsp-progress.lua b/lua/plugin/lsp/lsp-progress.lua deleted file mode 100644 index aa68c2c..0000000 --- a/lua/plugin/lsp/lsp-progress.lua +++ /dev/null @@ -1,6 +0,0 @@ --- INFO: LSP progress section for lualine -return { - "linrongbin16/lsp-progress.nvim", - lazy = true, - opts = {}, -} diff --git a/lua/plugin/lsp/lsp_signature.lua b/lua/plugin/lsp/lsp_signature.lua index 841e877..78f8958 100644 --- a/lua/plugin/lsp/lsp_signature.lua +++ b/lua/plugin/lsp/lsp_signature.lua @@ -1,14 +1,14 @@ --- NOTE: Show function signatures as you type for better LSP experience +-- INFO: In-- INFO: Interactive function signature help during typing +-- NOTE: Displays parameter information and documentation return { "ray-x/lsp_signature.nvim", - event = "VeryLazy", + event = "LspAttach", + dependencies = { + "neovim/nvim-lspconfig", + }, opts = { - bind = true, - hint_enable = true, - floating_window = true, - handler_opts = { - border = "rounded", - }, + hint_prefix = "󰛩 ", -- Custom hint indicator + extra_trigger_chars = { "(", ",", "<" }, -- Added angle bracket }, } diff --git a/lua/plugin/lsp/lspconfig.lua b/lua/plugin/lsp/lspconfig.lua index baeb5ec..b245492 100644 --- a/lua/plugin/lsp/lspconfig.lua +++ b/lua/plugin/lsp/lspconfig.lua @@ -1,25 +1,23 @@ --- NOTE: Configure Language Server Protocol (LSP) support in Neovim --- Provides auto-completion, diagnostics, and language-specific features +-- INFO: Core LSP configuration and integrations +-- NOTE: Provides language-aware features and server management return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, dependencies = { "hrsh7th/cmp-nvim-lsp", + "williamboman/mason-lspconfig.nvim", }, - keys = {}, opts = { - -- Default capabilities with folding support capabilities = function() - local capabilities = require("cmp_nvim_lsp").default_capabilities() - capabilities.textDocument.foldingRange = { + local caps = require("cmp_nvim_lsp").default_capabilities() + caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true, } - return capabilities + return caps end, - -- Diagnostic signs signs = { Error = "", Warn = "", @@ -27,41 +25,48 @@ return { Info = "", }, - -- List of LSP servers to configure servers = { - lua_ls = {}, - marksman = {}, - dockerls = {}, - docker_compose_language_service = {}, + lua_ls = { + settings = { + Lua = { + runtime = { version = "LuaJIT" }, + workspace = { checkThirdParty = false }, + }, + }, + }, bashls = {}, - jsonls = {}, - yamlls = {}, - taplo = {}, - html = {}, cssls = {}, + dockerls = {}, + docker_compose_language_service = {}, eslint = {}, - ts_ls = {}, - jdtls = {}, groovyls = {}, - sqlls = {}, + html = {}, + jdtls = {}, + jsonls = {}, lemminx = {}, + marksman = {}, + sqlls = {}, + taplo = {}, + ts_ls = {}, + yamlls = {}, + pylsp = {}, }, }, config = function(_, opts) - -- Set diagnostic signs + -- Configure diagnostic signs for type, icon in pairs(opts.signs) do local hl = "DiagnosticSign" .. type vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end - -- Set up LSP servers + -- Configure LSP servers local lspconfig = require("lspconfig") local capabilities = opts.capabilities() - for server, server_opts in pairs(opts.servers) do + for server, config in pairs(opts.servers) do lspconfig[server].setup(vim.tbl_deep_extend("force", { capabilities = capabilities, - }, server_opts)) + }, config)) end end, } diff --git a/lua/plugin/lsp/lspsaga.lua b/lua/plugin/lsp/lspsaga.lua index a169d3f..6c9d8fc 100644 --- a/lua/plugin/lsp/lspsaga.lua +++ b/lua/plugin/lsp/lspsaga.lua @@ -1,40 +1,62 @@ --- NOTE: Enhance LSP experience with UI improvements and additional features +-- INFO: Enhanced LSP UI with interactive features +-- NOTE: Provides IDE-like interactions for code navigation and diagnostics return { "nvimdev/lspsaga.nvim", + event = "LspAttach", dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-lua/plenary.nvim", }, keys = { - { "gd", "Lspsaga peek_definition", desc = "Show definition" }, - { "gy", "Lspsaga peek_type_definition", desc = "Show type definition" }, - { "gD", "Lspsaga goto_definition", desc = "Go to definition" }, - { "gY", "Lspsaga goto_type_definition", desc = "Go to type definition" }, - { "aa", "Lspsaga code_action", desc = "Show actions" }, - { "]d", "Lspsaga diagnostic_jump_next", desc = "Go to next diagnostic" }, - { "[d", "Lspsaga diagnostic_jump_prev", desc = "Go to previous diagnostic" }, - { "fr", "Lspsaga finder", desc = "Show references" }, - { "tl", "Lspsaga show_workspace_diagnostics ++normal", desc = "Diagnostic window" }, - { "?", "Lspsaga hover_doc", desc = "Show documentation" }, - { "to", "Lspsaga outline", desc = "Outline window" }, + { "gd", "Lspsaga peek_definition", desc = "Peek definition", mode = "n" }, + { "gD", "Lspsaga goto_definition", desc = "Goto definition", mode = "n" }, + { "gy", "Lspsaga peek_type_definition", desc = "Peek type definition", mode = "n" }, + { "gY", "Lspsaga goto_type_definition", desc = "Goto type definition", mode = "n" }, + { "aa", "Lspsaga code_action", desc = "Code action", mode = { "n", "v" } }, + { "]d", "Lspsaga diagnostic_jump_next", desc = "Next diagnostic", mode = "n" }, + { "[d", "Lspsaga diagnostic_jump_prev", desc = "Prev diagnostic", mode = "n" }, + { "fr", "Lspsaga finder", desc = "References finder", mode = "n" }, + { "tl", "Lspsaga show_buf_diagnostics ++normal", desc = "File diagnostics", mode = "n" }, + { + "tL", + "Lspsaga show_workspace_diagnostics ++normal", + desc = "Workspace diagnostics", + mode = "n", + }, + { "?", "Lspsaga hover_doc", desc = "Hover documentation", mode = "n" }, + { "to", "Lspsaga outline", desc = "Symbols outline", mode = "n" }, }, opts = { - ui = { code_action = "" }, + ui = { + code_action = "", + title = true, + border = "rounded", + colors = { + normal_bg = "#252423", + }, + }, finder = { keys = { vsplit = "S", + split = "s", + quit = "q", }, }, outline = { keys = { jump = "", + quit = "q", }, }, rename = { keys = { quit = "q", + select = "", }, }, + symbol_in_winbar = { + enable = true, + }, }, } diff --git a/lua/plugin/lsp/mason.lua b/lua/plugin/lsp/mason.lua index 5978b6c..f5812fd 100644 --- a/lua/plugin/lsp/mason.lua +++ b/lua/plugin/lsp/mason.lua @@ -1,38 +1,42 @@ --- INFO: LSP install tool +-- INFO: LSP/DAP/linter/formatter package manager +-- NOTE: Centralized dependency management for development tools + return { "williamboman/mason.nvim", lazy = false, dependencies = { - "williamboman/mason-lspconfig.nvim", -- For LSP configuration - "WhoIsSethDaniel/mason-tool-installer.nvim", -- For linters and formatters automatic installation + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", }, - config = function() - local mason = require("mason") - local mason_lspconfig = require("mason-lspconfig") - local mason_tool_installer = require("mason-tool-installer") - - mason.setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - border = "rounded", - height = 0.8, + opts = { + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", }, - }) + border = "rounded", + height = 0.8, + }, + -- Shared installation config + install_root_dir = vim.fn.stdpath("data") .. "/mason", + max_concurrent_installers = 4, + }, + config = function(_, opts) + -- Setup Mason core + require("mason").setup(opts) - mason_lspconfig.setup({ + -- Setup LSP config + require("mason-lspconfig").setup({ ensure_installed = { + "pylsp", "lua_ls", "marksman", "dockerls", - "docker_compose_language_service", "bashls", "jsonls", "yamlls", - "taplo", -- TOML LSP + "taplo", "html", "cssls", "eslint", @@ -40,17 +44,16 @@ return { "jdtls", "groovyls", "sqlls", - "lemminx", -- XML LSP + "lemminx", }, automatic_installation = true, }) - mason_tool_installer.setup({ + -- Setup tools installer + require("mason-tool-installer").setup({ ensure_installed = { - -- Linters - "ruff", -- Python linter "luacheck", - "hadolint", -- Docker linter + "hadolint", "shellcheck", "jsonlint", "yamllint", @@ -59,10 +62,7 @@ return { "checkstyle", "sqlfluff", "markdownlint", - "cspell", -- spell check - - -- Formatters - "ruff", -- Python formatter + "cspell", "stylua", "shfmt", "yamlfmt", @@ -70,6 +70,9 @@ return { "google-java-format", "sql-formatter", "xmlformatter", + "firefox-debug-adapter", + "debugpy", + "bash-debug-adapter", }, }) end, diff --git a/lua/plugin/lsp/neotest.lua b/lua/plugin/lsp/neotest.lua new file mode 100644 index 0000000..1293453 --- /dev/null +++ b/lua/plugin/lsp/neotest.lua @@ -0,0 +1,37 @@ +-- INFO: Extensible framework for interacting with tests within Neovim +-- NOTE: Requires appropriate test adapters for your specific language/framework + +return { + "nvim-neotest/neotest", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + -- Adapters for supported languages + "nvim-neotest/neotest-python", + "nvim-neotest/neotest-jest", + "rouge8/neotest-rust", + "rcasia/neotest-bash", + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + }), + require("neotest-jest")({ + jestCommand = "npm test --", + jestConfigFile = "jest.config.js", + env = { CI = true }, + cwd = function() + return vim.fn.getcwd() + end, + }), + require("neotest-rust"), + require("neotest-bash"), + }, + }) + end, +} diff --git a/lua/plugin/lsp/nvim-jdtls.lua b/lua/plugin/lsp/nvim-jdtls.lua deleted file mode 100644 index 3ccc364..0000000 --- a/lua/plugin/lsp/nvim-jdtls.lua +++ /dev/null @@ -1,30 +0,0 @@ --- NOTE: Java LSP support via jdtls - -return { - "mfussenegger/nvim-jdtls", - ft = { "java" }, - opts = { - cmd = { "jdtls" }, - root_dir = function() - return require("jdtls.setup").find_root({ "gradlew", ".git", "mvnw" }) - end, - settings = { - java = { - signatureHelp = { enabled = true }, - completion = { - favoriteStaticMembers = { - "org.junit.jupiter.api.Assertions.*", - "java.util.Objects.requireNonNull", - "java.util.stream.Collectors.toList", - }, - }, - }, - }, - init_options = { - bundles = {}, - }, - }, - config = function(_, opts) - require("jdtls").start_or_attach(opts) - end, -} diff --git a/lua/plugin/lsp/tiny-inline-diagnostic.lua b/lua/plugin/lsp/tiny-inline-diagnostic.lua new file mode 100644 index 0000000..e7e8f25 --- /dev/null +++ b/lua/plugin/lsp/tiny-inline-diagnostic.lua @@ -0,0 +1,15 @@ +-- INFO: Minimal inline LSP diagnostic display +-- NOTE: Shows diagnostics at end of line without virtual text + +return { + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", + dependencies = { + "neovim/nvim-lspconfig" + }, + opts = { + enable_virtual_text = true, -- Show diagnostic message after error symbol + delay = 300, -- ms delay after cursor movement + enable_auto = true -- Automatically show diagnostics + } +} diff --git a/lua/plugin/theme/bufferline.lua b/lua/plugin/theme/bufferline.lua index aabc8d6..5d58996 100644 --- a/lua/plugin/theme/bufferline.lua +++ b/lua/plugin/theme/bufferline.lua @@ -1,4 +1,6 @@ --- INFO: tabline +-- INFO: Enhanced tab/buffer management interface +-- NOTE: Provides visual navigation through open buffers with icons and diagnostics + return { "akinsho/bufferline.nvim", lazy = false, @@ -18,6 +20,10 @@ return { left_trunc_marker = "", right_trunc_marker = "", diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level) + local icon = level:match("error") and " " or " " + return icon .. count + end, offsets = { { filetype = "neo-tree", diff --git a/lua/plugin/theme/colorizer.lua b/lua/plugin/theme/colorizer.lua index 6b6f632..f7bbe9e 100644 --- a/lua/plugin/theme/colorizer.lua +++ b/lua/plugin/theme/colorizer.lua @@ -1,13 +1,27 @@ --- INFO: higlight colors in editor +-- INFO: Real-time color code highlighting +-- NOTE: Displays color previews for hex codes, RGB values, and named colors + return { "norcalli/nvim-colorizer.lua", - lazy = false, event = { "BufReadPre", "BufNewFile" }, opts = { - "*", - css = { + ["*"] = { -- Default settings for all filetypes + RGB = true, + names = true, RRGGBBAA = true, - css = true, + virtualtext = "■", + }, + css = { + mode = "background", + sass = { enable = true }, + }, + html = { + mode = "foreground", + names = false, + }, + javascript = { + mode = "background", + tailwind = true, }, }, } diff --git a/lua/plugin/theme/colorscheme.lua b/lua/plugin/theme/colorscheme.lua index bceb2b5..d16384d 100644 --- a/lua/plugin/theme/colorscheme.lua +++ b/lua/plugin/theme/colorscheme.lua @@ -1,30 +1,34 @@ --- INFO: my gruvbox theme +-- INFO: Gruvbox Material colorscheme configuration +-- NOTE: Customized soft background variant with UI enhancements + return { "sainnhe/gruvbox-material", lazy = false, - config = function() - local g = vim.g - - g.gruvbox_material_background = "soft" - g.gruvbox_material_foreground = "material" - g.gruvbox_material_transparent_background = 2 - g.gruvbox_material_sign_column_background = "grey" - g.gruvbox_material_statusline_style = "default" - g.gruvbox_material_ui_contrast = "low" - g.gruvbox_material_diagnostic_line_highlight = "1" - g.gruvbox_material_disable_terminal_colors = 1 - - -- Font settings - g.gruvbox_material_enable_bold = 1 - g.gruvbox_material_enable_italic = 1 - - g.gruvbox_material_better_performance = 1 + priority = 1000, + opts = { + background = "soft", + foreground = "material", + transparent_background = 2, + sign_column_background = "grey", + statusline_style = "default", + ui_contrast = "low", + diagnostic_line_highlight = 1, + disable_terminal_colors = 1, + enable_bold = 1, + enable_italic = 1, + better_performance = 1, + }, + config = function(_, opts) + -- Apply theme options + for option, value in pairs(opts) do + vim.g["gruvbox_material_" .. option] = value + end + -- Set colorscheme vim.cmd.colorscheme("gruvbox-material") + -- Custom float window styling vim.api.nvim_set_hl(0, "NormalFloat", { fg = "#d4be98" }) vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#d4be98" }) - vim.api.nvim_set_hl(0, "NeoTreeFloatTitle", { fg = "#d4be98" }) end, - priority = 1000, } diff --git a/lua/plugin/theme/dressing.lua b/lua/plugin/theme/dressing.lua new file mode 100644 index 0000000..9ce9dc3 --- /dev/null +++ b/lua/plugin/theme/dressing.lua @@ -0,0 +1,14 @@ +-- INFO: Enhanced UI components for inputs and selects +-- NOTE: Improves default Neovim UI elements with modern styling + +return { + "stevearc/dressing.nvim", + opts = { + input = { + relative = "cursor", + prefer_width = 40, + min_width = 20, + border = "rounded", + }, + }, +} diff --git a/lua/plugin/theme/lualine.lua b/lua/plugin/theme/lualine.lua index 364c11d..5076dd2 100644 --- a/lua/plugin/theme/lualine.lua +++ b/lua/plugin/theme/lualine.lua @@ -1,76 +1,81 @@ --- INFO: statusline with useful info +-- INFO: Customizable status line with real-time diagnostics +-- NOTE: Provides contextual information and mode awareness + return { "nvim-lualine/lualine.nvim", - lazy = false, + event = "VeryLazy", dependencies = { - "nvim-tree/nvim-web-devicons", -- Just pretty icons + "nvim-tree/nvim-web-devicons", + { + "linrongbin16/lsp-progress.nvim", + opts = { + client_format = function(client_name, spinner, series_messages) + local sign = " " + return #series_messages > 0 and (sign .. client_name .. " " .. table.concat(series_messages, " ")) or "" + end, + }, + }, }, opts = { options = { theme = "gruvbox-material", globalstatus = true, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "alpha", "dashboard" }, }, sections = { + lualine_a = { "mode" }, lualine_b = { "branch", - { - "diff", - colored = true, - symbols = { added = "+", modified = "~", removed = "-" }, - source = nil, - }, + "diff", { "diagnostics", - sources = { - "nvim_diagnostic", - "nvim_lsp", - }, - sections = { - "error", - "warn", - "info", - "hint", - }, symbols = { error = " ", warn = " ", info = " ", hint = " ", }, - colored = true, - update_in_insert = true, - always_visible = false, }, }, lualine_c = { { "filename", - file_status = true, - newfile_status = false, - path = 0, - shorting_target = 40, + path = 1, symbols = { - modified = "[+]", - readonly = "[RO]", - unnamed = "[No Name]", - newfile = "[New]", + modified = "● ", + readonly = " ", + unnamed = " ", }, }, + { + function() + return require("lsp-progress").progress() + end, + }, }, lualine_x = { { "searchcount", maxcount = 999, - timeout = 10, }, "encoding", - { - "filetype", - colored = true, - icon_only = false, - icon = { align = "left" }, - }, + "fileformat", }, + lualine_y = { "progress" }, + lualine_z = { "location" }, }, + extensions = { "neo-tree", "lazy" }, }, + config = function(_, opts) + require("lualine").setup(opts) + + vim.api.nvim_create_augroup("lualine_augroup", { clear = true }) + vim.api.nvim_create_autocmd("User", { + group = "lualine_augroup", + pattern = "LspProgressStatusUpdated", + callback = require("lualine").refresh, + }) + end, } diff --git a/lua/plugin/theme/statuscol.lua b/lua/plugin/theme/statuscol.lua index 719b305..14a1c33 100644 --- a/lua/plugin/theme/statuscol.lua +++ b/lua/plugin/theme/statuscol.lua @@ -1,25 +1,31 @@ --- INFO: clickable status colomun, for ufo plugin +-- INFO: Interactive status column with fold indicators +-- NOTE: Provides clickable line numbers and fold markers + return { "luukvbaal/statuscol.nvim", - lazy = true, - config = function() - local builtin = require("statuscol.builtin") - require("statuscol").setup({ - relculright = true, - segments = { - { - text = { builtin.foldfunc }, - click = "v:lua.ScFa", - }, - { - text = { "%s" }, - click = "v:lua.ScSa", - }, - { - text = { builtin.lnumfunc, " " }, - click = "v:lua.ScLa", - }, + event = "VeryLazy", + dependencies = { "kevinhwang91/nvim-ufo" }, + opts = { + setopt = true, + relculright = true, + segments = { + { + text = { "%C" }, + click = "v:lua.ScFa", + condition = { true }, + hl = "FoldColumn", }, - }) - end, + { + text = { "%s" }, + click = "v:lua.ScSa", + hl = "SignColumn", + }, + { + text = { " ", "", " " }, + click = "v:lua.ScLa", + hl = { "LineNr", "Comment" }, + condition = { true }, + }, + }, + }, } diff --git a/lua/plugin/util/code_runner.lua b/lua/plugin/util/code_runner.lua new file mode 100644 index 0000000..a43faef --- /dev/null +++ b/lua/plugin/util/code_runner.lua @@ -0,0 +1,34 @@ +-- INFO: Execute code snippets or files directly within Neovim. +-- NOTE: Supports multiple languages and integrates with betterTerm.nvim for terminal management. + +return { + "CRAG666/code_runner.nvim", + cmd = { "RunCode", "RunFile", "RunProject" }, + keys = { + { "er", "RunCode", desc = "Run code" }, + { "erf", "RunFile", desc = "Run file" }, + { "erp", "RunProject", desc = "Run project" }, + }, + opts = { + mode = "term", + startinsert = true, + term = { + position = "bot", + size = 15, + }, + filetype = { + java = { + "cd $dir &&", + "javac $fileName &&", + "java $fileNameWithoutExt", + }, + python = "python3 -u", + typescript = "deno run", + rust = { + "cd $dir &&", + "rustc $fileName &&", + "$dir/$fileNameWithoutExt", + }, + }, + }, +} diff --git a/lua/plugin/util/dashboard.lua b/lua/plugin/util/dashboard.lua index 3f051c9..bb11e08 100644 --- a/lua/plugin/util/dashboard.lua +++ b/lua/plugin/util/dashboard.lua @@ -1,57 +1,70 @@ --- INFO: enter screen configuration +-- INFO: Start screen plugin providing a customizable dashboard interface. +-- NOTE: Displays a dashboard with shortcuts and recent files/projects upon launching Neovim. + return { "nvimdev/dashboard-nvim", + lazy = false, event = "VimEnter", - config = function() - require("dashboard").setup({ - theme = "hyper", - config = { - header = { - "", - " ██████╗███████╗██╗ ████████╗██╗ ██████╗██╗ ██╗██╗███╗ ███╗", - "██╔════╝██╔════╝██║ ╚══██╔══╝██║██╔════╝██║ ██║██║████╗ ████║", - "██║ █████╗ ██║ ██║ ██║██║ ██║ ██║██║██╔████╔██║", - "██║ ██╔══╝ ██║ ██║ ██║██║ ╚██╗ ██╔╝██║██║╚██╔╝██║", - "╚██████╗███████╗███████╗██║ ██║╚██████╗ ╚████╔╝ ██║██║ ╚═╝ ██║", - " ╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝", - "", - }, - shortcut = { - { - desc = " Files", - group = "Orange", - action = "Telescope find_files", - key = "f", - }, - { - desc = " Plugins", - group = "Aqua", - action = "Lazy update", - key = "u", - }, - { - desc = " LSP", - group = "Aqua", - action = "Mason", - key = "s", - }, + dependencies = { + { "nvim-tree/nvim-web-devicons" }, + }, + keys = {}, + opts = { + theme = "hyper", + config = { + header = { + "", + " ██████╗███████╗██╗ ████████╗██╗ ██████╗██╗ ██╗██╗███╗ ███╗", + "██╔════╝██╔════╝██║ ╚══██╔══╝██║██╔════╝██║ ██║██║████╗ ████║", + "██║ █████╗ ██║ ██║ ██║██║ ██║ ██║██║██╔████╔██║", + "██║ ██╔══╝ ██║ ██║ ██║██║ ╚██╗ ██╔╝██║██║╚██╔╝██║", + "╚██████╗███████╗███████╗██║ ██║╚██████╗ ╚████╔╝ ██║██║ ╚═╝ ██║", + " ╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝", + "", + }, + shortcut = { + { + desc = "󰈮 Files", + group = "Orange", + action = "Telescope find_files", + key = "f", }, - project = { - icon = " ", - label = " Recent project", - limit = 8, + { + desc = " Plugins", + group = "Aqua", + action = "Lazy update", + key = "u", }, - mru = { - icon = " ", - label = " Recent files", - limit = 10, + { + desc = " LSP", + group = "Aqua", + action = "Mason", + key = "s", }, }, - }) - vim.api.nvim_set_hl(0, "DashboardProjectIcon", { fg = "#a9b665" }) - vim.api.nvim_set_hl(0, "DashboardProjectTitle", { fg = "#d8a657" }) - vim.api.nvim_set_hl(0, "DashboardProjectTitleIcon", { fg = "#d8a657" }) - vim.api.nvim_set_hl(0, "DashboardMruIcon", { fg = "#d8a657" }) - vim.api.nvim_set_hl(0, "DashboardMruTitle", { fg = "#d8a657" }) + project = { + enable = true, + icon = " ", + label = " Recent project", + limit = 8, + action = "Telescope find_files cwd=", + }, + mru = { + enable = true, + icon = " ", + label = " Recent files", + limit = 10, + cwd_only = false, + }, + }, + }, + config = function(_, opts) + require("dashboard").setup(opts) + local set_hl = vim.api.nvim_set_hl + set_hl(0, "DashboardProjectIcon", { fg = "#a9b665" }) + set_hl(0, "DashboardProjectTitle", { fg = "#d8a657" }) + set_hl(0, "DashboardProjectTitleIcon", { fg = "#d8a657" }) + set_hl(0, "DashboardMruIcon", { fg = "#d8a657" }) + set_hl(0, "DashboardMruTitle", { fg = "#d8a657" }) end, } diff --git a/lua/plugin/util/decisive.lua b/lua/plugin/util/decisive.lua new file mode 100644 index 0000000..7e050fd --- /dev/null +++ b/lua/plugin/util/decisive.lua @@ -0,0 +1,44 @@ +-- INFO: Enhances CSV editing by aligning columns using virtual text. +-- NOTE: Utilizes Neovim 0.10+'s inline extmarks feature for non-intrusive column alignment. + +return { + "emmanueltouzery/decisive.nvim", + lazy = false, + ft = { "csv" }, + dependencies = {}, + keys = { + { + "cca", + ":lua require('decisive').align_csv({})", + { silent = true }, + desc = "Align CSV", + mode = "n", + }, + { + "ccA", + ":lua require('decisive').align_csv_clear({})", + { silent = true }, + desc = "Align CSV clear", + mode = "n", + }, + { + "[c", + ":lua require('decisive').align_csv_prev_col()", + { silent = true }, + desc = "Align CSV prev col", + mode = "n", + }, + { + "]c", + ":lua require('decisive').align_csv_next_col()", + { silent = true }, + desc = "Align CSV next col", + mode = "n", + }, + }, + opts = { + auto_realign = true, + even_highlight = "DecisiveEven", + odd_highlight = "DecisiveOdd", + }, +} diff --git a/lua/plugin/util/fine-cmd-line.lua b/lua/plugin/util/fine-cmd-line.lua index b1ccfc4..1b64df8 100644 --- a/lua/plugin/util/fine-cmd-line.lua +++ b/lua/plugin/util/fine-cmd-line.lua @@ -1,16 +1,17 @@ --- INFO: pretty command line +-- INFO: Enhanced command-line interface +-- NOTE: Provides a floating command palette with history + return { "VonHeikemen/fine-cmdline.nvim", - lazy = true, - dependencies = { "MunifTanjim/nui.nvim" }, -- Floating support keys = { - { ":", "FineCmdline", desc = "execute" }, + { ":", "FineCmdline", desc = "Open command palette", mode = "n" }, }, + dependencies = { "MunifTanjim/nui.nvim" }, opts = { cmdline = { enable_keymaps = true, smart_history = true, - prompt = ":", + prompt = " 󰘳 ", }, popup = { position = { @@ -19,6 +20,9 @@ return { }, size = { width = "40%", + min_width = 40, + max_width = 80, + height = "auto", }, border = { style = "rounded", diff --git a/lua/plugin/util/neo-tree.lua b/lua/plugin/util/neo-tree.lua deleted file mode 100644 index ec1ce50..0000000 --- a/lua/plugin/util/neo-tree.lua +++ /dev/null @@ -1,59 +0,0 @@ --- INFO: pretty file manager -return { - "nvim-neo-tree/neo-tree.nvim", - lazy = false, - dependencies = { - "nvim-lua/plenary.nvim", -- Async support - "nvim-tree/nvim-web-devicons", -- Just pretty icons - "MunifTanjim/nui.nvim", -- Floating support - "3rd/image.nvim", -- Image preview - }, - keys = { - { "E", ":Neotree float reveal", desc = "float file explorer" }, - { "e", ":Neotree left reveal", desc = "left file explorer" }, - { "g", ":Neotree float git_status", desc = "float git status" }, - }, - opts = { - close_if_last_window = false, - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - open_files_do_not_replace_types = { - "terminal", - "trouble", - "qf", - }, - sort_case_insensitive = true, - sort_function = nil, - source_selector = { - winbar = true, - statusline = false, - }, - default_component_configs = { - git_status = { - symbols = { - -- Change type - added = "", - modified = "", - deleted = "", - renamed = "", - - -- Status type - untracked = "", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - }, - }, - }, - filesystem = { - filtered_items = { - always_show = { - ".gitignore", - ".gitmodules", - }, - }, - }, - }, -} diff --git a/lua/plugin/util/neogit.lua b/lua/plugin/util/neogit.lua new file mode 100644 index 0000000..b888e9d --- /dev/null +++ b/lua/plugin/util/neogit.lua @@ -0,0 +1,83 @@ +-- INFO: Provides an interactive Git interface within Neovim, inspired by Magit. +-- NOTE: Enhances Git operations directly from Neovim without leaving the editor. + +return { + "NeogitOrg/neogit", + lazy = false, + cmd = { "Neogit" }, + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + keys = { + { "gg", "Neogit", desc = "Open Neogit" }, + }, + + opts = { + disable_hint = false, + disable_context_highlighting = false, + disable_signs = false, + prompt_force_push = true, + disable_insert_on_commit = "auto", + filewatcher = { + interval = 1000, + enabled = true, + }, + graph_style = "kitty", + use_default_keymaps = true, + auto_refresh = true, + kind = "floating", + disable_line_numbers = true, + disable_relative_line_numbers = true, + console_timeout = 2000, + auto_show_console = true, + auto_close_console = true, + notification_icon = "", + status = { + show_head_commit_hash = true, + recent_commit_count = 10, + HEAD_padding = 10, + HEAD_folded = false, + mode_padding = 3, + mode_text = { + M = "modified", + N = "new file", + A = "added", + D = "deleted", + C = "copied", + U = "updated", + R = "renamed", + DD = "unmerged", + AU = "unmerged", + UD = "unmerged", + }, + }, + integrations = { + diffview = true, + }, + highlight = { + italic = true, + bold = true, + underline = true, + }, + remember_settings = true, + use_per_project_settings = true, + ignored_settings = { + "NeogitPushPopup--force-with-lease", + "NeogitPushPopup--force", + "NeogitPullPopup--rebase", + "NeogitCommitPopup--allow-empty", + "NeogitRevertPopup--no-edit", + }, + git_services = { + ["github.com"] = "https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1", + ["bitbucket.org"] = "https://bitbucket.org/${owner}/${repository}/pull-requests/new?source=${branch_name}&t=1", + ["gitlab.com"] = "https://gitlab.com/${owner}/${repository}/merge_requests/new?merge_request[source_branch]=${branch_name}", + ["azure.com"] = "https://dev.azure.com/${owner}/_git/${repository}/pullrequestcreate?sourceRef=${branch_name}&targetRef=${target}", + }, + telescope_sorter = function() + return require("telescope").extensions.fzf.native_fzf_sorter() + end, + }, +} diff --git a/lua/plugin/util/notify.lua b/lua/plugin/util/notify.lua new file mode 100644 index 0000000..4eec78a --- /dev/null +++ b/lua/plugin/util/notify.lua @@ -0,0 +1,38 @@ +-- INFO: Notification plugin to replace vim.notify with a fancy floating notification system. +-- NOTE: Replaces default notifications with a configurable, animated notification popup. + +return { + -- 1. Plugin address. + "rcarriga/nvim-notify", + + -- 2. lazy: load immediately (or adjust as needed). + lazy = false, + + -- 3. (No event required for this plugin) + + -- 4. Dependencies: none. + dependencies = {}, + + -- 5. Keys: (this plugin does not define key mappings by default). + keys = {}, + + -- 6. opts: Configuration options for nvim-notify. + opts = { + stages = "fade_in_slide_out", + timeout = 3000, + max_height = function() + return math.floor(vim.o.lines * 0.75) + end, + max_width = function() + return math.floor(vim.o.columns * 0.75) + end, + top_down = true, + background_colour = "#1e222a", + }, + + config = function(_, opts) + local notify = require("notify") + notify.setup(opts) + vim.notify = notify + end, +} diff --git a/lua/plugin/util/nvim-tree.lua b/lua/plugin/util/nvim-tree.lua new file mode 100644 index 0000000..c12a50c --- /dev/null +++ b/lua/plugin/util/nvim-tree.lua @@ -0,0 +1,81 @@ +-- INFO: File tree explorer with enhanced features +-- NOTE: Provides traditional sidebar-style file navigation + +return { + "nvim-tree/nvim-tree.lua", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", -- pretty icons + }, + keys = { + { "te", ":NvimTreeToggle", desc = "Toggle file explorer (left sidebar)" }, + }, + opts = { + hijack_cursor = true, + reload_on_bufenter = true, + renderer = { + hidden_display = "all", + highlight_git = "name", + highlight_opened_files = "icon", + highlight_hidden = "name", + icons = { + git_placement = "after", + diagnostics_placement = "right_align", + glyphs = { + git = { + deleted = " ", + renamed = " ", + untracked = " ", + ignored = " ", + unstaged = " ", + staged = " ", + }, + }, + }, + }, + diagnostics = { + enable = true, + show_on_dirs = true, + icons = { + hint = " ", + info = " ", + warning = " ", + error = " ", + }, + }, + filters = { + dotfiles = true, + }, + tab = { + sync = { + open = true, + close = true, + }, + }, + }, + config = function(_, opts) + -- Set our own on_attach callback to override the default keymaps. + opts.on_attach = function(bufnr) + local api = require("nvim-tree.api") + + local function nnoremap(keys, func, desc) + vim.keymap.set( + "n", + keys, + func, + { buffer = bufnr, noremap = true, silent = true, nowait = true, desc = "nvim-tree: " .. desc } + ) + end + + api.config.mappings.default_on_attach(bufnr) + + -- Define new custom key mappings: + nnoremap(".", api.tree.change_root_to_node, "CD") + nnoremap("t", api.node.open.tab, "Open: New Tab") + nnoremap("s", api.node.open.vertical, "Open: Vertical Split") + nnoremap("S", api.node.open.horizontal, "Open: Horizontal Split") + end + + require("nvim-tree").setup(opts) + end, +} diff --git a/lua/plugin/util/peek.lua b/lua/plugin/util/peek.lua deleted file mode 100644 index 5d7d96c..0000000 --- a/lua/plugin/util/peek.lua +++ /dev/null @@ -1,10 +0,0 @@ --- INFO: preview markdown files -return { - "toppair/peek.nvim", - lazy = true, - event = { "VeryLazy" }, - config = function() - vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) - end, - build = "deno task --quiet build:fast", -} diff --git a/lua/plugin/util/render-markdown.lua b/lua/plugin/util/render-markdown.lua new file mode 100644 index 0000000..89e5678 --- /dev/null +++ b/lua/plugin/util/render-markdown.lua @@ -0,0 +1,24 @@ +-- INFO: Enhances Markdown file readability by rendering elements like headings, lists, and tables within Neovim. +-- NOTE: Provides an in-editor Markdown preview without external dependencies. + +return { + "MeanderingProgrammer/render-markdown.nvim", + lazy = false, + ft = { "markdown", "quarto" }, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + opts = { + enabled = true, + render_modes = { "n", "c", "t" }, + file_types = { "markdown", "quarto" }, + heading = { + position = "inline", + backgrounds = { "RenderMarkdownHdNoBg" }, + }, + sign = { + enabled = false, + }, + }, +} diff --git a/lua/plugin/util/search.lua b/lua/plugin/util/search.lua new file mode 100644 index 0000000..3ad7544 --- /dev/null +++ b/lua/plugin/util/search.lua @@ -0,0 +1,61 @@ +-- lucheck: globals require +-- INFO: Search Plugin to enable a tabbed search interface using Telescope. +-- NOTE: This plugin allows switching between different search modes. + +return { + "FabianWirth/search.nvim", + lazy = false, + event = "VeryLazy", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + keys = { + { + "fs", + "lua require('search').open()", + desc = "Open Search Tabs", + }, + }, + opts = { + mappings = { + next = "", + prev = "", + }, + tabs = { + { + name = "Files", + tele_func = require("telescope.builtin").find_files, + }, + { + name = "Grep", + tele_func = require("telescope.builtin").live_grep, + }, + { + name = "Git files", + tele_func = require("telescope.builtin").git_files, + }, + { + name = "Buffers", + tele_func = require("telescope.builtin").buffers, + }, + { + name = "Media", + tele_func = function() + require("telescope").extensions.media_files.media_files() + end, + }, + { + name = "Docker", + tele_func = function() + require("telescope").extensions.docker.docker() + end, + }, + { + name = "Undo history", + tele_func = function() + require("telescope").extensions.undo.undo() + end, + }, + }, + }, +} diff --git a/lua/plugin/util/sqls.lua b/lua/plugin/util/sqls.lua new file mode 100644 index 0000000..acdad6d --- /dev/null +++ b/lua/plugin/util/sqls.lua @@ -0,0 +1,18 @@ +-- INFO: SQL language support via LSP +-- NOTE: Requires Neovim 0.10+ and the sqls language server + +return { + "nanotee/sqls.nvim", + ft = { "sql" }, + dependencies = { "neovim/nvim-lspconfig" }, + config = function() + local lspconfig = require("lspconfig") + local sqls = require("sqls") + + lspconfig.sqls.setup({ + on_attach = function(client, bufnr) + sqls.on_attach(client, bufnr) + end, + }) + end, +} diff --git a/lua/plugin/util/surround.lua b/lua/plugin/util/surround.lua new file mode 100644 index 0000000..7adc006 --- /dev/null +++ b/lua/plugin/util/surround.lua @@ -0,0 +1,9 @@ +-- INFO: Easily add, delete, or change surroundings in Neovim +-- NOTE: Inspired by tpope/vim-surround, written in Lua + +return { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + opts = {}, +} diff --git a/lua/plugin/util/telescope.lua b/lua/plugin/util/telescope.lua index a68a52c..4c63d46 100644 --- a/lua/plugin/util/telescope.lua +++ b/lua/plugin/util/telescope.lua @@ -1,43 +1,55 @@ --- INFO: cool finder|previewer +-- INFO: Fuzzy finder with advanced preview capabilities. +-- NOTE: Unified interface for file navigation and system exploration. + return { "nvim-telescope/telescope.nvim", - lazy = true, + cmd = "Telescope", dependencies = { - "nvim-lua/plenary.nvim", -- Async support - "nvim-lua/popup.nvim", -- Popup support - "debugloop/telescope-undo.nvim", -- Custom module, to preview undos - "nvim-telescope/telescope-media-files.nvim", -- Custom module, to preview images - "lpoto/telescope-docker.nvim", -- Custom module, docker support - }, - keys = { - { "ff", ":Telescope find_files", desc = "find files" }, - { "fg", ":Telescope live_grep", desc = "grep files" }, - { "fm", ":Telescope media_files", desc = "find media" }, - { "fd", ":Telescope docker", desc = "navigate docker" }, - { "fu", ":Telescope undo", desc = "navigate undos" }, + "nvim-lua/plenary.nvim", + "debugloop/telescope-undo.nvim", + "nvim-telescope/telescope-media-files.nvim", + "lpoto/telescope-docker.nvim", }, opts = { defaults = { mappings = { i = { - [""] = "which_key", - [""] = "select_vertical", - [""] = "select_horizontal", + [""] = require("telescope.actions").which_key, + [""] = require("telescope.actions").select_vertical, + [""] = require("telescope.actions").select_horizontal, }, n = { - ["s"] = "select_vertical", - ["S"] = "select_horizontal", - ["t"] = "select_tab", + s = require("telescope.actions").select_vertical, + S = require("telescope.actions").select_horizontal, + t = require("telescope.actions").select_tab, }, }, + layout_strategy = "horizontal", + layout_config = { + preview_width = 0.6, + width = 0.95, + height = 0.85, + }, + file_ignore_patterns = { + "node_modules", + ".git", + ".cache", + "%.jpg", + "%.png", + }, }, extensions = { media_files = { filetypes = { "png", "webp", "jpg", "jpeg", "pdf" }, find_cmd = "rg", }, - docker = {}, - undo = {}, + docker = { + hidden = false, + }, + undo = { + use_delta = true, + side_by_side = true, + }, }, }, } diff --git a/lua/plugin/util/which-key.lua b/lua/plugin/util/which-key.lua index 9398453..ac581a4 100644 --- a/lua/plugin/util/which-key.lua +++ b/lua/plugin/util/which-key.lua @@ -1,26 +1,46 @@ +-- INFO: Keybinding discovery and documentation +-- NOTE: Provides visual hints for leader key mappings +-- luacheck: globals vim + return { "folke/which-key.nvim", - dependencies = { - "nvim-tree/nvim-web-devicons", - "echasnovski/mini.icons", - }, keys = { { "", - ":WhichKey", - desc = "Buffer Local Keymaps (which-key)", + function() + vim.cmd.WhichKey() + end, + desc = "Show active keymaps", + }, + }, + opts = { + icons = { + group = vim.g.icons_enabled and "" or "+", + separator = "", + breadcrumb = "»", + }, + window = { + border = "rounded", + margin = { 1, 0, 1, 0 }, + }, + layout = { + spacing = 4, }, }, config = function(_, opts) local wk = require("which-key") wk.setup(opts) + -- Common prefix registrations wk.register({ [""] = { - f = { - name = "Find", - } - } + f = { name = "Find" }, + d = { name = "Debug" }, + g = { name = "Git" }, + l = { name = "LSP" }, + s = { name = "Search" }, + w = { name = "Workspace" }, + }, }) end, }