From be6d52c586eea9ed1d9e5db020ba1265cdfbb84c Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 20 Oct 2025 20:38:17 -0400 Subject: [PATCH] refactor(nvim): simplify lazy loading configuration --- lazy-lock.json | 6 ++++-- lua/community.lua | 3 --- lua/config/terminals.lua | 13 ------------- lua/plugins/astrocore.lua | 1 - lua/plugins/astrolsp.lua | 20 +++----------------- lua/plugins/claude.lua | 24 ++++++++++++++++++++++++ lua/plugins/linting.lua | 34 ++++++++++++++-------------------- lua/plugins/neotree.lua | 19 +++++++++++++++++++ lua/plugins/tsx.lua | 10 ---------- 9 files changed, 64 insertions(+), 66 deletions(-) create mode 100644 lua/plugins/claude.lua diff --git a/lazy-lock.json b/lazy-lock.json index f01fd48..e56cb34 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -15,6 +15,7 @@ "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "chezmoi.nvim": { "branch": "main", "commit": "8b426285c2b0acb9b0dd46789193fa97f6480b99" }, "chezmoi.vim": { "branch": "main", "commit": "ca5f2ed602046d5662cb76d845c4b510aae0ce84" }, + "claudecode.nvim": { "branch": "main", "commit": "1552086ebcce9f4a2ea3b9793018a884d6b60169" }, "cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" }, "conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" }, "crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" }, @@ -33,11 +34,11 @@ "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" }, "lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" }, "neo-tree.nvim": { "branch": "main", "commit": "20244beec28b9d79ffb75fe1b1606f4dd8d476fc" }, "neoconf.nvim": { "branch": "main", "commit": "f630568a4d04154803886f21ca60923f12709f0f" }, @@ -73,6 +74,7 @@ "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, "schemastore.nvim": { "branch": "main", "commit": "e71cc0607284739892287f6a2d92753999179dcf" }, "smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" }, + "snacks.nvim": { "branch": "main", "commit": "bebf0bd38e3e7071abc4085ad46f1ebc32cdfe17" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "master", "commit": "a17d611a0e111836a1db5295f04945df407c5135" }, diff --git a/lua/community.lua b/lua/community.lua index c4eafc8..30c35a2 100644 --- a/lua/community.lua +++ b/lua/community.lua @@ -8,7 +8,6 @@ return { version = false, -- Use latest astrocommunity { import = "astrocommunity.pack.astro" }, { import = "astrocommunity.pack.bash" }, - { import = "astrocommunity.pack.biome" }, { import = "astrocommunity.pack.chezmoi" }, { import = "astrocommunity.pack.lua" }, { import = "astrocommunity.pack.markdown" }, @@ -18,7 +17,6 @@ return { { import = "astrocommunity.pack.golangci-lint" }, { import = "astrocommunity.pack.html-css" }, { import = "astrocommunity.pack.oxlint" }, - { import = "astrocommunity.pack.prettier" }, { import = "astrocommunity.pack.toml" }, { import = "astrocommunity.pack.templ" }, { import = "astrocommunity.pack.tailwindcss" }, @@ -26,7 +24,6 @@ return { { import = "astrocommunity.pack.yaml" }, { import = "astrocommunity.utility.noice-nvim" }, { import = "astrocommunity.git.octo-nvim" }, - { import = "astrocommunity.programming-langauge-support.kuala-nvim" }, { import = "astrocommunity.bars-and-lines.bufferline-nvim" }, { import = "astrocommunity.code-runner.overseer-nvim" }, { import = "astrocommunity.completion.supermaven-nvim" }, diff --git a/lua/config/terminals.lua b/lua/config/terminals.lua index 2656952..5244e83 100644 --- a/lua/config/terminals.lua +++ b/lua/config/terminals.lua @@ -20,18 +20,6 @@ function M.setup() end local Terminal = require("toggleterm.terminal").Terminal - - -- Claude terminal configuration - local claude = Terminal:new { - cmd = "claude --dangerously-skip-permissions", - hidden = true, - direction = "vertical", - close_on_exit = true, - on_open = function(term) - vim.cmd "startinsert!" - vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", { noremap = true, silent = true }) - end, - } -- Scooter find and replace terminal local smartCommit = Terminal:new { cmd = "smartcommit", @@ -79,7 +67,6 @@ function M.setup() } -- Export toggle functions to module instead of global namespace - M.claude_toggle = function() claude:toggle() end M.scooter_toggle = function() scooter:toggle() end M.mk_toggle = function() mk:toggle() end M.lazygit_toggle = function() lazygit:toggle() end diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index cbb193d..7f2dd9a 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -403,7 +403,6 @@ return { desc = "Find Service files", }, -- AI/Assistant mappings - [""] = { terminals.claude_toggle, desc = "Claude Toggle" }, [""] = { terminals.mk_toggle, desc = "Taskfile Toggle" }, }, i = { diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index e201cd7..990be13 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -43,11 +43,10 @@ return { "lua", }, }, - -- Disable LSP formatting for these (use conform.nvim/biome instead) + -- Disable LSP formatting for these (use conform.nvim/oxfmt instead) disabled = { - "tsserver", -- Use biome/prettier via conform - "vtsls", -- Use biome/prettier via conform - "eslint", -- Diagnostics only, not formatting + "tsserver", -- Use oxfmt via conform + "vtsls", -- Use oxfmt via conform "html", -- Use conform "cssls", -- Use conform "tailwindcss", -- Doesn't format @@ -177,19 +176,6 @@ return { }, }, - -- ESLint configuration - eslint = { - settings = { - workingDirectories = { mode = "auto" }, - format = false, -- Don't use ESLint for formatting - }, - on_attach = function(client, bufnr) - -- Disable formatting capability (use conform.nvim) - client.server_capabilities.documentFormattingProvider = false - client.server_capabilities.documentRangeFormattingProvider = false - end, - }, - -- Tailwind for React components tailwindcss = { settings = { diff --git a/lua/plugins/claude.lua b/lua/plugins/claude.lua new file mode 100644 index 0000000..9e063c1 --- /dev/null +++ b/lua/plugins/claude.lua @@ -0,0 +1,24 @@ +return { + "coder/claudecode.nvim", + dependencies = { "folke/snacks.nvim" }, + config = true, + keys = { + { "", nil, desc = "AI/Claude Code" }, + { "", "ClaudeCode", desc = "Toggle Claude" }, + { "f", "ClaudeCodeFocus", desc = "Focus Claude" }, + { "C", "ClaudeCode --resume", desc = "Resume Claude" }, + { "c", "ClaudeCode --continue", desc = "Continue Claude" }, + { "m", "ClaudeCodeSelectModel", desc = "Select Claude model" }, + { "b", "ClaudeCodeAdd %", desc = "Add current buffer" }, + { "", "ClaudeCodeSend", mode = "v", desc = "Send to Claude" }, + { + "", + "ClaudeCodeTreeAdd", + desc = "Add file", + ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" }, + }, + -- Diff management + { "y", "ClaudeCodeDiffAccept", desc = "Accept diff" }, + { "n", "ClaudeCodeDiffDeny", desc = "Deny diff" }, + }, +} diff --git a/lua/plugins/linting.lua b/lua/plugins/linting.lua index 96c6bdc..1db7200 100644 --- a/lua/plugins/linting.lua +++ b/lua/plugins/linting.lua @@ -1,5 +1,5 @@ --- Linting and formatting configuration ---- Includes oxlint, prettier, and ESLint integration +--- Includes oxlint and oxfmt integration --- @module plugins.linting return { @@ -10,17 +10,17 @@ return { cmd = { "ConformInfo" }, opts = { formatters_by_ft = { - typescript = { "prettier" }, - typescriptreact = { "prettier" }, - javascript = { "prettier" }, - javascriptreact = { "prettier" }, - json = { "prettier" }, - jsonc = { "prettier" }, - css = { "prettier" }, - scss = { "prettier" }, - html = { "prettier" }, - markdown = { "prettier" }, - yaml = { "prettier" }, + typescript = { "oxfmt" }, + typescriptreact = { "oxfmt" }, + javascript = { "oxfmt" }, + javascriptreact = { "oxfmt" }, + json = { "oxfmt" }, + jsonc = { "oxfmt" }, + css = { "oxfmt" }, + scss = { "oxfmt" }, + html = { "oxfmt" }, + markdown = { "oxfmt" }, + yaml = { "oxfmt" }, lua = { "stylua" }, rust = { "rustfmt" }, toml = { "taplo" }, @@ -34,11 +34,7 @@ return { } end, formatters = { - prettier = { - prepend_args = { - "--plugin=prettier-plugin-tailwindcss", - }, - }, + -- oxfmt uses default configuration }, }, config = function(_, opts) @@ -136,15 +132,13 @@ return { opts = { ensure_installed = { -- Formatters - "prettier", "stylua", "rustfmt", "taplo", -- Linters - "eslint_d", "stylelint", "markdownlint", - -- Note: oxlint should be installed via cargo/npm separately + -- Note: oxlint and oxfmt should be installed via cargo/npm separately }, auto_update = false, run_on_start = true, diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 636db7d..bbf00d4 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -167,6 +167,25 @@ return { -- These Find keybindings are defined in astrocore.lua -- NeoTree only needs the basic navigation and terminal bindings -- Mappings for Mason and formatting + ["N"] = function(state) + local node = state.tree:get_node() + local path = node.type == "directory" and node.path or vim.fn.fnamemodify(node.path, ":h") + + -- Check if running on Arch Linux + local is_arch = vim.fn.filereadable("/etc/arch-release") == 1 + + if is_arch then + -- Use uwsm to launch alacritty with yazi on Arch Linux + vim.fn.jobstart(string.format("uwsm app -- alacritty --working-directory %s -e yazi", vim.fn.shellescape(path)), { + detach = true, + }) + else + -- Fallback to direct alacritty launch with yazi on other systems + vim.fn.jobstart(string.format("alacritty --working-directory %s -e yazi", vim.fn.shellescape(path)), { + detach = true, + }) + end + end, }, header = { highlight = "NeoTreeHeader", diff --git a/lua/plugins/tsx.lua b/lua/plugins/tsx.lua index 526f3f4..3ef11de 100644 --- a/lua/plugins/tsx.lua +++ b/lua/plugins/tsx.lua @@ -74,15 +74,6 @@ return { html = { filetypes = { "html", "typescriptreact", "javascriptreact" }, }, - -- ESLint LSP - eslint = { - settings = { - workingDirectories = { mode = "auto" }, - experimental = { - useFlatConfig = true, - }, - }, - }, }, }, }, @@ -196,7 +187,6 @@ return { "tailwindcss", "cssls", "html", - "eslint", "jsonls", }) end,