diff --git a/.gitignore b/.gitignore index dfeb471..1bfeacb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /undodir .DS_Store +.nvimlog diff --git a/README.md b/README.md index 40ec2af..365b3e9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,49 @@ -### config +# nvim -```bash -curl -fsSL https://raw.githubusercontent.com/harivansh-afk/nvim/main/install.sh | bash +## Repo tree + +```text +. +├── init.lua +├── install.sh +├── lazy-lock.json +├── lua +│ ├── chadrc.lua +│ └── plugins +│ ├── arrow.lua +│ ├── autopairs.lua +│ ├── comment.lua +│ ├── dashboard.lua +│ ├── flash.lua +│ ├── git.lua +│ ├── gitsigns.lua +│ ├── gutentags.lua +│ ├── lsp.lua +│ ├── neo-tree.lua +│ ├── nvchad.lua +│ ├── supermaven.lua +│ ├── telescope.lua +│ ├── treesitter.lua +│ └── which-key.lua +└── nvim_cheatsheet.md ``` + +## Plugins (and why) + +- `folke/lazy.nvim`: plugin manager. +- `nvchad/base46`: colors/theme engine. +- `nvchad/ui`: statusline/tabline/UI pieces. +- `nvim-telescope/telescope.nvim`: fuzzy find + grep. +- `nvim-treesitter/nvim-treesitter`: better syntax highlight/indent. +- `neovim/nvim-lspconfig` + `williamboman/mason.nvim`: LSP + install servers. +- `nvim-neo-tree/neo-tree.nvim`: file explorer. +- `nvimdev/dashboard-nvim`: startup dashboard. +- `folke/which-key.nvim`: keybind hint popup. +- `numToStr/Comment.nvim`: quick commenting. +- `windwp/nvim-autopairs`: auto-close brackets/quotes. +- `folke/flash.nvim`: fast motions/jumps. +- `lewis6991/gitsigns.nvim`: git hunks in-buffer. +- `NeogitOrg/neogit` + `sindrets/diffview.nvim`: git UI + diffs/history. +- `ludovicchabant/vim-gutentags`: ctags-based fallback navigation. +- `supermaven-inc/supermaven-nvim`: AI inline suggestions. +- `otavioschwanck/arrow.nvim`: quick file marks/jumps. diff --git a/lazy-lock.json b/lazy-lock.json index d9ab5e8..34db427 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,16 +1,12 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" }, - "avante.nvim": { "branch": "main", "commit": "a9e9890fc620c46e39bc22c0ccea5d57beefc0e7" }, "base46": { "branch": "v3.0", "commit": "45b336ec52615dd1a3aa47848d894616dd6293a5" }, "dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "gitsigns.nvim": { "branch": "main", "commit": "130beacf8a51f00aede9c31064c749136679a321" }, - "img-clip.nvim": { "branch": "main", "commit": "b6ddfb97b5600d99afe3452d707444afda658aca" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" }, "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, @@ -21,12 +17,9 @@ "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "smear-cursor.nvim": { "branch": "main", "commit": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "ui": { "branch": "v3.0", "commit": "eae966484937c9ef2b5e3f465fd9587464dc277c" }, - "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-gutentags": { "branch": "master", "commit": "aa47c5e29c37c52176c44e61c780032dfacef3dd" }, - "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua deleted file mode 100644 index 17591e3..0000000 --- a/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,26 +0,0 @@ --- Colorschemes disabled - using NvChad base46 for theming --- Use :lua require('nvchad.themes').open() to switch themes --- Or modify lua/chadrc.lua to change the default theme - -return { - -- Keep these as fallbacks if needed (lazy loaded, won't interfere) - -- { - -- "ellisonleao/gruvbox.nvim", - -- name = "gruvbox", - -- enabled = false, - -- }, - -- { - -- "datsfilipe/vesper.nvim", - -- name = "vesper", - -- enabled = false, - -- }, - -- { - -- 'maxmx03/solarized.nvim', - -- enabled = false, - -- }, - -- { - -- "folke/tokyonight.nvim", - -- name = "tokyonight", - -- enabled = false, - -- }, -} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 37a7e28..d9e9815 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -66,13 +66,4 @@ return { }, }, - -- Fugitive: Additional Git commands - { - 'tpope/vim-fugitive', - cmd = { 'Git', 'Gblame', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep' }, - keys = { - { 'gb', 'Git blame', desc = 'Git Blame' }, - { 'gd', 'Gdiff', desc = 'Git Diff (Fugitive)' }, - } - }, } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua deleted file mode 100644 index 656ce1d..0000000 --- a/lua/plugins/lualine.lua +++ /dev/null @@ -1,35 +0,0 @@ --- Disabled: Using NvChad statusline instead --- To re-enable lualine: set enabled = true below AND --- in lua/chadrc.lua set M.ui.statusline.enabled = false -return { - 'nvim-lualine/lualine.nvim', - enabled = false, -- Disabled in favor of NvChad statusline - event = 'VeryLazy', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - opts = { - options = { - theme = 'auto', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = { - { - function() - local search = vim.fn.getreg('/') - if search == '' then return '' end - local ok, result = pcall(vim.fn.searchcount, { maxcount = 0, timeout = 100 }) - if not ok or not result or result.total == 0 then return '' end - return string.format('[%d/%d]', result.current, result.total) - end, - }, - 'progress' - }, - lualine_z = {'location'} - }, - } -} \ No newline at end of file diff --git a/lua/plugins/nvchad.lua b/lua/plugins/nvchad.lua index 9b5dc47..80fe22e 100644 --- a/lua/plugins/nvchad.lua +++ b/lua/plugins/nvchad.lua @@ -27,9 +27,5 @@ return { end, }, - -- Optional: theme switcher UI (use :lua require('nvchad.themes').open()) - { - "nvchad/volt", - lazy = true, - }, + } diff --git a/lua/plugins/refactor.lua b/lua/plugins/refactor.lua deleted file mode 100644 index 4a50054..0000000 --- a/lua/plugins/refactor.lua +++ /dev/null @@ -1,131 +0,0 @@ --- AI Refactor keybindings --- Uses refactor.ts from ai-scripts repo to perform AI-powered refactoring --- Write a comment at the end of the file with instructions, then press Space+ - -return { - { - "ai-refactor", - dir = vim.fn.expand("~/Documents/Github/ai-scripts"), - lazy = false, - config = function() - local refactor_script = vim.fn.expand("~/Documents/Github/ai-scripts/refactor.ts") - local active_jobs = {} - - -- Helper function to run refactor with a specific model - local function refactor_with_model(model) - return function() - local filepath = vim.fn.expand("%:p") - vim.cmd("write") - - vim.notify(string.format("Refactoring with model '%s'...", model), vim.log.levels.INFO) - - -- Run refactor script synchronously - local cmd = { - "bun", refactor_script, filepath, model - } - - local job_id = vim.fn.jobstart(cmd, { - on_exit = function(j_id, exit_code) - active_jobs[j_id] = nil - if exit_code == 0 then - vim.schedule(function() - vim.cmd("checktime") -- Reload file if changed - vim.notify("Refactor complete!", vim.log.levels.INFO) - end) - else - vim.schedule(function() - vim.notify(string.format("Refactor failed with code %d", exit_code), vim.log.levels.ERROR) - end) - end - end, - on_stdout = function(_, data) - if data and #data > 0 then - vim.schedule(function() - for _, line in ipairs(data) do - if line ~= "" then - print(line) - end - end - end) - end - end, - on_stderr = function(_, data) - if data and #data > 0 then - vim.schedule(function() - for _, line in ipairs(data) do - if line ~= "" then - vim.notify(line, vim.log.levels.WARN) - end - end - end) - end - end, - }) - - if job_id > 0 then - active_jobs[job_id] = { - model = model, - file = vim.fn.fnamemodify(filepath, ":t"), - started = os.time() - } - end - end - end - - -- Command to list active refactor jobs - vim.api.nvim_create_user_command("RefactorJobs", function() - if vim.tbl_count(active_jobs) == 0 then - vim.notify("No active refactor jobs", vim.log.levels.INFO) - return - end - - local lines = { "Active refactor jobs:" } - for job_id, info in pairs(active_jobs) do - local elapsed = os.time() - info.started - table.insert(lines, string.format(" [%d] %s - %s (%ds)", job_id, info.model, info.file, elapsed)) - end - vim.notify(table.concat(lines, "\n"), vim.log.levels.INFO) - end, {}) - - -- GPT-5.1 models - vim.keymap.set("n", "ag", refactor_with_model("g"), { - desc = "Refactor with GPT-5.1 (medium)" - }) - vim.keymap.set("n", "aG", refactor_with_model("G"), { - desc = "Refactor with GPT-5.1 (high)" - }) - - -- Gemini-3 models - vim.keymap.set("n", "ai", refactor_with_model("i"), { - desc = "Refactor with Gemini-3 (medium)" - }) - vim.keymap.set("n", "aI", refactor_with_model("I"), { - desc = "Refactor with Gemini-3 (high)" - }) - - -- Claude Sonnet models - vim.keymap.set("n", "as", refactor_with_model("s"), { - desc = "Refactor with Sonnet-4.5 (medium)" - }) - vim.keymap.set("n", "aS", refactor_with_model("S"), { - desc = "Refactor with Sonnet-4.5 (high)" - }) - - -- Claude Opus models - vim.keymap.set("n", "ao", refactor_with_model("o"), { - desc = "Refactor with Opus-4 (medium)" - }) - vim.keymap.set("n", "aO", refactor_with_model("O"), { - desc = "Refactor with Opus-4 (high)" - }) - - -- xAI Grok models - vim.keymap.set("n", "ax", refactor_with_model("x"), { - desc = "Refactor with Grok-4 (medium)" - }) - vim.keymap.set("n", "aX", refactor_with_model("X"), { - desc = "Refactor with Grok-4 (high)" - }) - end, - }, -} diff --git a/~/.config/nvim/check_issues.lua b/~/.config/nvim/check_issues.lua deleted file mode 100644 index 80875ac..0000000 --- a/~/.config/nvim/check_issues.lua +++ /dev/null @@ -1,222 +0,0 @@ --- AstroNvim diagnostics script --- This script helps identify common issues with AstroNvim configuration - -local REPORT_FILE = "/tmp/astronvim_diagnostics.json" - --- Common error patterns to suppress in notifications -local ERROR_PATTERNS = { - "not a real value for ensure_installed", - "position_params", - "offset_encoding", - "failed to get treesitter parser", - "treesitter query error" -} - --- Original notify function for capturing notifications -local orig_notify = vim.notify -local all_notifications = {} - --- Function to check if message contains an error pattern -local function matches_error_pattern(msg) - if type(msg) ~= "string" then return false end - - for _, pattern in ipairs(ERROR_PATTERNS) do - if msg:match(pattern) then - return true - end - end - return false -end - --- Intercept notifications -vim.notify = function(msg, level, opts) - -- Record the notification - table.insert(all_notifications, { - msg = msg, - level = level, - opts = opts, - is_error = (level == vim.log.levels.ERROR or matches_error_pattern(msg)) - }) - - -- Suppress known errors - if matches_error_pattern(msg) then - return - end - - return orig_notify(msg, level, opts) -end - --- Run diagnostics -local function run_diagnostics() - local report = { - nvim_version = vim.version(), - astronvim_version = require("version").version or "unknown", - timestamp = os.time(), - notifications = all_notifications, - errors = {}, - warnings = {}, - loaded_plugins = {}, - checks = {} - } - - -- Check if critical plugins are loaded - local critical_plugins = { - "nvim-treesitter", - "mason", - "mason-lspconfig", - "lazy", - "astrocore" - } - - for _, plugin in ipairs(critical_plugins) do - local is_loaded = package.loaded[plugin] ~= nil - report.loaded_plugins[plugin] = is_loaded - - if not is_loaded then - table.insert(report.warnings, { - type = "plugin_not_loaded", - plugin = plugin - }) - end - end - - -- Check Treesitter - report.checks.treesitter = {} - if package.loaded["nvim-treesitter"] then - local ok, ts_info = pcall(function() - local data = {} - - -- Check configs - data.has_configs = package.loaded["nvim-treesitter.configs"] ~= nil - - -- Check parsers - if package.loaded["nvim-treesitter.parsers"] then - local parsers = require("nvim-treesitter.parsers") - data.available_parsers = parsers.available_parsers() - - -- Check core parsers - local core_parsers = {"c", "lua", "vim", "vimdoc", "query"} - data.core_parsers_status = {} - - for _, parser in ipairs(core_parsers) do - data.core_parsers_status[parser] = parsers.has_parser(parser) - if not parsers.has_parser(parser) then - table.insert(report.errors, { - type = "missing_core_parser", - parser = parser - }) - end - end - end - - return data - end) - - if ok then - report.checks.treesitter = ts_info - else - report.checks.treesitter.error = tostring(ts_info) - table.insert(report.errors, { - type = "treesitter_check_failed", - error = tostring(ts_info) - }) - end - end - - -- Check Mason - report.checks.mason = {} - if package.loaded["mason"] then - local ok, mason_info = pcall(function() - local data = {} - - -- Check registry - data.has_registry = package.loaded["mason-registry"] ~= nil - - -- Check installed packages - if package.loaded["mason-registry"] then - local registry = require("mason-registry") - data.installed_packages = {} - - for _, pkg in ipairs(registry.get_installed_packages()) do - table.insert(data.installed_packages, pkg.name) - end - end - - return data - end) - - if ok then - report.checks.mason = mason_info - else - report.checks.mason.error = tostring(mason_info) - table.insert(report.errors, { - type = "mason_check_failed", - error = tostring(mason_info) - }) - end - end - - -- Extract error notifications - for _, notif in ipairs(all_notifications) do - if notif.is_error then - table.insert(report.errors, { - type = "error_notification", - msg = notif.msg, - level = notif.level - }) - end - end - - -- Save report - local file = io.open(REPORT_FILE, "w") - if file then - file:write(vim.json.encode(report)) - file:close() - print("Diagnostic report written to " .. REPORT_FILE) - else - print("Failed to write diagnostic report to " .. REPORT_FILE) - end - - -- Print summary - print("\n=== AstroNvim Diagnostic Summary ===") - print("NeoVim version: " .. vim.version().major .. "." .. vim.version().minor .. "." .. vim.version().patch) - - if #report.errors > 0 then - print("\nErrors (" .. #report.errors .. "):") - for i, err in ipairs(report.errors) do - print(" " .. i .. ". " .. err.type .. ": " .. (err.msg or err.error or "")) - end - else - print("\nNo errors detected!") - end - - if #report.warnings > 0 then - print("\nWarnings (" .. #report.warnings .. "):") - for i, warn in ipairs(report.warnings) do - print(" " .. i .. ". " .. warn.type .. ": " .. (warn.plugin or "")) - end - else - print("\nNo warnings detected!") - end - - print("\nSteps to fix common issues:") - print("1. Run ':Lazy sync' to update and synchronize plugins") - print("2. Run ':MasonUpdate' to update Mason packages") - print("3. Run ':TSUpdate' to update all Treesitter parsers") - print("\nFor more details, check " .. REPORT_FILE) - - return report -end - --- Run diagnostics after a short delay to allow plugins to load -vim.defer_fn(function() - run_diagnostics() - - -- Exit if in headless mode - if vim.g.headless then - vim.cmd("quit") - end -end, 1000) - --- Return a message for interactive use -return "Running AstroNvim diagnostics... Results will appear shortly."