From a87e5ea4f5d1b2e390d08d75ca51b5ef6ee31989 Mon Sep 17 00:00:00 2001 From: Fahd Shalhoub Date: Tue, 6 Oct 2026 12:49:41 +0300 Subject: [PATCH] UPDATE --- lazy-lock.json | 7 ++++ lazyvim.json | 5 ++- lua/config/lsp.lua | 7 ++++ lua/plugins/go.lua | 41 ++++++++++++++++++++ lua/plugins/projects.lua | 77 +++++++++++++++++++++++++++++++++++++ lua/plugins/refactoring.lua | 28 ++++++++++++++ 6 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 lua/config/lsp.lua create mode 100644 lua/plugins/go.lua create mode 100644 lua/plugins/projects.lua create mode 100644 lua/plugins/refactoring.lua diff --git a/lazy-lock.json b/lazy-lock.json index cebae18..9712269 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,11 +1,13 @@ { "LazyVim": { "branch": "main", "commit": "83d90f339defdb109a6ede333865a66ffc7ef6aa" }, "SchemaStore.nvim": { "branch": "main", "commit": "6ff1f21b2e2b77ec59f7433ce2d9fbc052d908ac" }, + "async.nvim": { "branch": "main", "commit": "15f28ec323a75f34f317336831c00c2d1b0a7192" }, "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "catppuccin": { "branch": "main", "commit": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c" }, "claudecode.nvim": { "branch": "main", "commit": "288c9bf8834e5d7e401d1485fb5f684b1c2d7c72" }, "conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "gitsigns.nvim": { "branch": "main", "commit": "eb60cc7b94c46005237fd34170d76f3a089a90aa" }, @@ -36,8 +38,13 @@ "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, + "project_nvim": { "branch": "main", "commit": "c12d3935c4492dab2f8c2e26c4e1ee61f3d34ad4" }, + "refactoring.nvim": { "branch": "master", "commit": "64e10d782ae5b9653558482910213b8946651456" }, "render-markdown.nvim": { "branch": "main", "commit": "f422cb5c6855f150e2ddcfaf44e7157b98b34f6a" }, "snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, + "telescope.nvim": { "branch": "master", "commit": "40aedd8a68c78a656a10a8d62d80c54af59420fb" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, diff --git a/lazyvim.json b/lazyvim.json index e405ea5..9bb1514 100644 --- a/lazyvim.json +++ b/lazyvim.json @@ -1,6 +1,8 @@ { "extras": [ "lazyvim.plugins.extras.ai.claudecode", + "lazyvim.plugins.extras.editor.refactoring", + "lazyvim.plugins.extras.editor.telescope", "lazyvim.plugins.extras.lang.docker", "lazyvim.plugins.extras.lang.git", "lazyvim.plugins.extras.lang.go", @@ -19,7 +21,8 @@ "lazyvim.plugins.extras.lang.typescript.tsgo", "lazyvim.plugins.extras.lang.typescript.vtsls", "lazyvim.plugins.extras.lang.yaml", - "lazyvim.plugins.extras.test.core" + "lazyvim.plugins.extras.test.core", + "lazyvim.plugins.extras.util.project" ], "install_version": 8, "news": { diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..53b19c3 --- /dev/null +++ b/lua/config/lsp.lua @@ -0,0 +1,7 @@ +require("lspconfig").gopls.setup({ + settings = { + gopls = { + buildFlags = { "-tags=unit,integration" }, + }, + }, +}) diff --git a/lua/plugins/go.lua b/lua/plugins/go.lua new file mode 100644 index 0000000..459f08c --- /dev/null +++ b/lua/plugins/go.lua @@ -0,0 +1,41 @@ +return { + { + "neovim/nvim-lspconfig", + opts = { + servers = { + gopls = { + settings = { + gopls = { + buildFlags = { "-tags=unit,integration" }, + }, + }, + }, + }, + setup = { + -- Override LazyVim's gopls semanticTokens workaround, which crashes on + -- Neovim 0.12 because the gopls client's config.capabilities has no + -- `textDocument` field (go.lua:60). Guard against the nil. + gopls = function(_, _) + Snacks.util.lsp.on({ name = "gopls" }, function(_, client) + if client.server_capabilities.semanticTokensProvider then + return + end + local caps = client.config.capabilities or {} + local semantic = caps.textDocument and caps.textDocument.semanticTokens + if not semantic then + return + end + client.server_capabilities.semanticTokensProvider = { + full = true, + legend = { + tokenTypes = semantic.tokenTypes, + tokenModifiers = semantic.tokenModifiers, + }, + range = true, + } + end) + end, + }, + }, + }, +} diff --git a/lua/plugins/projects.lua b/lua/plugins/projects.lua new file mode 100644 index 0000000..1b7a68c --- /dev/null +++ b/lua/plugins/projects.lua @@ -0,0 +1,77 @@ +-- Custom project picker: selecting a project changes the working directory +-- and restores that project's last session (open buffers/windows) via +-- persistence.nvim. It does NOT open a file search afterwards (the default +-- LazyVim `util.project` behaviour opens `find_files` on select). +local function pick_project_cd() + local pickers = require("telescope.pickers") + local finders = require("telescope.finders") + local conf = require("telescope.config").values + local actions = require("telescope.actions") + local state = require("telescope.actions.state") + local history = require("project_nvim.utils.history") + local project = require("project_nvim.project") + + local results = history.get_recent_projects() + -- Show most recent projects first. + for i = 1, math.floor(#results / 2) do + results[i], results[#results - i + 1] = results[#results - i + 1], results[i] + end + + pickers + .new({}, { + prompt_title = "Recent Projects (cd only)", + finder = finders.new_table({ + results = results, + entry_maker = function(entry) + local name = vim.fn.fnamemodify(entry, ":t") + return { + value = entry, + display = string.format("%-30s %s", name, entry), + ordinal = name .. " " .. entry, + } + end, + }), + previewer = false, + sorter = conf.generic_sorter({}), + attach_mappings = function(prompt_bufnr) + actions.select_default:replace(function() + local entry = state.get_selected_entry() + actions.close(prompt_bufnr) + if not entry then + return + end + if project.set_pwd(entry.value, "telescope") then + vim.notify("Changed project dir to " .. entry.value) + -- Restore the last session (open buffers/windows) for this dir. + local ok, persistence = pcall(require, "persistence") + if ok then + persistence.load() + end + end + end) + return true + end, + }) + :find() +end + +return { + -- This overrides the repository source for the built-in LazyVim extra + { + "ahmedkhalf/project.nvim", + name = "project_nvim", -- Keeps internal naming intact + url = "https://github.com/DrKJeff16/project.nvim", -- Directs lazy.nvim to download the fork + opts = { + manual_mode = false, -- Prevents root changing unexpectedly on every single file open + }, + }, + + -- Override fp so it only cd's into the project. + { + "nvim-telescope/telescope.nvim", + optional = true, + keys = { + { "fp", pick_project_cd, desc = "Projects (cd only)" }, + }, + }, +} diff --git a/lua/plugins/refactoring.lua b/lua/plugins/refactoring.lua new file mode 100644 index 0000000..ffbdb2c --- /dev/null +++ b/lua/plugins/refactoring.lua @@ -0,0 +1,28 @@ +return { + -- The newer refactoring.nvim (Neovim 0.12+) replaced its plenary dependency + -- with lewis6991/async.nvim. The LazyVim extra doesn't declare it yet, so add + -- it here to fix `module 'async' not found`. + -- + -- It also removed the bundled Telescope extension (`telescope._extensions.refactoring`), + -- so we override the extra's `config` and `rs` keymap to use the + -- built-in `select_refactor()` (vim.ui.select) instead of the missing extension. + { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "lewis6991/async.nvim", + }, + config = function(_, opts) + require("refactoring").setup(opts) + end, + keys = { + { + "rs", + function() + require("refactoring").select_refactor() + end, + mode = { "n", "x" }, + desc = "Refactor", + }, + }, + }, +}