diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 96% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md index 62cbf03..7858985 100644 --- a/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -32,7 +32,7 @@ appreciation, which we would also be very happy about: ## Code of Conduct This project and everyone participating in it is governed by the -[nvim-config Code of Conduct](https://github.com/CelticBoozer/nvim-config/blob/master/CODE_OF_CONDUCT.md). +[nvim-config Code of Conduct](https://github.com/CelticBoozer/nvim-config/blob/master/.github/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to . @@ -159,6 +159,12 @@ and [Discussions](https://github.com/CelticBoozer/nvim-config/discussions). 1. Type (feat:): Indicates the type of change. Common types include: +- revert: If the commit reverts a previous commit. In the body it should say: + `This reverts commit `. +- build: Changes that affect the build system or external dependencies (example + scopes: gulp, broccoli, npm) +- ci: Changes to our CI configuration files and scripts (example scopes: Circle, + GitHub Actions) - feat: A new feature - fix: A bug fix - docs: Documentation changes diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md diff --git a/README.md b/README.md index 51576cf..3744273 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,11 @@ ## Deps -npm, Java, luarocks, python3, deno +npm - +Java last version +luarocks - lazy +git - lazy, +Nerd fonts - lazy, whichkey +python3 +deno +rg - lspsaga, diff --git a/init.lua b/init.lua index d410aed..88ba3bf 100644 --- a/init.lua +++ b/init.lua @@ -1,44 +1,4 @@ --- lazy.nvim package manager installation -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - ---Core require("core.options") +require("plugin.lazy") -local opts = { - defaults = { - lazy = false, - version = "*", - cond = nil, - }, - dev = { - path = "~/Development/Projects", - }, - install = { - missing = true, - colorscheme = { "gruvbox-materal" }, - }, - ui = { - border = "rounded", - }, -} - -local plugins = { - { import = "plugin.editor" }, - { import = "plugin.lsp" }, - { import = "plugin.ui" }, - { import = "plugin.util" }, -} - -require("lazy").setup(plugins, opts) require("telescope").load_extension("media_files") diff --git a/lazy-lock.json b/lazy-lock.json index 7974139..62e9674 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,50 +1,56 @@ { - "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" }, - "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "acc7337cfd24ddfa3109bfc8c258c09c88c5c450" }, - "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" }, + "dashboard-nvim": { "branch": "master", "commit": "000448d837f6e7a47f8f342f29526c4d7e49e9ce" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "fine-cmdline.nvim": { "branch": "main", "commit": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e" }, - "gruvbox-material": { "branch": "master", "commit": "30e9f4b0fa24c25980df1690a8c47c36e40b6673" }, - "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, - "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, - "lsp-progress.nvim": { "branch": "main", "commit": "d5f4d28efe75ce636bfbe271eb45f39689765aab" }, - "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, - "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, - "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, - "neo-tree.nvim": { "branch": "main", "commit": "8c75e8a2949cd6cd35525799200a8d34471ee9eb" }, - "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, - "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, - "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, - "nvim-bqf": { "branch": "main", "commit": "654c904d5ad9dc4846445056086168e25bd8ba2d" }, - "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" }, + "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" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" }, + "lsp_signature.nvim": { "branch": "master", "commit": "02629e5bc38f6cb1a49bb43ff4a441f23335a933" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lspsaga.nvim": { "branch": "main", "commit": "6063935cf68de9aa6dd79f8e1caf5df0a9385de3" }, + "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "5639d58a3d11ff7c05c8e31e159bfedae55d7961" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" }, + "neo-tree.nvim": { "branch": "main", "commit": "40dd57777a96d0728f6758874b141f409466e2da" }, + "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, + "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, + "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" }, - "nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" }, - "nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" }, - "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "6b5f95aa4d24f2c629a74f2c935c702b08dbde62" }, - "nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" }, - "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "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-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" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, - "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "a727bd368e70808125b7cf589328cc595faf3d5a" }, - "statuscol.nvim": { "branch": "main", "commit": "93d8bcda516fc86e11c03f9ef577bae9a72fba0e" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "c2255b20bb1accb0e83e70f995adf99b78dee13d" }, + "reactive.nvim": { "branch": "master", "commit": "e0a22a42811ca1e7aa7531f931c55619aad68b5d" }, + "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": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "313b04e5b02d29ab9275c9295ff5e2b73921b0eb" }, - "trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" }, - "wf.nvim": { "branch": "main", "commit": "d7de32119e933ddd4c006324475d487c87b8d80b" } + "telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" }, + "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" }, + "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, + "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 5e49d8b..a86fef7 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -49,3 +49,9 @@ vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decr 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 } +}) diff --git a/lua/plugin/editor/reactive.lua b/lua/plugin/editor/reactive.lua new file mode 100644 index 0000000..306a501 --- /dev/null +++ b/lua/plugin/editor/reactive.lua @@ -0,0 +1,10 @@ +return { + "rasulomaroff/reactive.nvim", + opts = { + builtin = { + cursorline = true, + cursor = true, + modemsg = true, + }, + }, +} diff --git a/lua/plugin/editor/tiny-devicons-auto-colors.lua b/lua/plugin/editor/tiny-devicons-auto-colors.lua new file mode 100644 index 0000000..70591f7 --- /dev/null +++ b/lua/plugin/editor/tiny-devicons-auto-colors.lua @@ -0,0 +1,24 @@ +-- INFO: updates nvim-web-devicons colors based on colorscheme. +return { + "rachartier/tiny-devicons-auto-colors.nvim", + event = "VeryLazy", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + 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/lazy.lua b/lua/plugin/lazy.lua new file mode 100644 index 0000000..29f710d --- /dev/null +++ b/lua/plugin/lazy.lua @@ -0,0 +1,37 @@ +-- INFO: Plugin manager +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 = "plugin.editor" }, + { import = "plugin.lsp" }, + { import = "plugin.theme" }, + { import = "plugin.util" }, + }, + checker = { enabled = true }, + dev = { path = "~/Development/Projects" }, + install = { colorscheme = { "gruvbox-materal" } }, + ui = { border = "rounded" }, +}) diff --git a/lua/plugin/lsp/bqf.lua b/lua/plugin/lsp/bqf.lua deleted file mode 100644 index ef0084f..0000000 --- a/lua/plugin/lsp/bqf.lua +++ /dev/null @@ -1,6 +0,0 @@ --- INFO: better quick fix windows -return { - "kevinhwang91/nvim-bqf", - lazy = true, - opts = {}, -} diff --git a/lua/plugin/lsp/fidget.lua b/lua/plugin/lsp/fidget.lua new file mode 100644 index 0000000..0ac1532 --- /dev/null +++ b/lua/plugin/lsp/fidget.lua @@ -0,0 +1,24 @@ +-- 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/inc-rename.lua b/lua/plugin/lsp/inc-rename.lua new file mode 100644 index 0000000..8ed3e95 --- /dev/null +++ b/lua/plugin/lsp/inc-rename.lua @@ -0,0 +1,15 @@ +-- NOTE: Interactive LSP rename with preview + +return { + "smjonas/inc-rename.nvim", + event = "BufReadPre", + dependencies = { + "stevearc/dressing.nvim" + }, + keys = { + { "rn", ":IncRename ", desc = "Rename symbol" }, + }, + opts = { + input_buffer_type = "dressing", -- Use dressing.nvim if available + }, +} diff --git a/lua/plugin/lsp/lint.lua b/lua/plugin/lsp/lint.lua index 7f591d3..b554cb3 100644 --- a/lua/plugin/lsp/lint.lua +++ b/lua/plugin/lsp/lint.lua @@ -1,7 +1,7 @@ --- INFO: linter +-- NOTE: Provides linting support for various filetypes + return { "mfussenegger/nvim-lint", - lazy = false, event = { "BufReadPre", "BufNewFile" }, keys = { { @@ -9,13 +9,11 @@ return { function() require("lint").try_lint() end, - desc = "lint file", + desc = "Lint file", }, }, - config = function() - local lint = require("lint") - - lint.linters_by_ft = { + opts = { + linters_by_ft = { python = { "ruff" }, lua = { "luacheck" }, dockerfile = { "hadolint" }, @@ -29,7 +27,12 @@ return { java = { "checkstyle" }, sql = { "sqlfluff" }, markdown = { "markdownlint" }, - } + }, + }, + config = function(_, opts) + local lint = require("lint") + + lint.linters_by_ft = opts.linters_by_ft local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) @@ -37,6 +40,7 @@ return { group = lint_augroup, callback = function() lint.try_lint() + lint.try_lint("cspell") -- Ensure cspell is always run end, }) end, diff --git a/lua/plugin/lsp/lsp_signature.lua b/lua/plugin/lsp/lsp_signature.lua new file mode 100644 index 0000000..841e877 --- /dev/null +++ b/lua/plugin/lsp/lsp_signature.lua @@ -0,0 +1,14 @@ +-- NOTE: Show function signatures as you type for better LSP experience + +return { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = { + bind = true, + hint_enable = true, + floating_window = true, + handler_opts = { + border = "rounded", + }, + }, +} diff --git a/lua/plugin/lsp/lspconfig.lua b/lua/plugin/lsp/lspconfig.lua index f939086..baeb5ec 100644 --- a/lua/plugin/lsp/lspconfig.lua +++ b/lua/plugin/lsp/lspconfig.lua @@ -1,141 +1,67 @@ --- INFO: LSP configuration --- luacheck:ignore 212 +-- NOTE: Configure Language Server Protocol (LSP) support in Neovim +-- Provides auto-completion, diagnostics, and language-specific features + return { "neovim/nvim-lspconfig", - lazy = false, event = { "BufReadPre", "BufNewFile" }, - config = function() - require("lspconfig.ui.windows").default_options.border = "rounded" - vim.api.nvim_set_hl(0, "LspInfoBorder", { fg = "#d4be98" }) - local lspconfig = require("lspconfig") - local keymap = vim.keymap - local opts = { noremap = true, silent = true } - local on_attach = function(client, bufnr) - opts.buffer = bufnr - - -- set keybinds - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references - - opts.desc = "Go to declaration" - keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration - - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions - - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations - - opts.desc = "See available code actions" - keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions - - opts.desc = "Smart rename" - keymap.set("n", "r", vim.lsp.buf.rename, opts) -- smart rename + dependencies = { + "hrsh7th/cmp-nvim-lsp", + }, + keys = {}, + opts = { + -- Default capabilities with folding support + capabilities = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + } + return capabilities + end, - opts.desc = "Go to previous diagnostic" - keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + -- Diagnostic signs + signs = { + Error = "", + Warn = "", + Hint = "", + Info = "", + }, - opts.desc = "Go to next diagnostic" - keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer - - opts.desc = "Show documentation for what is under cursor" - keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor - - opts.desc = "Restart LSP" - keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary - end - - -- local capabilities = vim.lsp.protocol.make_client_capabilities() - local capabilities = require("cmp_nvim_lsp").default_capabilities() - capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true, - } - - local signs = { Error = "", Warn = "", Hint = "", Info = "" } - for type, icon in pairs(signs) do + -- List of LSP servers to configure + servers = { + lua_ls = {}, + marksman = {}, + dockerls = {}, + docker_compose_language_service = {}, + bashls = {}, + jsonls = {}, + yamlls = {}, + taplo = {}, + html = {}, + cssls = {}, + eslint = {}, + ts_ls = {}, + jdtls = {}, + groovyls = {}, + sqlls = {}, + lemminx = {}, + }, + }, + config = function(_, opts) + -- Set 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 - lspconfig.ruff_lsp.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.lua_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { - "vim", - "require", - }, - }, - }, - }, - }) - lspconfig.marksman.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.dockerls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.docker_compose_language_service.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.bashls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.jsonls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.yamlls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.taplo.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.html.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.cssls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.eslint.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.tsserver.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.jdtls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.groovyls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.sqlls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - lspconfig.lemminx.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) + -- Set up LSP servers + local lspconfig = require("lspconfig") + local capabilities = opts.capabilities() + + for server, server_opts in pairs(opts.servers) do + lspconfig[server].setup(vim.tbl_deep_extend("force", { + capabilities = capabilities, + }, server_opts)) + end end, } diff --git a/lua/plugin/lsp/lspsaga.lua b/lua/plugin/lsp/lspsaga.lua new file mode 100644 index 0000000..a169d3f --- /dev/null +++ b/lua/plugin/lsp/lspsaga.lua @@ -0,0 +1,40 @@ +-- NOTE: Enhance LSP experience with UI improvements and additional features + +return { + "nvimdev/lspsaga.nvim", + 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" }, + }, + opts = { + ui = { code_action = "" }, + finder = { + keys = { + vsplit = "S", + }, + }, + outline = { + keys = { + jump = "", + }, + }, + rename = { + keys = { + quit = "q", + }, + }, + }, +} diff --git a/lua/plugin/lsp/mason.lua b/lua/plugin/lsp/mason.lua index 25c85d3..5978b6c 100644 --- a/lua/plugin/lsp/mason.lua +++ b/lua/plugin/lsp/mason.lua @@ -1,4 +1,4 @@ --- INFO: LSP install tool configuration +-- INFO: LSP install tool return { "williamboman/mason.nvim", lazy = false, @@ -25,7 +25,6 @@ return { mason_lspconfig.setup({ ensure_installed = { - "ruff_lsp", -- Python LSP "lua_ls", "marksman", "dockerls", @@ -37,7 +36,7 @@ return { "html", "cssls", "eslint", - "tsserver", + "ts_ls", "jdtls", "groovyls", "sqlls", @@ -60,6 +59,7 @@ return { "checkstyle", "sqlfluff", "markdownlint", + "cspell", -- spell check -- Formatters "ruff", -- Python formatter diff --git a/lua/plugin/lsp/nvim-jdtls.lua b/lua/plugin/lsp/nvim-jdtls.lua new file mode 100644 index 0000000..3ccc364 --- /dev/null +++ b/lua/plugin/lsp/nvim-jdtls.lua @@ -0,0 +1,30 @@ +-- 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/trouble.lua b/lua/plugin/lsp/trouble.lua deleted file mode 100644 index 3ac1630..0000000 --- a/lua/plugin/lsp/trouble.lua +++ /dev/null @@ -1,19 +0,0 @@ --- INFO: pretty LSP diagnostics plugin -return { - "folke/trouble.nvim", - lazy = true, - dependencies = { "nvim-tree/nvim-web-devicons" }, -- Just pretty icons - keys = { - { "td", ":Trouble diagnostics", desc = "trouble diagnostics document" }, - { "tr", ":Trouble lsp_references", desc = "references" }, - { "tR", ":Trouble lsp_definitions", desc = "definition" }, - }, - opts = { - action_keys = { - open_split = { "" }, -- open buffer in new split - open_vsplit = { "" }, -- open buffer in new vsplit - open_tab = { "" }, - }, - win_config = { border = "rounded" }, - }, -} diff --git a/lua/plugin/ui/bufferline.lua b/lua/plugin/theme/bufferline.lua similarity index 100% rename from lua/plugin/ui/bufferline.lua rename to lua/plugin/theme/bufferline.lua diff --git a/lua/plugin/ui/colorizer.lua b/lua/plugin/theme/colorizer.lua similarity index 100% rename from lua/plugin/ui/colorizer.lua rename to lua/plugin/theme/colorizer.lua diff --git a/lua/plugin/ui/colorscheme.lua b/lua/plugin/theme/colorscheme.lua similarity index 100% rename from lua/plugin/ui/colorscheme.lua rename to lua/plugin/theme/colorscheme.lua diff --git a/lua/plugin/ui/lualine.lua b/lua/plugin/theme/lualine.lua similarity index 93% rename from lua/plugin/ui/lualine.lua rename to lua/plugin/theme/lualine.lua index 6591d3c..364c11d 100644 --- a/lua/plugin/ui/lualine.lua +++ b/lua/plugin/theme/lualine.lua @@ -4,7 +4,6 @@ return { lazy = false, dependencies = { "nvim-tree/nvim-web-devicons", -- Just pretty icons - "linrongbin16/lsp-progress.nvim", -- To check LSP progress }, opts = { options = { @@ -57,7 +56,6 @@ return { newfile = "[New]", }, }, - require("lsp-progress").progress, }, lualine_x = { { diff --git a/lua/plugin/ui/statuscol.lua b/lua/plugin/theme/statuscol.lua similarity index 100% rename from lua/plugin/ui/statuscol.lua rename to lua/plugin/theme/statuscol.lua diff --git a/lua/plugin/ui/neoscroll.lua b/lua/plugin/ui/neoscroll.lua deleted file mode 100644 index 632cefd..0000000 --- a/lua/plugin/ui/neoscroll.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "karb94/neoscroll.nvim", - lazy = true, - opts = {}, -} diff --git a/lua/plugin/util/peek.lua b/lua/plugin/util/peek.lua index d2f2218..5d7d96c 100644 --- a/lua/plugin/util/peek.lua +++ b/lua/plugin/util/peek.lua @@ -5,7 +5,6 @@ return { event = { "VeryLazy" }, config = function() vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) - vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) end, build = "deno task --quiet build:fast", } diff --git a/lua/plugin/util/wf.lua b/lua/plugin/util/wf.lua deleted file mode 100644 index 2a05ac8..0000000 --- a/lua/plugin/util/wf.lua +++ /dev/null @@ -1,67 +0,0 @@ --- INFO: which-key plugin -return { - "Cassin01/wf.nvim", - lazy = true, - config = function() - local which_key = require("wf.builtin.which_key") - local register = require("wf.builtin.register") - local bookmark = require("wf.builtin.bookmark") - local buffer = require("wf.builtin.buffer") - local mark = require("wf.builtin.mark") - - -- Register - vim.keymap.set( - "n", - "wr", - -- register(opts?: table) -> function - -- opts?: option - register(), - { noremap = true, silent = true, desc = "[wf.nvim] register" } - ) - - -- Bookmark - vim.keymap.set( - "n", - "wbo", - -- bookmark(bookmark_dirs: table, opts?: table) -> function - -- bookmark_dirs: directory or file paths - -- opts?: option - bookmark({ - nvim = "~/.config/nvim", - zsh = "~/.zshrc", - }), - { noremap = true, silent = true, desc = "[wf.nvim] bookmark" } - ) - - -- Buffer - vim.keymap.set( - "n", - "wbu", - -- buffer(opts?: table) -> function - -- opts?: option - buffer(), - { noremap = true, silent = true, desc = "[wf.nvim] buffer" } - ) - - -- Mark - vim.keymap.set( - "n", - "'", - -- mark(opts?: table) -> function - -- opts?: option - mark(), - { nowait = true, noremap = true, silent = true, desc = "[wf.nvim] mark" } - ) - - -- Which Key - vim.keymap.set( - "n", - "", - -- mark(opts?: table) -> function - -- opts?: option - which_key({ text_insert_in_advance = "" }), - { noremap = true, silent = true, desc = "[wf.nvim] which-key /" } - ) - require("wf").setup() - end, -} diff --git a/lua/plugin/util/which-key.lua b/lua/plugin/util/which-key.lua new file mode 100644 index 0000000..9398453 --- /dev/null +++ b/lua/plugin/util/which-key.lua @@ -0,0 +1,26 @@ +return { + "folke/which-key.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + "echasnovski/mini.icons", + }, + keys = { + { + "", + ":WhichKey", + desc = "Buffer Local Keymaps (which-key)", + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + + wk.register({ + [""] = { + f = { + name = "Find", + } + } + }) + end, +}