Skip to content

Neovim - AI-Enhanced Code Editor

A comprehensive Neovim setup based on AstroNvim v6 with extensive AI integration, database tools, and modern development features.

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
  • AstroNvim v6: Modern Neovim distribution
  • Lazy.nvim: Fast plugin manager
  • Mason: LSP, formatter, and linter installer
  • Treesitter: Advanced syntax highlighting
  • 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
  • miu-db.nvim: Lightweight SQL buffer runner backed by miudb
  • Native miudb Store: Reuses saved miudb connections and secrets
  • SQL Completion: AI-powered SQL suggestions
  • Query Execution: Run queries directly from editor
  • 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
  • Custom Dashboard: Branded startup screen
  • Catppuccin Theme: Beautiful, consistent theming
  • Status Line: Rich status information
  • Notifications: Snacks.nvim for beautiful notifications
Terminal window
# Install Neovim (latest stable)
brew install neovim
# Install required dependencies
brew install ripgrep fd fzf git

The configuration is automatically installed via the dotfiles setup:

Terminal window
# Via dotfiles installation
make stow-install
# Or manually symlink
ln -sf ~/.dotfiles/dotfiles/nvim/.config/nvim ~/.config/nvim
  1. Open Neovim: nvim
  2. Plugin Installation: Plugins install automatically
  3. LSP Setup: Run :Mason to install language servers
  4. AI Setup: Configure API keys (see AI Tools section)
Terminal window
# Install language servers
:Mason
# Update plugins
:Lazy sync
# Check health
:checkhealth
  • Leader: <Space>
  • Local Leader: ,
ShortcutActionDescription
<C-f>Project SessionizerOpen tmux project picker
-File ManagerOpen Oil.nvim file manager
<leader>kPrevious BufferSwitch to last buffer
<leader>KNext TabGo to next tab
ShortcutActionDescription
<leader>acAI ChatOpen CodeCompanion chat
<leader>aaAI ActionsShow AI action menu
<leader>atToggle ChatToggle AI chat window
<leader>aCAdd to ChatAdd selection to chat
<leader>aeExplain CodeAI code explanation
<leader>arReview CodeAI code review
<leader>afFix CodeAI code fixes
<leader>aoOptimize CodeAI optimization suggestions
ShortcutActionDescription
<Tab>Accept/TabAccept suggestion or normal tab
<C-;>Accept FullAccept complete suggestion
<C-y>Accept AltAccept suggestion (alternative)
<C-'>Accept WordAccept next word
<C-]>Accept LineAccept current line
<C-[>PreviousPrevious suggestion
<C-\>NextNext suggestion
<C-BS>DismissDismiss current suggestion
ShortcutActionDescription
<leader>zZen ModeEnter distraction-free mode (70% width)
<leader>ZFull Screen ZenEnter full-screen zen mode (100% width)
<leader>zxExit All ZenExit zen mode across all tmux panes
<leader>ttTwilightToggle twilight (dim inactive code)
ShortcutActionDescription
<leader>jfPretty-printCurrent line on .jsonl, whole buffer on .json. Visual: selection. Leaves invalid JSON untouched.
<leader>jpPreviewScratch split: JSONL slurped into a pretty array, JSON pretty-printed. Source file stays as-is.

Works on json and jsonl buffers. Requires jq. .jsonl uses the json treesitter parser for highlighting.

ShortcutActionDescription
<leader>DdSelect ConnectionSelect a saved miudb connection
<leader>DlList ConnectionsShow saved miudb connections
<leader>DqExecute QueryRun current SQL buffer
<leader>jExecute QueryRun current SQL buffer (SQL files only)
ShortcutActionDescription
<leader>ffFind FilesTelescope file finder
<leader>fwFind WordSearch in files
<leader>fbFind BuffersOpen buffer list
<leader>fhFind HelpSearch help tags
<leader>frRecent FilesRecently opened files
ShortcutActionDescription
gdGo to DefinitionJump to definition
grGo to ReferencesFind references
giGo to ImplementationJump to implementation
KHover DocumentationShow documentation
<leader>caCode ActionsShow code actions
<leader>crRename SymbolRename symbol
<leader>cfFormat CodeFormat current buffer
ShortcutActionDescription
<leader>ggLazygitOpen Lazygit TUI
<leader>gbGit BlameShow git blame
<leader>gdGit DiffShow git diff
<leader>gsGit StatusShow git status

Primary AI assistant for chat and inline help

  1. API Key: Set your OpenAI API key
    Terminal window
    export OPENAI_API_KEY="your-api-key"
  2. Configuration: See dotfiles/nvim/.config/nvim/docs/CODECOMPANION_USAGE.md
  • 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

Primary AI code completion (auto-triggers; copilot.vim is disabled)

  • 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

Lightweight SQL buffer runner backed by the miudb CLI

  • Connection Selection: Pick from saved miudb connections
  • Query Execution: Run SQL queries directly from Neovim
  • Result Viewing: Scratch split with tab-separated results
  • Secret Safety: Credentials stay in the miudb store
  1. Select Connection: <leader>Dd
  2. Open SQL File: edit any .sql buffer
  3. Run Buffer: <leader>j
-- Execute current buffer with <leader>j
SELECT * FROM my_table LIMIT 10;
-- Use completion for table names and columns
-- AI assistance for complex queries
  • SQL Generation: AI-powered SQL query generation
  • Query Optimization: AI suggestions for query improvements
  • Schema Understanding: AI help with database schema

Modern plugin manager with lazy loading

Terminal window
:Lazy # Open plugin manager
:Lazy sync # Update all plugins
:Lazy install # Install missing plugins
:Lazy clean # Remove unused plugins
:Lazy profile # Profile startup time
  1. Create Plugin File: Add to dotfiles/nvim/.config/nvim/lua/plugins/
  2. Plugin Specification: Use Lazy.nvim format
  3. Reload: Restart Neovim or :Lazy reload

LSP, formatter, and linter installer

Terminal window
:Mason # Open Mason UI
:MasonInstall <tool> # Install specific tool
:MasonUpdate # Update all tools
:MasonLog # View installation logs
  • 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.

Edit dotfiles/nvim/.config/nvim/lua/plugins/astrocore.lua:

mappings = {
n = {
["<leader>custom"] = { ":echo 'Custom command'<cr>", desc = "Custom action" },
},
}

Create new file in dotfiles/nvim/.config/nvim/lua/plugins/:

-- custom-plugin.lua
return {
"author/plugin-name",
config = function()
require("plugin-name").setup({
-- configuration
})
end,
}

Edit dotfiles/nvim/.config/nvim/lua/plugins/theme.lua:

-- Modify Catppuccin theme settings
opts = {
flavour = "mocha", -- latte, frappe, macchiato, mocha
-- custom colors and highlights
}

Edit dotfiles/nvim/.config/nvim/lua/plugins/astrolsp.lua:

-- Add custom LSP settings
config = {
servers = {
"new_language_server",
},
}
Terminal window
# Check plugin status
:Lazy
# Reinstall plugins
:Lazy clean
:Lazy sync
# Check for errors
:messages
Terminal window
# Check LSP status
:LspInfo
# Install language server
:Mason
# Restart LSP
:LspRestart
Terminal window
# Check API keys
:echo $OPENAI_API_KEY
# Check network connectivity
# Verify API key validity
# Check plugin status
:Lazy
Terminal window
# Check miudb from Neovim
:MiuDBConnections
# Verify connection details
# Check network connectivity to database
Terminal window
# Profile startup time
:Lazy profile
# Disable unnecessary plugins
# Optimize plugin loading
Terminal window
# Check memory usage
:lua print(vim.fn.system("ps aux | grep nvim"))
# Disable heavy plugins if needed
# Reduce treesitter parsers
Terminal window
:checkhealth # General health check
:checkhealth lazy # Plugin manager health
:checkhealth lsp # LSP health
:checkhealth treesitter # Treesitter health
Terminal window
:lua print(vim.inspect(require("lazy").plugins()))
:lua print(vim.inspect(vim.g))
:lua print(vim.inspect(vim.o))
Terminal window
# Database helpers
:MiuDBConnections # List saved connections
:MiuDBSelectConnection # Select active connection
:MiuDBQuery # Run current SQL buffer
# AI commands
:CodeCompanion # Open AI chat
:CodeCompanionActions # Show AI actions
  • Auto-save: Automatic file saving (configurable)
  • Session Management: Integration with tmux sessions
  • Project Detection: Automatic project-specific settings
  • Tmux: Seamless tmux integration with sessionizer
  • Git: Advanced git workflows with Lazygit
  • Terminal: Integrated terminal with toggleterm
  • File Manager: Oil.nvim for file operations