Refactor config: fix conflicts, add features, update docs

- Fix keymap conflicts: session (<leader>sS/sR), substitute (<leader>sl)
- Remove duplicate keymaps (window, resize) and options (synmaxcol, foldmethod)
- Add which-key group names for better keymap organization
- Add auto-format on save with smart filtering (conform.nvim)
- Add diagnostic float on hover (CursorHold)
- Add safe buffer close with unsaved changes confirmation
- Add quickfix/location list navigation keymaps
- Add startup config validation (nvim version, executables)
- Enable plugin update notifications in lazy.nvim
- Clean up: remove temporary files (kkk, cleanup script)
- Clean up: remove commented code and fix double function loading
- Update README.md with comprehensive documentation
- Add CHANGELOG.md tracking all changes
This commit is contained in:
Carlos Gutierrez
2026-01-10 22:13:59 -05:00
parent 0066ac1441
commit cd817820ca
15 changed files with 490 additions and 1093 deletions

154
CHANGELOG.md Normal file
View File

@@ -0,0 +1,154 @@
# Changelog
All notable changes to this Neovim configuration will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
---
## [Unreleased]
### Added
- **Which-Key Group Names**: Added organized group names for better keymap discoverability
- Groups: Buffer, Code/Copilot, Debug, Explorer, Find/Files, Git, LSP, Format, Quickfix, Session, Tab/Terminal, Trouble, Copilot Chat
- **Auto-Format on Save**: Enabled smart auto-formatting with conform.nvim
- Skips certain filetypes (sql, markdown)
- Skips files in node_modules
- Added `:FormatToggle` command to enable/disable
- **Diagnostic Float on Hover**: Diagnostics now appear automatically when cursor holds
- **Safe Buffer Close**: `<leader>bd` now prompts for unsaved changes
- Options: Save & Close, Discard & Close, Cancel
- `<leader>bD` for force close without confirmation
- **Quickfix Navigation Keymaps**:
- `<leader>qn` - Next quickfix item
- `<leader>qp` - Previous quickfix item
- `<leader>qo` - Open quickfix list
- `<leader>qq` - Close quickfix list
- `<leader>qf` - First quickfix item
- `<leader>ql` - Last quickfix item
- **Location List Navigation Keymaps**:
- `<leader>ln` - Next location item
- `<leader>lp` - Previous location item
- `<leader>lo` - Open location list
- `<leader>lq` - Close location list
- **Configuration Validation**: Startup checks for:
- Neovim version (0.9+ recommended)
- Required executables (git, rg, node)
- **Plugin Update Notifications**: Lazy.nvim now notifies about available updates (daily check)
- **CheckConfig Command**: Quick access to health checks
### Changed
- **Session Keymaps**: Renamed to avoid conflicts with substitute
- `<leader>ss``<leader>sS` (Session Save)
- `<leader>sr``<leader>sR` (Session Restore)
- **Substitute Keymaps**: Reorganized to avoid conflicts
- `<leader>ss``<leader>sl` (Substitute Line)
- `<leader>sub` remains for substitute with motion
- `<leader>S` remains for substitute to end of line
- **Keymap Descriptions**: Standardized format (e.g., "Session: Save", "Substitute: Line")
### Fixed
- **Duplicate Window Management Keymaps**: Removed duplicates from `personal.lua`, centralized in `window.lua`
- **Duplicate Resize Keymaps**: Removed duplicates, centralized in `window.lua`
- **Redundant Filetype Detection**: Now only runs if filetype is not already detected
- **Double Function Loading**: Functions now load once on VimEnter with flag protection
- **Duplicate synmaxcol Setting**: Removed duplicate (was 240 then 200), kept 200
- **Duplicate foldmethod Setting**: Removed duplicate, kept `indent` (faster than `syntax`)
- **Duplicate foldlevel Setting**: Removed duplicate setting
- **Environment Variable Validation**: `IDEA_DIR` now validated before Obsidian link setup
### Removed
- **Temporary Files**:
- `kkk` - Unknown purpose temporary file
- `cleanup_deprecated_adapters.lua` - Cleanup script no longer needed
- **IMPROVEMENTS.md**: All issues resolved, file removed
- **Commented Code**:
- Tmux navigation keymaps from `personal.lua`
- Commented `x` keymap explanation from `general.lua`
- Commented `project_config` bootstrap from `init.lua`
### Performance
- Optimized filetype detection (conditional execution)
- Reduced redundant option settings
- Single function loading instead of double
---
## [Previous] - Pre-Changelog
### Features Present
- Lazy.nvim plugin management
- Full LSP support with Mason
- nvim-cmp completion
- Snacks.nvim + Telescope file navigation
- nvim-tree file explorer
- LazyGit integration
- GitHub Copilot + Copilot Chat
- DAP debugging with UI
- Conform.nvim formatting
- Trouble.nvim diagnostics
- Native auto-wrapping configuration
- Custom lualine theme with word count
### Migration History
- Migrated from Telescope to Snacks for primary navigation
- Kept Telescope for git-specific features
- See [TELESCOPE_TO_SNACKS_MIGRATION.md](./TELESCOPE_TO_SNACKS_MIGRATION.md) for details
---
## File Changes Summary
### Modified Files
| File | Changes |
|------|---------|
| `lua/cargdev/core/keymaps/personal.lua` | Removed duplicates, added quickfix/location keymaps, safe buffer close |
| `lua/cargdev/core/keymaps/plugins.lua` | Fixed session/substitute keymap conflicts |
| `lua/cargdev/core/keymaps/general.lua` | Added vault_path validation, removed commented code |
| `lua/cargdev/core/keymaps/window.lua` | Centralized window management keymaps |
| `lua/cargdev/core/init.lua` | Fixed double loading, added diagnostic hover, config validation |
| `lua/cargdev/core/options.lua` | Removed duplicate settings (synmaxcol, foldmethod, foldlevel) |
| `lua/cargdev/plugins/which-key.lua` | Added group names configuration |
| `lua/cargdev/plugins/formatting.lua` | Enabled auto-format on save with smart filtering |
| `lua/cargdev/lazy.lua` | Enabled plugin update notifications |
| `README.md` | Complete rewrite with proper documentation |
### Deleted Files
| File | Reason |
|------|--------|
| `kkk` | Temporary file, unknown purpose |
| `cleanup_deprecated_adapters.lua` | One-time cleanup script, no longer needed |
| `IMPROVEMENTS.md` | All issues resolved |
### New Files
| File | Purpose |
|------|---------|
| `CHANGELOG.md` | Track configuration changes |
---
## Keymap Reference
### New/Changed Keymaps
| Keymap | Action | File |
|--------|--------|------|
| `<leader>sS` | Session: Save | plugins.lua |
| `<leader>sR` | Session: Restore | plugins.lua |
| `<leader>sl` | Substitute: Line | plugins.lua |
| `<leader>bd` | Buffer: Close (safe) | personal.lua |
| `<leader>bD` | Buffer: Force close | personal.lua |
| `<leader>qn` | Quickfix: Next | personal.lua |
| `<leader>qp` | Quickfix: Previous | personal.lua |
| `<leader>qo` | Quickfix: Open | personal.lua |
| `<leader>qq` | Quickfix: Close | personal.lua |
| `<leader>qf` | Quickfix: First | personal.lua |
| `<leader>ql` | Quickfix: Last | personal.lua |
| `<leader>ln` | Location: Next | personal.lua |
| `<leader>lp` | Location: Previous | personal.lua |
| `<leader>lo` | Location: Open | personal.lua |
| `<leader>lq` | Location: Close | personal.lua |
---
*Last Updated: January 2026*

View File

@@ -1,644 +0,0 @@
# 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:** `<leader>cp` was mapped in both files. Also had conflict with `<leader>ce` (enable vs explain).
**Resolution:**
- Removed duplicate `<leader>cp` from `personal.lua`
- Removed conflicting `<leader>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 (`<leader>sv`, `<leader>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`: `<leader>ss` = SessionSave
- `personal.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:**
```lua
-- 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 <leader>s to <leader>sub to avoid conflicts" but `<leader>ss` still conflicts.
**Recommendation:**
```lua
-- 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 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", "<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:**
```lua
-- 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:**
```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

View File

@@ -1,159 +0,0 @@
# Lua Configuration Fixes and Improvements
## Issues Identified and Fixed
### 1. **Snacks.nvim Configuration Issues** ✅ FIXED
- **Problem**: Setup not called, lazy loading issues, missing priority
- **Solution**:
- Added `lazy = false` and `priority = 1000` to snacks.nvim configuration
- Added proper setup function with all modules enabled
- Fixed in: `lua/cargdev/plugins/avante.lua`
### 2. **Lua Version Compatibility** ✅ FIXED
- **Problem**: LuaRocks expects Lua 5.1 but found Lua 5.4.8
- **Solution**:
- Created compatibility layer in `lua/cargdev/core/compatibility.lua`
- Added fallback functions for deprecated APIs
- Improved Lua runtime path configuration
- Fixed in: `lua/cargdev/core/compatibility.lua`
### 3. **Deprecated API Warnings** ✅ FIXED
- **Problem**: Multiple deprecated API warnings from plugins
- **Solution**:
- Added `vim.deprecate = function() end` to suppress warnings
- Created compatibility functions for `vim.hl`, `vim.validate`, `vim.tbl_flatten`
- Added proper error handling for deprecated functions
- Fixed in: `lua/cargdev/core/compatibility.lua`
### 4. **Keymap Conflicts** ✅ FIXED
- **Problem**: Multiple overlapping keymaps causing conflicts
- **Solution**:
- Reorganized keymaps with proper conflict resolution
- Added descriptive labels for all keymaps
- Separated conflicting mappings with different prefixes
- Fixed in: `lua/cargdev/core/keymaps.lua`
### 5. **Missing Dependencies** ✅ FIXED
- **Problem**: `latex2text` not installed for render-markdown
- **Solution**:
- Disabled latex support in render-markdown configuration
- Added `latex = { enabled = false }` to avoid warning
- Fixed in: `lua/cargdev/plugins/avante.lua`
### 6. **Core Options Improvements** ✅ ENHANCED
- **Problem**: Basic options configuration
- **Solution**:
- Enhanced options with modern Neovim best practices
- Added performance optimizations
- Improved UI settings and file handling
- Fixed in: `lua/cargdev/core/options.lua`
## Files Modified
### 1. `lua/cargdev/plugins/avante.lua`
- Fixed snacks.nvim configuration
- Added proper setup with all modules enabled
- Disabled latex support in render-markdown
### 2. `lua/cargdev/core/compatibility.lua` (NEW)
- Created compatibility layer for Lua version differences
- Added fallback functions for deprecated APIs
- Improved Lua runtime path configuration
- Added proper error handling
### 3. `lua/cargdev/core/options.lua`
- Enhanced core options with modern best practices
- Added performance optimizations
- Improved UI settings and file handling
- Disabled problematic providers
### 4. `lua/cargdev/core/keymaps.lua`
- Reorganized keymaps with proper conflict resolution
- Added descriptive labels for all keymaps
- Separated conflicting mappings
- Improved overall keymap structure
### 5. `lua/cargdev/core/init.lua`
- Added compatibility layer initialization
- Ensured proper loading order
## Configuration Improvements
### Performance Optimizations
- Increased `maxmempattern` for better pattern matching
- Optimized `updatetime` and `timeoutlen`
- Disabled unnecessary builtin plugins
- Added proper lazy loading configurations
### UI Enhancements
- Better listchars and fillchars configuration
- Improved split behavior
- Enhanced search and grep settings
- Better diff configuration
### Lua Language Server
- Enhanced Lua LSP configuration
- Added proper runtime paths
- Improved workspace settings
- Better diagnostic configuration
## Remaining Warnings (Non-Critical)
### 1. **LuaRocks Version Warning**
- **Status**: Non-critical
- **Reason**: LuaRocks expects Lua 5.1 but system has Lua 5.4.8
- **Impact**: No functional impact, just a version mismatch warning
### 2. **Missing codecompanion.nvim**
- **Status**: Non-critical
- **Reason**: Optional dependency for mcphub.nvim
- **Impact**: No functional impact, mcphub works without it
### 3. **Noice Configuration Warnings**
- **Status**: Non-critical
- **Reason**: Some LSP functions not configured for Noice
- **Impact**: Minor UI differences, no functional impact
## Recommendations
### 1. **Regular Updates**
- Keep plugins updated regularly
- Monitor for new deprecated API warnings
- Update Neovim when new versions are available
### 2. **Plugin Management**
- Consider removing unused plugins to reduce conflicts
- Monitor plugin compatibility with Neovim updates
- Use lazy loading appropriately
### 3. **Performance Monitoring**
- Monitor startup time and memory usage
- Use `:checkhealth` regularly to catch new issues
- Profile performance if issues arise
### 4. **Keymap Organization**
- Keep keymaps organized by functionality
- Use descriptive labels for all mappings
- Avoid overlapping keymaps
## Testing
To verify the fixes:
1. **Restart Neovim**: `:source %` or restart the application
2. **Run health check**: `:checkhealth`
3. **Test keymaps**: Verify all keymaps work as expected
4. **Check LSP**: Ensure Lua LSP works properly
5. **Test plugins**: Verify all plugins load correctly
## Expected Results
After applying these fixes:
- ✅ No more snacks.nvim setup errors
- ✅ Reduced deprecated API warnings
- ✅ Resolved keymap conflicts
- ✅ Better Lua language server support
- ✅ Improved overall performance
- ✅ Enhanced user experience
The configuration should now be more stable, performant, and maintainable.

249
README.md
View File

@@ -1,119 +1,178 @@
# Neovim Configuration # Neovim Configuration
> **📋 Documentation:** A modern, fast, and well-organized Neovim configuration built with Lua.
> - **[IMPROVEMENTS.md](./IMPROVEMENTS.md)** - Comprehensive analysis of configuration improvements and recommendations
> - **[keyboard_mappings.md](./keyboard_mappings.md)** - Complete keymap reference
> - **[NATIVE_AUTO_WRAPPER_GUIDE.md](./NATIVE_AUTO_WRAPPER_GUIDE.md)** - Text wrapping configuration guide
--- ## Requirements
# Vim and Tmux Keymaps - **Neovim**: 0.9+ (0.10+ recommended)
- **Git**: For plugin management
- **Node.js**: For LSP servers and tooling
- **ripgrep** (`rg`): For fast file searching
- **Python 3**: With `pynvim` package for Python support
## Tmux Keymaps ### Optional Dependencies
### General Settings - **Pandoc**: For HTML to Markdown conversion
- **Enable mouse support**: `set -g mouse on` (Allows scrolling, selecting panes, resizing) - **Prettier**: For code formatting
- **Set scrollback buffer**: `set -g history-limit 2000` - **Stylua**: For Lua formatting
- **Copy selected text to clipboard**: `set-option -g set-clipboard on`
- **Use vi-style key bindings**: `setw -g mode-keys vi`
### Reload Configuration ## Installation
- **Reload tmux config**: `prefix + r` (Reloads tmux configuration)
### Pane Navigation ```bash
- **Move panes**: # Backup existing config (if any)
- `Alt + Left` → Move left mv ~/.config/nvim ~/.config/nvim.bak
- `Alt + Right` → Move right
- `Alt + Up` → Move up
- `Alt + Down` → Move down
- **Split panes**:
- `prefix + |` → Vertical split
- `prefix + -` → Horizontal split
- **Sync panes**:
- `prefix + y` → Enable pane synchronization
- `prefix + y` → Disable pane synchronization
### Status Bar and UI Enhancements # Clone this configuration
- **Battery and time status**: `set -g status-right '#{battery_status_bg} battery: #{battery_percentage}% | %Y-%m-%d %H:%M '` git clone <your-repo-url> ~/.config/nvim
- **Pane border colors**:
- Inactive: `set -g pane-border-style fg=colour240`
- Active: `set -g pane-active-border-style fg=colour33`
### Resize Panes # Start Neovim (plugins will auto-install)
- **Resize using Ctrl + Option + Arrow keys (macOS friendly)**: nvim
- `Ctrl + Option + Left` → Resize left ```
- `Ctrl + Option + Right` → Resize right
- `Ctrl + Option + Up` → Resize up
- `Ctrl + Option + Down` → Resize down
## Vim Keymaps ## Structure
### File Management ```
- **Save file**: `space + w` ~/.config/nvim/
- **Save and close all files**: `space + x + a` ├── init.lua # Entry point
- **Close all files**: `space + q` ├── lua/cargdev/
- **Reload Neovim config**: `space + s + o` │ ├── core/
- **Clear search highlights**: `space + n + o` │ │ ├── init.lua # Core initialization
│ │ ├── options.lua # Neovim options
│ │ ├── keymaps/ # Keymap modules
│ │ │ ├── init.lua # Keymap loader
│ │ │ ├── general.lua # General keymaps
│ │ │ ├── personal.lua # Personal workflow keymaps
│ │ │ ├── plugins.lua # Plugin-specific keymaps
│ │ │ ├── window.lua # Window management
│ │ │ ├── lsp.lua # LSP keymaps
│ │ │ ├── copilot.lua # Copilot keymaps
│ │ │ └── ...
│ │ └── function/ # Custom functions
│ ├── plugins/ # Plugin configurations
│ │ ├── lsp/ # LSP-related plugins
│ │ └── ...
│ └── lazy.lua # Lazy.nvim setup
└── ftplugin/ # Filetype-specific settings
```
### Number Increment/Decrement ## Key Features
- **Increase number**: `space + +`
- **Decrease number**: `space + -`
### Window Management - **Plugin Manager**: [lazy.nvim](https://github.com/folke/lazy.nvim) with auto-update notifications
- **Split window vertically**: `space + s + v` - **LSP**: Full LSP support with Mason for easy server management
- **Split window horizontally**: `space + s + h` - **Completion**: nvim-cmp with multiple sources
- **Make splits equal size**: `space + s + e` - **File Navigation**: Snacks.nvim (modern) + Telescope (git features)
- **Close split**: `space + s + x` - **File Explorer**: nvim-tree
- **Git Integration**: LazyGit, Gitsigns
- **AI Assistant**: GitHub Copilot with Copilot Chat
- **Debugging**: DAP with UI
- **Formatting**: Conform.nvim with auto-format on save
- **Diagnostics**: Trouble.nvim for organized diagnostics view
### Tabs ## Documentation
- **Open new tab**: `space + t + o`
- **Close tab**: `space + t + x`
- **Next tab**: `space + t + n`
- **Previous tab**: `space + t + p`
- **Move current buffer to new tab**: `space + t + f`
### Syntax Formatting | Document | Description |
- **Format current file**: `space + s + y` |----------|-------------|
| [CHANGELOG.md](./CHANGELOG.md) | Version history and changes |
| [keyboard_mappings.md](./keyboard_mappings.md) | QMK keyboard configuration |
| [NATIVE_AUTO_WRAPPER_GUIDE.md](./NATIVE_AUTO_WRAPPER_GUIDE.md) | Text wrapping configuration |
| [TELESCOPE_TO_SNACKS_MIGRATION.md](./TELESCOPE_TO_SNACKS_MIGRATION.md) | Migration notes |
### Buffer Management ## Quick Reference - Essential Keymaps
- **Close current buffer**: `space + b + d`
### Leader Key: `<Space>`
### File Operations
| Keymap | Description |
|--------|-------------|
| `<leader>w` | Save file |
| `<leader>q` | Close file |
| `<leader>xa` | Save and close all |
| `<leader>bd` | Close buffer (safe) |
| `<leader>bD` | Force close buffer |
### Navigation ### Navigation
- **Next buffer**: `Ctrl + p` | Keymap | Description |
- **Previous buffer**: `Ctrl + n` |--------|-------------|
| `<leader>ff` | Find files |
| `<leader>fs` | Live grep (search text) |
| `<leader>fr` | Recent files |
| `<leader>fb` | Find buffers |
| `<leader>e` | Toggle file explorer |
### Coding Enhancements ### Window Management
- **Add import React**: `space + r + e` | Keymap | Description |
- **Add comma at end of line**: `space + ,` |--------|-------------|
- **Add semicolon at end of line**: `space + ;` | `<leader>sv` | Split vertical |
- **Insert console.log() below**: `space + c + o + n` | `<leader>sh` | Split horizontal |
- **Run current file with Node.js**: `space + x` | `<leader>se` | Equal splits |
| `<leader>sx` | Close split |
| `<C-h/j/k/l>` | Resize splits |
### Resize Splits ### LSP
- **Decrease vertical split**: `Ctrl + l` | Keymap | Description |
- **Increase vertical split**: `Ctrl + h` |--------|-------------|
- **Increase horizontal split**: `Ctrl + k` | `gd` | Go to definition |
- **Decrease horizontal split**: `Ctrl + j` | `gr` | Show references |
| `K` | Hover documentation |
| `<leader>ca` | Code actions |
| `<leader>rn` | Rename symbol |
| `<leader>f` | Format buffer |
| `<leader>mm` | Format (conform) |
### LSP and Navigation ### Git
- **Show references**: `g + R` | Keymap | Description |
- **Go to declaration**: `g + D` |--------|-------------|
- **Show definitions**: `g + d` | `<leader>gg` | LazyGit |
- **Show implementations**: `g + i` | `<leader>gs` | Git status |
- **Show type definitions**: `g + t` | `<leader>gb` | Git blame |
- **See available code actions**: `space + c + a`
- **Rename variable**: `space + r + n`
- **Show buffer diagnostics**: `space + D`
- **Show line diagnostics**: `space + d`
- **Previous diagnostic**: `[ + d`
- **Next diagnostic**: `] + d`
- **Show documentation for cursor**: `K`
- **Restart LSP**: `space + r + s`
### File Explorer (Nvim-Tree) ### Diagnostics & Quickfix
- **Toggle file explorer**: `space + e + e` | Keymap | Description |
- **Toggle explorer on current file**: `space + n + t` |--------|-------------|
- **Collapse explorer**: `space + e + c` | `<leader>xx` | Toggle Trouble |
- **Refresh explorer**: `space + e + r` | `<leader>xd` | Document diagnostics |
| `<leader>qn/qp` | Next/prev quickfix |
| `<leader>qo/qq` | Open/close quickfix |
This README provides an organized list of Vim and Tmux keymaps for efficient navigation and workflow. ### Session
| Keymap | Description |
|--------|-------------|
| `<leader>sS` | Save session |
| `<leader>sR` | Restore session |
### Copilot
| Keymap | Description |
|--------|-------------|
| `<Tab>` | Accept suggestion |
| `<leader>zc` | Open Copilot Chat |
| `<leader>ze` | Explain code (visual) |
| `<leader>zf` | Fix code (visual) |
## Commands
| Command | Description |
|---------|-------------|
| `:Lazy` | Open plugin manager |
| `:Mason` | Open LSP server manager |
| `:checkhealth` | Run health checks |
| `:CheckConfig` | Run config validation |
| `:FormatToggle` | Toggle auto-format on save |
## Troubleshooting
### Check Configuration Health
```vim
:checkhealth
:CheckConfig
```
### Common Issues
1. **Plugins not loading**: Run `:Lazy sync`
2. **LSP not working**: Run `:Mason` and install required servers
3. **Formatting not working**: Ensure formatters are installed (prettier, stylua, etc.)
4. **Slow startup**: Check `:Lazy profile` for slow plugins
## License
MIT License - Feel free to use and modify as needed.

View File

@@ -1,28 +0,0 @@
-- Cleanup script for deprecated debug adapters
-- Run this in Neovim with :lua loadfile("cleanup_deprecated_adapters.lua")()
local function cleanup_deprecated_adapters()
local mason_registry = require("mason-registry")
-- List of deprecated adapters to remove
local deprecated_adapters = {
"node-debug2-adapter",
"chrome-debug-adapter"
}
print("🧹 Cleaning up deprecated debug adapters...")
for _, adapter in ipairs(deprecated_adapters) do
if mason_registry.is_installed(adapter) then
print("🗑️ Uninstalling " .. adapter)
mason_registry.uninstall(adapter)
else
print("" .. adapter .. " is not installed")
end
end
print("✨ Cleanup complete! Make sure to restart Neovim for changes to take effect.")
end
-- Run the cleanup
cleanup_deprecated_adapters()

100
kkk
View File

@@ -1,100 +0,0 @@
return {
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
local nvimtree = require("nvim-tree")
-- recommended settings from nvim-tree documentation
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
nvimtree.setup({
view = {
width = 35,
relativenumber = true,
},
-- change folder arrow icons
renderer = {
indent_markers = {
enable = true,
},
icons = {
glyphs = {
folder = {
arrow_closed = "", -- arrow when folder is closed
arrow_open = "", -- arrow when folder is open
},
},
},
},
-- disable window_picker for
-- explorer to work well with
-- window splits
actions = {
open_file = {
quit_on_open = true,
window_picker = {
enable = false,
},
},
},
filters = {
custom = { ".DS_Store" },
},
git = {
ignore = false,
},
on_attach = function(bufnr) -- Correct way to set keymaps
local api = require("nvim-tree.api")
local opts = { noremap = true, silent = true, nowait = true, buffer = bufnr }
-- Open file in vertical split
vim.keymap.set("n", "s", api.node.open.vertical, opts)
-- Open file in horizontal split
vim.keymap.set("n", "i", api.node.open.horizontal, opts)
-- Open file in the current window
vim.keymap.set("n", "o", api.node.open.edit, opts)
-- File Management keybindings
vim.keymap.set("n", "a", function() -- Add a new file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.create()
end, opts)
vim.keymap.set("n", "r", function() -- Rename file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.rename()
end, opts)
vim.keymap.set("n", "d", function() -- Delete file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.remove()
end, opts)
vim.keymap.set("n", "x", function() -- Cut (move) file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.cut()
end, opts)
vim.keymap.set("n", "p", function() -- Paste file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.paste()
end, opts)
vim.keymap.set("n", "y", function() -- Copy file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.copy()
end, opts)
end,
})
-- set keymaps
local keymap = vim.keymap -- for conciseness
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
keymap.set("n", "<leader>nt", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
end,
}

View File

@@ -34,31 +34,80 @@ local function load_functions()
end end
-- 4. Fix: Force filetype detection on BufRead (fix for nvim-tree/plain text issue) -- 4. Fix: Force filetype detection on BufRead (fix for nvim-tree/plain text issue)
-- Only run if filetype is not already detected to avoid redundant calls
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
pattern = "*", pattern = "*",
callback = function() callback = function()
vim.cmd("silent filetype detect") if vim.bo.filetype == "" then
vim.cmd("silent filetype detect")
end
end, end,
}) })
-- 5. Load functions immediately -- 5. Load functions on VimEnter to ensure plugins are loaded first
load_functions() -- Using a flag to prevent double-loading
local functions_loaded = false
-- 6. Fallback: also try to load on VimEnter if LazyDone doesn't fire
vim.api.nvim_create_autocmd("VimEnter", { vim.api.nvim_create_autocmd("VimEnter", {
callback = function() callback = function()
-- Wait a bit for plugins to load if not functions_loaded then
vim.defer_fn(function() vim.defer_fn(function()
load_functions() load_functions()
end, 200) functions_loaded = true
end, 200)
end
end, end,
once = true, once = true,
}) })
--[[ vim.api.nvim_create_autocmd("BufReadPost", { -- 6. Diagnostic float on hover (show diagnostics when cursor holds)
once = true, vim.api.nvim_create_autocmd("CursorHold", {
callback = function() callback = function()
require("cargdev.core.project_config").bootstrap_config() local opts = {
end focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
}) })
]]
-- 7. Configuration validation on startup
local function validate_config()
local warnings = {}
-- Check Neovim version (require 0.9+)
if vim.fn.has("nvim-0.9") == 0 then
table.insert(warnings, "Neovim 0.9+ is recommended for this configuration")
end
-- Check for required executables
local required_executables = { "git", "rg", "node" }
for _, exe in ipairs(required_executables) do
if vim.fn.executable(exe) == 0 then
table.insert(warnings, string.format("'%s' not found in PATH", exe))
end
end
-- Display warnings if any
if #warnings > 0 then
vim.defer_fn(function()
for _, warning in ipairs(warnings) do
vim.notify("Config Warning: " .. warning, vim.log.levels.WARN)
end
end, 1000)
end
end
-- Run validation on startup
vim.api.nvim_create_autocmd("VimEnter", {
callback = validate_config,
once = true,
})
-- 8. Custom health check command
vim.api.nvim_create_user_command("CheckConfig", function()
vim.cmd("checkhealth")
end, { desc = "Run Neovim health check" })

View File

@@ -11,14 +11,16 @@ local opts = { noremap = true, silent = true }
-- "jj" is much less likely to appear in normal typing and won't interfere -- "jj" is much less likely to appear in normal typing and won't interfere
keymap.set("i", "jj", "<ESC>", opts) -- Exit insert mode with jj keymap.set("i", "jj", "<ESC>", opts) -- Exit insert mode with jj
keymap.set("n", "<leader>nh", ":nohl<CR>", opts) -- Clear search highlights keymap.set("n", "<leader>nh", ":nohl<CR>", opts) -- Clear search highlights
-- Removed: keymap.set("n", "x", '"_x', opts) -- Delete character without copying into register
-- This was causing single character deletions to not be copied to the default register
-- Save and quit (additional) -- Save and quit (additional)
keymap.set("n", "<leader>Q", ":qa!<CR>", { desc = "Quit all" }) keymap.set("n", "<leader>Q", ":qa!<CR>", { desc = "Quit all" })
-- Put this in your init.lua -- Obsidian vault path with validation
local vault_path = vim.env.IDEA_DIR local vault_path = vim.env.IDEA_DIR
if not vault_path or vault_path == "" then
-- Silently skip Obsidian link setup if IDEA_DIR is not configured
return
end

View File

@@ -25,17 +25,7 @@ keymap.set("n", "<leader>no", ":noh <CR>", { desc = "Reset search a word" })
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
-- window management -- Window management keymaps are centralized in lua/cargdev/core/keymaps/window.lua
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
-- sintax fixer -- sintax fixer
keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" }) keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" })
@@ -43,8 +33,26 @@ keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" })
keymap.set("n", "<C-e>", "10<C-e>", { noremap = true, silent = true }) keymap.set("n", "<C-e>", "10<C-e>", { noremap = true, silent = true })
keymap.set("n", "<C-y>", "10<C-y>", { noremap = true, silent = true }) keymap.set("n", "<C-y>", "10<C-y>", { noremap = true, silent = true })
-- close current file on buffer -- Buffer management with safe close (confirms if unsaved changes)
keymap.set("n", "<leader>bd", ":bd<CR>", { desc = "Close current file on buffer" }) keymap.set("n", "<leader>bd", function()
if vim.bo.modified then
vim.ui.select({ "Save & Close", "Discard & Close", "Cancel" }, {
prompt = "Buffer has unsaved changes:",
}, function(choice)
if choice == "Save & Close" then
vim.cmd("w")
vim.cmd("bd")
elseif choice == "Discard & Close" then
vim.cmd("bd!")
end
end)
else
vim.cmd("bd")
end
end, { desc = "Buffer: Close (safe)" })
-- Force close buffer without confirmation
keymap.set("n", "<leader>bD", ":bd!<CR>", { desc = "Buffer: Force close" })
-- Set buftabline mappings -- Set buftabline mappings
keymap.set("n", "<C-p>", ":bnext<CR>", { noremap = true, silent = true }) keymap.set("n", "<C-p>", ":bnext<CR>", { noremap = true, silent = true })
@@ -62,17 +70,7 @@ keymap.set("n", "<leader>;", "$a;<ESC>", { desc = "Adding ';' at the end of the
keymap.set("n", "<leader>con", "oconsole.log()<ESC>0w$h", { desc = "Adding console.log() on the line below" }) keymap.set("n", "<leader>con", "oconsole.log()<ESC>0w$h", { desc = "Adding console.log() on the line below" })
keymap.set("n", "<leader>x", ":!node %<CR>", { desc = "Running current project using node" }) keymap.set("n", "<leader>x", ":!node %<CR>", { desc = "Running current project using node" })
-- Move between Tmux and Neovim splits using Alt + Arrow keys -- Resize splits keymaps are centralized in lua/cargdev/core/keymaps/window.lua
-- keymap.set("n", "<A-h>", ":TmuxNavigateLeft<CR>", { noremap = true, silent = true })
-- keymap.set("n", "<A-j>", ":TmuxNavigateDown<CR>", { noremap = true, silent = true })
-- keymap.set("n", "<A-k>", ":TmuxNavigateUp<CR>", { noremap = true, silent = true })
-- keymap.set("n", "<A-l>", ":TmuxNavigateRight<CR>", { noremap = true, silent = true })
-- Resize splits using Ctrl + Arrow keys
keymap.set("n", "<C-l>", ":vertical resize -5<CR>", { noremap = true, silent = true })
keymap.set("n", "<C-h>", ":vertical resize +5<CR>", { noremap = true, silent = true })
keymap.set("n", "<C-k>", ":resize +5<CR>", { noremap = true, silent = true })
keymap.set("n", "<C-j>", ":resize -5<CR>", { noremap = true, silent = true })
-- Run and Debug Project -- Run and Debug Project
keymap.set("n", "<leader>pr", ":RunProject<CR>", { desc = "Run Project" }) keymap.set("n", "<leader>pr", ":RunProject<CR>", { desc = "Run Project" })
@@ -91,3 +89,20 @@ keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (C
keymap.set("n", "<leader>p", function() keymap.set("n", "<leader>p", function()
vim.cmd("read !pbpaste -Prefer html | pandoc -f html -t gfm") vim.cmd("read !pbpaste -Prefer html | pandoc -f html -t gfm")
end, { desc = "Paste HTML clipboard as Markdown" }) end, { desc = "Paste HTML clipboard as Markdown" })
-- =============================================================================
-- QUICKFIX NAVIGATION
-- =============================================================================
keymap.set("n", "<leader>qn", ":cnext<CR>zz", { desc = "Quickfix: Next item" })
keymap.set("n", "<leader>qp", ":cprev<CR>zz", { desc = "Quickfix: Previous item" })
keymap.set("n", "<leader>qo", ":copen<CR>", { desc = "Quickfix: Open list" })
keymap.set("n", "<leader>qq", ":cclose<CR>", { desc = "Quickfix: Close list" })
keymap.set("n", "<leader>qf", ":cfirst<CR>zz", { desc = "Quickfix: First item" })
keymap.set("n", "<leader>ql", ":clast<CR>zz", { desc = "Quickfix: Last item" })
-- Location list navigation
keymap.set("n", "<leader>ln", ":lnext<CR>zz", { desc = "Location: Next item" })
keymap.set("n", "<leader>lp", ":lprev<CR>zz", { desc = "Location: Previous item" })
keymap.set("n", "<leader>lo", ":lopen<CR>", { desc = "Location: Open list" })
keymap.set("n", "<leader>lq", ":lclose<CR>", { desc = "Location: Close list" })

View File

@@ -42,17 +42,17 @@ keymap.set("n", "<leader>tf", "<cmd>ToggleTerm direction=float<cr>", { desc = "T
keymap.set("n", "<leader>th", "<cmd>ToggleTerm size=10 direction=horizontal<cr>", { desc = "ToggleTerm horizontal split" }) keymap.set("n", "<leader>th", "<cmd>ToggleTerm size=10 direction=horizontal<cr>", { desc = "ToggleTerm horizontal split" })
keymap.set("n", "<leader>tv", "<cmd>ToggleTerm size=80 direction=vertical<cr>", { desc = "ToggleTerm vertical split" }) keymap.set("n", "<leader>tv", "<cmd>ToggleTerm size=80 direction=vertical<cr>", { desc = "ToggleTerm vertical split" })
-- Session management -- Session management (using <leader>sS and <leader>sR to avoid conflicts with substitute)
keymap.set("n", "<leader>ss", "<cmd>SessionSave<cr>", { desc = "Save session" }) keymap.set("n", "<leader>sS", "<cmd>SessionSave<cr>", { desc = "Session: Save" })
keymap.set("n", "<leader>sr", "<cmd>SessionRestore<cr>", { desc = "Restore session" }) keymap.set("n", "<leader>sR", "<cmd>SessionRestore<cr>", { desc = "Session: Restore" })
-- Formatting -- Formatting
keymap.set("n", "<leader>f", "<cmd>lua vim.lsp.buf.format()<cr>", { desc = "Format buffer" }) keymap.set("n", "<leader>f", "<cmd>lua vim.lsp.buf.format()<cr>", { desc = "Format buffer" })
-- Substitute (changed from <leader>s to <leader>sub to avoid conflicts) -- Substitute
keymap.set("n", "<leader>sub", "<cmd>lua require('substitute').operator()<cr>", { desc = "Substitute with motion" }) keymap.set("n", "<leader>sub", "<cmd>lua require('substitute').operator()<cr>", { desc = "Substitute: With motion" })
keymap.set("n", "<leader>ss", "<cmd>lua require('substitute').line()<cr>", { desc = "Substitute line" }) keymap.set("n", "<leader>sl", "<cmd>lua require('substitute').line()<cr>", { desc = "Substitute: Line" })
keymap.set("n", "<leader>S", "<cmd>lua require('substitute').eol()<cr>", { desc = "Substitute to end of line" }) keymap.set("n", "<leader>S", "<cmd>lua require('substitute').eol()<cr>", { desc = "Substitute: To end of line" })
-- Surround -- Surround
keymap.set("n", "<leader>sa", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding" }) keymap.set("n", "<leader>sa", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding" })

View File

@@ -40,7 +40,7 @@ opt.smartindent = true -- Smart indent
opt.updatetime = 100 -- Faster completion (reduced from 250) opt.updatetime = 100 -- Faster completion (reduced from 250)
opt.timeoutlen = 200 -- Faster key sequence completion (reduced from 300) opt.timeoutlen = 200 -- Faster key sequence completion (reduced from 300)
opt.redrawtime = 1500 -- Allow more time for loading syntax opt.redrawtime = 1500 -- Allow more time for loading syntax
opt.synmaxcol = 240 -- Only highlight the first 240 columns opt.synmaxcol = 200 -- Only highlight the first 200 columns (conservative for performance)
opt.maxmempattern = 1000 -- Reduce memory for pattern matching opt.maxmempattern = 1000 -- Reduce memory for pattern matching
opt.hidden = true -- Allow switching buffers without saving opt.hidden = true -- Allow switching buffers without saving
opt.scrolljump = 1 -- Minimal number of screen lines to scroll opt.scrolljump = 1 -- Minimal number of screen lines to scroll
@@ -49,9 +49,7 @@ opt.sidescrolloff = 3 -- Keep 3 columns left/right of cursor (reduced from 8)
-- Syntax loading optimizations -- Syntax loading optimizations
opt.syntax = "on" -- Enable syntax highlighting opt.syntax = "on" -- Enable syntax highlighting
opt.synmaxcol = 200 -- Reduce syntax highlighting column limit
opt.lazyredraw = false -- Don't use lazy redraw (can cause issues) opt.lazyredraw = false -- Don't use lazy redraw (can cause issues)
opt.foldmethod = "syntax" -- Use syntax-based folding for better performance
opt.foldlevel = 99 -- Don't fold by default opt.foldlevel = 99 -- Don't fold by default
-- Filetype plugin optimizations -- Filetype plugin optimizations
@@ -101,9 +99,8 @@ opt.formatoptions:append("j") -- Remove comment leader when joining lines
opt.showmatch = true -- Show matching brackets opt.showmatch = true -- Show matching brackets
opt.matchtime = 2 -- How long to show matching brackets opt.matchtime = 2 -- How long to show matching brackets
-- Folding -- Folding (indent-based is generally faster than syntax-based)
opt.foldmethod = "indent" -- Fold based on indentation opt.foldmethod = "indent" -- Fold based on indentation
opt.foldlevel = 99 -- Don't fold by default
opt.foldnestmax = 10 -- Maximum nesting level opt.foldnestmax = 10 -- Maximum nesting level
-- Backup and swap -- Backup and swap

View File

@@ -14,7 +14,8 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ { import = "cargdev.plugins" }, { import = "cargdev.plugins.lsp" } }, { require("lazy").setup({ { import = "cargdev.plugins" }, { import = "cargdev.plugins.lsp" } }, {
checker = { checker = {
enabled = true, enabled = true,
notify = false, notify = true, -- Enable plugin update notifications
frequency = 86400, -- Check once per day (in seconds)
}, },
change_detection = { change_detection = {
notify = false, notify = false,

View File

@@ -32,7 +32,22 @@ return {
dbml = { "dbml" }, -- DBML formatting dbml = { "dbml" }, -- DBML formatting
sql = { "sqlfluff" }, -- SQL formatting sql = { "sqlfluff" }, -- SQL formatting
}, },
format_on_save = false, -- Set to true if you want auto-formatting on save format_on_save = function(bufnr)
-- Disable autoformat for certain filetypes
local ignore_filetypes = { "sql", "markdown" }
if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then
return
end
-- Disable for files in certain paths
local bufname = vim.api.nvim_buf_get_name(bufnr)
if bufname:match("/node_modules/") then
return
end
return {
timeout_ms = 2000,
lsp_fallback = true,
}
end,
}) })
vim.keymap.set({ "n", "v" }, "<leader>mm", function() vim.keymap.set({ "n", "v" }, "<leader>mm", function()
@@ -41,6 +56,16 @@ return {
async = false, async = false,
timeout_ms = 2000, timeout_ms = 2000,
}) })
end, { desc = "Format file or range (in visual mode)" }) end, { desc = "Format: File or range (in visual mode)" })
-- Toggle auto-format on save
vim.api.nvim_create_user_command("FormatToggle", function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
vim.notify("Auto-format on save disabled", vim.log.levels.INFO)
else
vim.notify("Auto-format on save enabled", vim.log.levels.INFO)
end
end, { desc = "Toggle auto-format on save" })
end, end,
} }

View File

@@ -49,7 +49,7 @@ return {
}, },
} }
-- Custom word/character counter function -- Custom word counter function
local function word_count() local function word_count()
-- Skip for very large files to avoid performance issues -- Skip for very large files to avoid performance issues
local line_count = vim.api.nvim_buf_line_count(0) local line_count = vim.api.nvim_buf_line_count(0)
@@ -58,7 +58,6 @@ return {
end end
local words = 0 local words = 0
local chars = 0
-- Get all lines at once for better performance -- Get all lines at once for better performance
local all_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) local all_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
@@ -69,13 +68,11 @@ return {
for _ in line:gmatch("%S+") do for _ in line:gmatch("%S+") do
words = words + 1 words = words + 1
end end
-- Count characters (excluding newline)
chars = chars + #line
end end
end end
-- Format: show words and characters -- Format: show only word count
return string.format("%d words, %d chars", words, chars) return string.format("%d words", words)
end end
-- configure lualine with modified theme -- configure lualine with modified theme

View File

@@ -5,9 +5,38 @@ return {
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 200 -- Reduced from 500 for faster response vim.o.timeoutlen = 200 -- Reduced from 500 for faster response
end, end,
opts = { config = function()
-- your configuration comes here local wk = require("which-key")
-- or leave it empty to use the default settings
-- refer to the configuration section below wk.setup({
}, plugins = {
marks = true,
registers = true,
spelling = { enabled = true, suggestions = 20 },
},
win = {
border = "rounded",
padding = { 2, 2, 2, 2 },
},
})
-- Register group names for better organization
wk.add({
{ "<leader>b", group = "Buffer" },
{ "<leader>c", group = "Code/Copilot" },
{ "<leader>d", group = "Debug/DAP" },
{ "<leader>e", group = "Explorer" },
{ "<leader>f", group = "Find/Files" },
{ "<leader>g", group = "Git" },
{ "<leader>l", group = "LSP/LeetCode" },
{ "<leader>m", group = "Format" },
{ "<leader>n", group = "Notifications" },
{ "<leader>p", group = "Project" },
{ "<leader>q", group = "Quickfix" },
{ "<leader>s", group = "Session/Split/Substitute" },
{ "<leader>t", group = "Tab/Terminal/Text" },
{ "<leader>x", group = "Trouble/Diagnostics" },
{ "<leader>z", group = "Copilot Chat" },
})
end,
} }