Neovim - AI-Enhanced Code Editor
A comprehensive Neovim setup based on AstroNvim v6 with extensive AI integration, database tools, and modern development features.
🎯 Overview
This Neovim configuration is built on AstroNvim v6, providing a modern, feature-rich development environment with:
- AI Integration: Multiple AI assistants for coding help
- Database Tools: Advanced SQL development with Snowflake support
- LSP Support: Language servers for multiple programming languages
- Modern UI: Beautiful interface with treesitter syntax highlighting
- Project Management: Seamless integration with tmux sessionizer
Base Framework
- AstroNvim v6: Modern Neovim distribution
- Lazy.nvim: Fast plugin manager
- Mason: LSP, formatter, and linter installer
- Treesitter: Advanced syntax highlighting
✨ Key Features
🤖 AI-Powered Development
- CodeCompanion: AI chat and inline assistance
- Supermaven: Primary AI code completion (auto-triggers, Tab to accept)
- Database AI: AI-powered SQL assistance
- Streamlined AI System: Simplified, conflict-free AI completion
🗄️ Database Development
- miu-db.nvim: Lightweight SQL buffer runner backed by
miudb - Native miudb Store: Reuses saved
miudbconnections and secrets - SQL Completion: AI-powered SQL suggestions
- Query Execution: Run queries directly from editor
🛠️ Development Tools
- LSP Integration: Language servers for 20+ languages
- Debugging: DAP integration for multiple languages
- Testing: Integrated test runners
- Git Integration: Advanced git workflows
- File Management: Oil.nvim for file operations
🎨 UI & Experience
- Custom Dashboard: Branded startup screen
- Catppuccin Theme: Beautiful, consistent theming
- Status Line: Rich status information
- Notifications: Snacks.nvim for beautiful notifications
🚀 Installation & Setup
Prerequisites
# Install Neovim (latest stable)brew install neovim
# Install required dependenciesbrew install ripgrep fd fzf gitConfiguration Installation
The configuration is automatically installed via the dotfiles setup:
# Via dotfiles installationmake stow-install
# Or manually symlinkln -sf ~/.dotfiles/dotfiles/nvim/.config/nvim ~/.config/nvimFirst Launch
- Open Neovim:
nvim - Plugin Installation: Plugins install automatically
- LSP Setup: Run
:Masonto install language servers - AI Setup: Configure API keys (see AI Tools section)
Post-Installation
# Install language servers:Mason
# Update plugins:Lazy sync
# Check health:checkhealth⌨️ Key Bindings
Leader Keys
- Leader:
<Space> - Local Leader:
,
Essential Shortcuts
| Shortcut | Action | Description |
|---|---|---|
<C-f> | Project Sessionizer | Open tmux project picker |
- | File Manager | Open Oil.nvim file manager |
<leader>k | Previous Buffer | Switch to last buffer |
<leader>K | Next Tab | Go to next tab |
AI Assistance
| Shortcut | Action | Description |
|---|---|---|
<leader>ac | AI Chat | Open CodeCompanion chat |
<leader>aa | AI Actions | Show AI action menu |
<leader>at | Toggle Chat | Toggle AI chat window |
<leader>aC | Add to Chat | Add selection to chat |
<leader>ae | Explain Code | AI code explanation |
<leader>ar | Review Code | AI code review |
<leader>af | Fix Code | AI code fixes |
<leader>ao | Optimize Code | AI optimization suggestions |
AI Completion (Supermaven)
| Shortcut | Action | Description |
|---|---|---|
<Tab> | Accept/Tab | Accept suggestion or normal tab |
<C-;> | Accept Full | Accept complete suggestion |
<C-y> | Accept Alt | Accept suggestion (alternative) |
<C-'> | Accept Word | Accept next word |
<C-]> | Accept Line | Accept current line |
<C-[> | Previous | Previous suggestion |
<C-\> | Next | Next suggestion |
<C-BS> | Dismiss | Dismiss current suggestion |
Zen Mode & Focus
| Shortcut | Action | Description |
|---|---|---|
<leader>z | Zen Mode | Enter distraction-free mode (70% width) |
<leader>Z | Full Screen Zen | Enter full-screen zen mode (100% width) |
<leader>zx | Exit All Zen | Exit zen mode across all tmux panes |
<leader>tt | Twilight | Toggle twilight (dim inactive code) |
Database Tools
| Shortcut | Action | Description |
|---|---|---|
<leader>Dd | Select Connection | Select a saved miudb connection |
<leader>Dl | List Connections | Show saved miudb connections |
<leader>Dq | Execute Query | Run current SQL buffer |
<leader>j | Execute Query | Run current SQL buffer |
File Operations
| Shortcut | Action | Description |
|---|---|---|
<leader>ff | Find Files | Telescope file finder |
<leader>fw | Find Word | Search in files |
<leader>fb | Find Buffers | Open buffer list |
<leader>fh | Find Help | Search help tags |
<leader>fr | Recent Files | Recently opened files |
LSP & Code
| Shortcut | Action | Description |
|---|---|---|
gd | Go to Definition | Jump to definition |
gr | Go to References | Find references |
gi | Go to Implementation | Jump to implementation |
K | Hover Documentation | Show documentation |
<leader>ca | Code Actions | Show code actions |
<leader>cr | Rename Symbol | Rename symbol |
<leader>cf | Format Code | Format current buffer |
Git Integration
| Shortcut | Action | Description |
|---|---|---|
<leader>gg | Lazygit | Open Lazygit TUI |
<leader>gb | Git Blame | Show git blame |
<leader>gd | Git Diff | Show git diff |
<leader>gs | Git Status | Show git status |
🤖 AI Tools
CodeCompanion
Primary AI assistant for chat and inline help
Setup
- API Key: Set your OpenAI API key
Terminal window export OPENAI_API_KEY="your-api-key" - Configuration: See
dotfiles/nvim/.config/nvim/docs/CODECOMPANION_USAGE.md
Features
- Chat Interface: Full conversation with AI
- Inline Assistance: AI suggestions in code
- Code Actions: Context-aware AI actions
- Multiple Models: Support for different AI models
Supermaven
Primary AI code completion (auto-triggers; copilot.vim is disabled)
Key Features
- Smart Tab: Accepts suggestions when available, normal tab otherwise
- Multiple Accept Options: Full suggestion, word, or line
- Easy Navigation: Previous/next suggestions with bracket keys
- Quick Dismiss: Ctrl+Backspace for natural dismiss motion
🗄️ Database Development
miu-db.nvim
Lightweight SQL buffer runner backed by the miudb CLI
Features
- Connection Selection: Pick from saved
miudbconnections - Query Execution: Run SQL queries directly from Neovim
- Result Viewing: Scratch split with tab-separated results
- Secret Safety: Credentials stay in the
miudbstore
Setup
- Select Connection:
<leader>Dd - Open SQL File: edit any
.sqlbuffer - Run Buffer:
<leader>j
Usage
-- Execute current buffer with <leader>jSELECT * FROM my_table LIMIT 10;
-- Use completion for table names and columns-- AI assistance for complex queriesDatabase AI
- SQL Generation: AI-powered SQL query generation
- Query Optimization: AI suggestions for query improvements
- Schema Understanding: AI help with database schema
🔌 Plugin Management
Lazy.nvim
Modern plugin manager with lazy loading
Commands
:Lazy # Open plugin manager:Lazy sync # Update all plugins:Lazy install # Install missing plugins:Lazy clean # Remove unused plugins:Lazy profile # Profile startup timeAdding Plugins
- Create Plugin File: Add to
dotfiles/nvim/.config/nvim/lua/plugins/ - Plugin Specification: Use Lazy.nvim format
- Reload: Restart Neovim or
:Lazy reload
Mason
LSP, formatter, and linter installer
Commands
:Mason # Open Mason UI:MasonInstall <tool> # Install specific tool:MasonUpdate # Update all tools:MasonLog # View installation logsInstalled Tools
- Language Servers: lua_ls, pyright, tsserver, rust_analyzer, etc.
- Formatters: prettier, stylua, black, rustfmt, etc.
- Linters: eslint, flake8, shellcheck, etc.
- Debuggers: debugpy, node-debug2, etc.
🎨 Customization
Adding Custom Keybindings
Edit dotfiles/nvim/.config/nvim/lua/plugins/astrocore.lua:
mappings = { n = { ["<leader>custom"] = { ":echo 'Custom command'<cr>", desc = "Custom action" }, },}Custom Plugins
Create new file in dotfiles/nvim/.config/nvim/lua/plugins/:
-- custom-plugin.luareturn { "author/plugin-name", config = function() require("plugin-name").setup({ -- configuration }) end,}Theme Customization
Edit dotfiles/nvim/.config/nvim/lua/plugins/theme.lua:
-- Modify Catppuccin theme settingsopts = { flavour = "mocha", -- latte, frappe, macchiato, mocha -- custom colors and highlights}LSP Configuration
Edit dotfiles/nvim/.config/nvim/lua/plugins/astrolsp.lua:
-- Add custom LSP settingsconfig = { servers = { "new_language_server", },}🔧 Troubleshooting
Common Issues
Plugins Not Loading
# Check plugin status:Lazy
# Reinstall plugins:Lazy clean:Lazy sync
# Check for errors:messagesLSP Not Working
# Check LSP status:LspInfo
# Install language server:Mason
# Restart LSP:LspRestartAI Tools Not Responding
# Check API keys:echo $OPENAI_API_KEY
# Check network connectivity# Verify API key validity
# Check plugin status:LazyDatabase Connection Issues
# Check miudb from Neovim:MiuDBConnections
# Verify connection details# Check network connectivity to databasePerformance Issues
Slow Startup
# Profile startup time:Lazy profile
# Disable unnecessary plugins# Optimize plugin loadingHigh Memory Usage
# Check memory usage:lua print(vim.fn.system("ps aux | grep nvim"))
# Disable heavy plugins if needed# Reduce treesitter parsersConfiguration Debugging
Check Health
:checkhealth # General health check:checkhealth lazy # Plugin manager health:checkhealth lsp # LSP health:checkhealth treesitter # Treesitter healthView Configuration
:lua print(vim.inspect(require("lazy").plugins())):lua print(vim.inspect(vim.g)):lua print(vim.inspect(vim.o))📚 Advanced Features
Custom Commands
# Database helpers:MiuDBConnections # List saved connections:MiuDBSelectConnection # Select active connection:MiuDBQuery # Run current SQL buffer
# AI commands:CodeCompanion # Open AI chat:CodeCompanionActions # Show AI actionsAutomation
- Auto-save: Automatic file saving (configurable)
- Session Management: Integration with tmux sessions
- Project Detection: Automatic project-specific settings
Integration
- Tmux: Seamless tmux integration with sessionizer
- Git: Advanced git workflows with Lazygit
- Terminal: Integrated terminal with toggleterm
- File Manager: Oil.nvim for file operations