# Neovim Configuration Improvements & Recommendations **Generated:** 2024 **Status:** Analysis Complete --- ## ๐Ÿ“‹ Table of Contents 1. [Critical Issues](#critical-issues) 2. [Keymap Conflicts & Duplicates](#keymap-conflicts--duplicates) 3. [Code Quality & Organization](#code-quality--organization) 4. [Performance Optimizations](#performance-optimizations) 5. [Missing Features & Enhancements](#missing-features--enhancements) 6. [Documentation Updates](#documentation-updates) 7. [Plugin Management](#plugin-management) 8. [Security & Best Practices](#security--best-practices) 9. [Quick Wins](#quick-wins) --- ## ๐Ÿ”ด Critical Issues ### 1. โœ… **Duplicate Copilot Panel Keymaps** (FIXED) **Location:** `lua/cargdev/core/keymaps/personal.lua` and `lua/cargdev/core/keymaps/copilot.lua` **Issue:** `cp` was mapped in both files. Also had conflict with `ce` (enable vs explain). **Resolution:** - Removed duplicate `cp` from `personal.lua` - Removed conflicting `ce` from `personal.lua` (Copilot enable in `copilot.lua` takes precedence) - All Copilot panel keymaps now centralized in `copilot.lua` **Priority:** ๐Ÿ”ด High โœ… Fixed --- ### 2. **Duplicate Window Management Keymaps** **Location:** `lua/cargdev/core/keymaps/personal.lua` and `lua/cargdev/core/keymaps/window.lua` **Issue:** Window split keymaps (`sv`, `sh`, etc.) are duplicated. **Impact:** Redundant code, maintenance burden. **Recommendation:** ```lua -- Consolidate all window management in window.lua -- Remove duplicates from personal.lua ``` **Priority:** ๐ŸŸก Medium --- ## โš ๏ธ Keymap Conflicts & Duplicates ### 4. **Session Management Keymap Conflict** **Location:** `lua/cargdev/core/keymaps/plugins.lua` (lines 46-47) and `lua/cargdev/core/keymaps/personal.lua` (line 22) **Issue:** - `plugins.lua`: `ss` = SessionSave - `personal.lua`: `so` = Reload nvim (source %) **Note:** These don't conflict directly, but `ss` conflicts with Substitute line in `plugins.lua` line 54. **Recommendation:** ```lua -- Rename session save/restore to avoid confusion: -- sS = SessionSave -- sR = SessionRestore -- Or use a dedicated prefix: se (session) ``` **Priority:** ๐ŸŸก Medium --- ### 5. **Substitute Keymap Already Conflicts** **Location:** `lua/cargdev/core/keymaps/plugins.lua` line 54 **Issue:** `ss` is used for both SessionSave and Substitute line. **Current State:** Comment says "changed from s to sub to avoid conflicts" but `ss` still conflicts. **Recommendation:** ```lua -- Use subs for substitute line -- Keep ss for session save -- Or use sS for session save ``` **Priority:** ๐ŸŸก Medium --- ### 6. **Tab Keymap Conflicts** **Location:** Multiple files handle Tab key **Issue:** Tab is handled by: - Copilot keymaps (`copilot.lua`) - nvim-cmp (`nvim-cmp.lua`) - Both coordinate, but could be cleaner **Current State:** โœ… Working correctly with coordination, but could be documented better. **Recommendation:** - Add comments explaining the coordination - Consider using a unified handler function **Priority:** ๐ŸŸข Low (working, but could be cleaner) --- ## ๐Ÿงน Code Quality & Organization ### 7. **Temporary/Unused Files** **Location:** Root directory **Files Found:** - `kkk` - Unknown purpose, appears to be temporary - `cleanup_deprecated_adapters.lua` - Cleanup script that may not be needed anymore **Recommendation:** ```bash # Review and remove if not needed: - kkk - cleanup_deprecated_adapters.lua (if cleanup already done) ``` **Priority:** ๐ŸŸข Low --- ### 8. **Commented Code Should Be Removed** **Location:** Multiple files **Examples:** - `lua/cargdev/core/keymaps/personal.lua` lines 66-69 (commented Tmux navigation) - `lua/cargdev/core/keymaps/general.lua` line 12 (commented x keymap) - `lua/cargdev/core/init.lua` lines 58-64 (commented project_config bootstrap) **Recommendation:** ```lua -- Remove commented code or convert to proper documentation -- Use git history if you need to reference old code ``` **Priority:** ๐ŸŸข Low --- ### 9. **Inconsistent Keymap Description Format** **Location:** Various keymap files **Issue:** Some descriptions are verbose, some are brief. No consistent style. **Examples:** - `{ desc = "Toggle comment" }` vs `{ desc = "Copilot: Accept suggestion" }` - Some use prefixes (Copilot:, Git:), some don't **Recommendation:** ```lua -- Standardize description format: -- For plugin-specific: "PluginName: Action" -- For general: "Action" -- Example: { desc = "Copilot: Accept suggestion" } -- Example: { desc = "Toggle comment" } ``` **Priority:** ๐ŸŸข Low --- ### 10. **Unused Variables in general.lua** **Location:** `lua/cargdev/core/keymaps/general.lua` line 19 **Issue:** `vault_path` is defined but only used if Obsidian link function is called. **Recommendation:** ```lua -- Move vault_path inside the function or add a check: local vault_path = vim.env.IDEA_DIR if not vault_path then vim.notify("IDEA_DIR environment variable not set", vim.log.levels.WARN) return end ``` **Priority:** ๐ŸŸข Low --- ## โšก Performance Optimizations ### 11. **Redundant Filetype Detection** **Location:** `lua/cargdev/core/init.lua` lines 37-42 **Issue:** Force filetype detection on every BufRead might be redundant. **Current Code:** ```lua vim.api.nvim_create_autocmd("BufRead", { pattern = "*", callback = function() vim.cmd("silent filetype detect") end, }) ``` **Recommendation:** ```lua -- Only run if filetype is not already detected: vim.api.nvim_create_autocmd("BufRead", { pattern = "*", callback = function() if vim.bo.filetype == "" then vim.cmd("silent filetype detect") end end, }) ``` **Priority:** ๐ŸŸก Medium --- ### 12. **Double Function Loading** **Location:** `lua/cargdev/core/init.lua` lines 44-56 **Issue:** Functions are loaded twice - once immediately and once on VimEnter. **Recommendation:** ```lua -- Remove the immediate load, keep only VimEnter -- Or add a flag to prevent double-loading ``` **Priority:** ๐ŸŸก Medium --- ### 13. **Syntax Highlighting Column Limit Set Twice** **Location:** `lua/cargdev/core/options.lua` lines 43 and 52 **Issue:** `synmaxcol` is set to 240 and then 200. **Recommendation:** ```lua -- Remove duplicate, keep only one value (200 is more conservative) opt.synmaxcol = 200 ``` **Priority:** ๐ŸŸข Low --- ### 14. **Foldmethod Set Twice** **Location:** `lua/cargdev/core/options.lua` lines 54 and 105 **Issue:** `foldmethod` is set to "syntax" then "indent". **Recommendation:** ```lua -- Choose one method or make it filetype-specific -- "indent" is generally faster than "syntax" ``` **Priority:** ๐ŸŸก Medium --- ## โœจ Missing Features & Enhancements ### 15. **Missing Which-Key Integration** **Location:** `lua/cargdev/plugins/which-key.lua` exists but keymaps may not be registered **Recommendation:** ```lua -- Ensure all keymaps use proper descriptions for which-key -- Add group names for better organization -- Example: { desc = "Copilot: Accept", group = "Copilot" } ``` **Priority:** ๐ŸŸก Medium --- ### 16. **No Auto-Format on Save** **Location:** Formatting plugin exists but no autocmd for auto-format **Recommendation:** ```lua -- Add to formatting.lua or create autocmd: vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*", callback = function() if vim.bo.filetype ~= "" then vim.lsp.buf.format({ async = false }) end end, }) ``` **Priority:** ๐ŸŸก Medium --- ### 17. **Missing Diagnostic Float on Hover** **Location:** LSP config **Issue:** `K` shows documentation, but diagnostic hover could be enhanced. **Recommendation:** ```lua -- Add diagnostic hover enhancement: vim.api.nvim_create_autocmd("CursorHold", { callback = function() vim.diagnostic.open_float(nil, { focus = false }) end, }) ``` **Priority:** ๐ŸŸข Low --- ### 18. **No Buffer Close Confirmation for Unsaved Changes** **Location:** Buffer management **Recommendation:** ```lua -- Add safe buffer close: keymap.set("n", "bd", function() if vim.bo.modified then vim.ui.select({ "Save", "Discard", "Cancel" }, { prompt = "Buffer has unsaved changes:" }, function(choice) if choice == "Save" then vim.cmd("w") vim.cmd("bd") elseif choice == "Discard" then vim.cmd("bd!") end end) else vim.cmd("bd") end end, { desc = "Close buffer (safe)" }) ``` **Priority:** ๐ŸŸข Low --- ### 19. **Missing Quickfix Navigation Enhancements** **Location:** Quickfix/Trouble integration **Recommendation:** ```lua -- Add quickfix navigation: keymap.set("n", "qn", ":cnext", { desc = "Next quickfix" }) keymap.set("n", "qp", ":cprev", { desc = "Previous quickfix" }) keymap.set("n", "qq", ":cclose", { desc = "Close quickfix" }) ``` **Priority:** ๐ŸŸข Low --- ### 20. **No Project Root Detection Enhancement** **Location:** Project config **Recommendation:** ```lua -- Add better project root detection using: -- - .git directory -- - package.json, Cargo.toml, etc. -- - Consider using nvim-lspconfig's root_dir patterns ``` **Priority:** ๐ŸŸข Low --- ## ๐Ÿ“š Documentation Updates ### 21. **README.md is Outdated** **Location:** Root `README.md` **Issue:** README contains Tmux/Vim keymaps, not Neovim-specific information. **Recommendation:** - Update README with: - Neovim version requirements - Installation instructions - Plugin list - Keymap reference (link to keyboard_mappings.md) - Configuration structure - Troubleshooting section **Priority:** ๐ŸŸก Medium --- ### 22. **Missing Keymap Documentation** **Location:** Various keymap files **Issue:** Not all keymaps are documented in `keyboard_mappings.md`. **Recommendation:** - Update `keyboard_mappings.md` with all current keymaps - Organize by category - Add search functionality or table of contents **Priority:** ๐ŸŸก Medium --- ### 23. **Plugin Documentation Missing** **Location:** No central plugin documentation **Recommendation:** - Create `PLUGINS.md` documenting: - What each plugin does - Why it's included - Configuration highlights - Dependencies **Priority:** ๐ŸŸข Low --- ## ๐Ÿ”Œ Plugin Management ### 24. **Potential Plugin Redundancy** **Location:** Multiple plugins for similar functionality **Examples:** - `telescope.lua` and `snacks.lua` - Both are file pickers (Snacks is replacement) - `substitute.lua` and native Neovim features **Recommendation:** - Review if Telescope is still needed after Snacks migration - Document which plugins are being phased out **Priority:** ๐ŸŸก Medium --- ### 25. **Missing Plugin Health Checks** **Location:** No health check automation **Recommendation:** ```lua -- Add to init.lua or create health check: vim.api.nvim_create_user_command("CheckConfig", function() vim.cmd("checkhealth") -- Add custom checks for: -- - Required plugins installed -- - LSP servers available -- - Keymap conflicts end, {}) ``` **Priority:** ๐ŸŸข Low --- ### 26. **No Plugin Update Reminder** **Location:** Lazy.nvim config **Recommendation:** ```lua -- Enable update notifications: require("lazy").setup({ checker = { enabled = true, notify = true, -- Change from false to true frequency = 3600, -- Check every hour }, }) ``` **Priority:** ๐ŸŸข Low --- ## ๐Ÿ”’ Security & Best Practices ### 27. **Modeline Disabled (Good)** **Status:** โœ… Already disabled in `options.lua` line 59 **Note:** Good security practice, keep it disabled. --- ### 28. **Missing Secure Defaults for Netrw** **Status:** โœ… Netrw is disabled (good) **Note:** Consider documenting why it's disabled. --- ### 29. **Environment Variable Usage** **Location:** `general.lua` line 19 **Issue:** Uses `vim.env.IDEA_DIR` without validation. **Recommendation:** ```lua -- Add validation: local vault_path = vim.env.IDEA_DIR if not vault_path or vault_path == "" then return -- Don't set up Obsidian links if not configured end ``` **Priority:** ๐ŸŸข Low --- ## ๐ŸŽฏ Quick Wins ### 30. **Add Statusline Customization** **Location:** `lualine.lua` **Recommendation:** - Add git branch indicator - Add LSP status - Add file encoding - Add word count for markdown files **Priority:** ๐ŸŸข Low --- ### 31. **Add File Explorer Enhancements** **Location:** `nvim-tree.lua` **Recommendation:** - Add file creation from explorer - Add better file preview - Add git status indicators **Priority:** ๐ŸŸข Low --- ### 32. **Add Better Error Handling** **Location:** Various files **Recommendation:** ```lua -- Wrap plugin requires in pcall: local ok, plugin = pcall(require, "plugin-name") if not ok then vim.notify("Plugin failed to load: plugin-name", vim.log.levels.WARN) return end ``` **Priority:** ๐ŸŸก Medium --- ### 33. **Add Configuration Validation** **Location:** Core init **Recommendation:** ```lua -- Add startup validation: local function validate_config() -- Check Neovim version if vim.fn.has("nvim-0.9") == 0 then vim.notify("Neovim 0.9+ required", vim.log.levels.ERROR) end -- Check required commands -- Check required plugins end ``` **Priority:** ๐ŸŸข Low --- ## ๐Ÿ“Š Summary Statistics - **Total Issues Found:** 32 - **Critical (High Priority):** 2 (2 fixed) - **Medium Priority:** 12 - **Low Priority:** 18 - **Already Fixed/Good:** 2 --- ## ๐Ÿš€ Recommended Action Plan ### Phase 1: Critical Fixes (Do First) 1. โœ… Fix duplicate git conflict keymaps (FIXED) 2. โœ… Fix duplicate Copilot keymaps (FIXED) 3. Resolve substitute/session keymap conflict ### Phase 2: Code Quality (Do Next) 4. Remove temporary files 5. Clean up commented code 6. Fix duplicate settings (synmaxcol, foldmethod) 7. Standardize keymap descriptions ### Phase 3: Enhancements (Do When Time Permits) 8. Add auto-format on save 9. Update documentation 10. Add missing keymaps (quickfix navigation) 11. Enhance error handling ### Phase 4: Polish (Nice to Have) 12. Add configuration validation 13. Enhance statusline 14. Add plugin documentation 15. Improve project root detection --- ## ๐Ÿ“ Notes - Most issues are low-priority and don't affect functionality - Configuration is generally well-organized - Keymap conflicts are the main concern - Documentation could be more comprehensive - Performance optimizations are minor but worthwhile --- ## ๐Ÿ”„ Maintenance Recommendations 1. **Regular Audits:** Review keymaps quarterly for conflicts 2. **Plugin Updates:** Keep plugins updated but test before updating 3. **Documentation:** Update docs when adding new features 4. **Code Cleanup:** Remove commented code during refactoring 5. **Testing:** Test configuration after major changes --- **Last Updated:** 2024 **Next Review:** Quarterly or after major changes