Files
lua-nvim/LUA_CONFIGURATION_FIXES.md
Carlos a7f6d3067b feat: restructure keymaps and fix Lua configuration
- Restructure keymaps into modular folder system
  - Create keymaps/ folder with organized files
  - Separate keymaps by category (general, personal, lsp, telescope, plugins)
  - Auto-loading system for better maintainability

- Fix Lua configuration issues
  - Add compatibility layer for deprecated APIs
  - Fix snacks.nvim configuration
  - Disable latex support in render-markdown
  - Improve LSP configuration

- Enhance function navigation
  - Restore and improve LSP keymaps
  - Add comprehensive Telescope integration
  - Fix conflicting keymaps

- Improve overall Neovim setup
  - Better options configuration
  - Enhanced plugin configurations
  - Cleaner code organization
2025-07-28 22:56:56 -04:00

159 lines
5.2 KiB
Markdown

# 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.