- Fix duplicate git conflict keymaps (centralized in gitconflict.lua) - Fix duplicate Copilot keymaps (centralized in copilot.lua) - Change insert mode escape from 'jk' to 'jj' to avoid typing conflicts - Add word counter to statusline (lualine) - Disable Copilot by default for .tex files - Remove textwidth limits for visual wrapping based on window width - Add comprehensive improvements documentation (IMPROVEMENTS.md) - Update README with links to documentation
14 KiB
Neovim Configuration Improvements & Recommendations
Generated: 2024
Status: Analysis Complete
📋 Table of Contents
- Critical Issues
- Keymap Conflicts & Duplicates
- Code Quality & Organization
- Performance Optimizations
- Missing Features & Enhancements
- Documentation Updates
- Plugin Management
- Security & Best Practices
- 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: <leader>cp was mapped in both files. Also had conflict with <leader>ce (enable vs explain).
Resolution:
- Removed duplicate
<leader>cpfrompersonal.lua - Removed conflicting
<leader>cefrompersonal.lua(Copilot enable incopilot.luatakes 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 (<leader>sv, <leader>sh, etc.) are duplicated.
Impact: Redundant code, maintenance burden.
Recommendation:
-- 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:<leader>ss= SessionSavepersonal.lua:<leader>so= Reload nvim (source %)
Note: These don't conflict directly, but <leader>ss conflicts with Substitute line in plugins.lua line 54.
Recommendation:
-- Rename session save/restore to avoid confusion:
-- <leader>sS = SessionSave
-- <leader>sR = SessionRestore
-- Or use a dedicated prefix: <leader>se (session)
Priority: 🟡 Medium
5. Substitute Keymap Already Conflicts
Location: lua/cargdev/core/keymaps/plugins.lua line 54
Issue: <leader>ss is used for both SessionSave and Substitute line.
Current State: Comment says "changed from s to sub to avoid conflicts" but <leader>ss still conflicts.
Recommendation:
-- Use <leader>subs for substitute line
-- Keep <leader>ss for session save
-- Or use <leader>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 temporarycleanup_deprecated_adapters.lua- Cleanup script that may not be needed anymore
Recommendation:
# 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.lualines 66-69 (commented Tmux navigation)lua/cargdev/core/keymaps/general.lualine 12 (commented x keymap)lua/cargdev/core/init.lualines 58-64 (commented project_config bootstrap)
Recommendation:
-- 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:
-- 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:
-- 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:
vim.api.nvim_create_autocmd("BufRead", {
pattern = "*",
callback = function()
vim.cmd("silent filetype detect")
end,
})
Recommendation:
-- 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:
-- 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:
-- 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:
-- 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:
-- 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:
-- 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:
-- 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:
-- Add safe buffer close:
keymap.set("n", "<leader>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:
-- Add quickfix navigation:
keymap.set("n", "<leader>qn", ":cnext<CR>", { desc = "Next quickfix" })
keymap.set("n", "<leader>qp", ":cprev<CR>", { desc = "Previous quickfix" })
keymap.set("n", "<leader>qq", ":cclose<CR>", { desc = "Close quickfix" })
Priority: 🟢 Low
20. No Project Root Detection Enhancement
Location: Project config
Recommendation:
-- 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.mdwith 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.mddocumenting:- 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.luaandsnacks.lua- Both are file pickers (Snacks is replacement)substitute.luaand 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:
-- 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:
-- 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:
-- 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:
-- 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:
-- 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)
- ✅ Fix duplicate git conflict keymaps (FIXED)
- ✅ Fix duplicate Copilot keymaps (FIXED)
- Resolve substitute/session keymap conflict
Phase 2: Code Quality (Do Next)
- Remove temporary files
- Clean up commented code
- Fix duplicate settings (synmaxcol, foldmethod)
- Standardize keymap descriptions
Phase 3: Enhancements (Do When Time Permits)
- Add auto-format on save
- Update documentation
- Add missing keymaps (quickfix navigation)
- Enhance error handling
Phase 4: Polish (Nice to Have)
- Add configuration validation
- Enhance statusline
- Add plugin documentation
- 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
- Regular Audits: Review keymaps quarterly for conflicts
- Plugin Updates: Keep plugins updated but test before updating
- Documentation: Update docs when adding new features
- Code Cleanup: Remove commented code during refactoring
- Testing: Test configuration after major changes
Last Updated: 2024
Next Review: Quarterly or after major changes