Add comprehensive documentation for AI assistants working with this codebase. Documents the new keymap organization structure, semantic namespacing patterns, and cross-application consistency philosophy. Includes: - Repository overview and development commands - Keymap organization and namespace structure - Plugin architecture and file locations - Keybinding philosophy (navigation vs management) - Container consistency patterns with WezTerm/XMonad
6 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is a personal Neovim configuration built with nixvim, a Nix-based configuration system for Neovim. The configuration is structured as a Nix flake with modular plugin organization and supports multiple platforms (Linux and macOS, both x86_64 and aarch64).
Development Commands
Building and Running
nix run .
- Build and run nixvim with current configurationnix run git+https://git.sajenim.dev/jasmine/nvim.nix.git
- Run from remote repositorynix flake check
- Verify configuration is valid and not brokennix flake show
- Display available packages and checks for all systemsnix build
- Build the nixvim package without running it
Development Workflow
nix develop
- Enter development shell (if devShell is available)nix flake update
- Update flake inputs (nixpkgs, nixvim, flake-parts)git log --oneline -10
- View recent configuration changes
Architecture and Structure
Core Configuration Files
flake.nix
- Main flake definition with inputs, outputs, and build configurationconfig/default.nix
- Central module imports file that orchestrates all configuration piecesconfig/options.nix
- Global Neovim options (number, tabstop, clipboard, etc.)config/autocmds.nix
- Autocommands for automatic behaviors (window balancing on resize)
Keymap Organization
The configuration separates keybindings into semantic namespaces under config/keymaps/
:
general.nix
- Leader setup, page navigation, global keybindingsbuffers.nix
- Buffer management operations (bq, bQ, bl)windows.nix
- Window management operations (ws, wv, wq, wQ, wm)find.nix
- Telescope find operations (ff, fg, fh, fc)git.nix
- Unified git operations from gitsigns, fugitive, and telescope
Plugin Organization
The configuration uses a hierarchical plugin structure under config/plugins/
:
Themes & Appearance (plugins/themes/
)
- Uses gruvbox-material theme with medium background and italic support
Language Server Protocol (plugins/lsp/
)
lsp.nix
- Comprehensive LSP setup with servers for: C/C++ (clangd), Clojure, Haskell (hls), Lua, Nix (nil_ls), YAML, Python (pyright), Rust (rust_analyzer)conform.nix
- Code formatting configuration- Extensive LSP keybindings:
gd
(definition),gr
(references),K
(hover),<leader>r
(rename)
Plugin Collections (plugins/collections/
)
mini.nix
- Mini.nvim plugin suitesnacks.nix
- Snacks.nvim plugin collection (bufdelete functionality)
Editor Enhancements (plugins/editor/
)
treesitter.nix
- Syntax highlighting and parsingharpoon.nix
- Quick file navigationsessions.nix
- Session managementmaximize.nix
- Window maximization/zoom functionalitysurround.nix
- Text object surroundingcommentary.nix
- Code commenting
User Interface (plugins/ui/
)
lualine.nix
- Status line configurationweb-devicons.nix
- File type iconswhichkey.nix
- Keybinding hints and discovery
Git Integration (plugins/git/
)
fugitive.nix
- Git commands within Neovim (plugin config only, keymaps in keymaps/git.nix)gitsigns.nix
- Git change indicators in gutter (plugin config only, keymaps in keymaps/git.nix)
Completion (plugins/cmp/
)
cmp.nix
- Autocompletion engine configuration
Utilities (plugins/utils/
)
telescope.nix
- Fuzzy finder and picker (plugin config only, keymaps in keymaps/find.nix and keymaps/git.nix)oil.nix
- File manager replacement for netrwvimtex.nix
- LaTeX support
Notes and Productivity (plugins/notes/
)
neorg.nix
- Org-mode like note taking (requires conceallevel=2, foldlevel=99)markdown-preview.nix
- Live markdown previewrender-markdown.nix
- Enhanced markdown renderingtodo-comments.nix
- Highlight and manage TODO comments
Key Configuration Patterns
Leader Keys
- Primary leader:
<Space>
- Local leader:
<Backspace>
(using raw vim API call) - Namespace prefixes:
<leader>b
- Buffer operations (bq, bQ, bl)<leader>w
- Window operations (ws, wv, wq, wQ, wm)<leader>f
- Find operations (ff, fg, fh, fc)<leader>g
- Git operations (gs, gr, gb, gc, gd, gu, gp)<leader>gl
- Git list operations (glc, glb, gld, gls)<leader>l
- LSP operations
Navigation Keybindings
- Uses dedicated modifiers for fast navigation (muscle memory):
Ctrl+Left/Right
- Cycle buffersCtrl+Up/Down
- Cycle windowsCtrl+PageUp/PageDown
- Rotate windowsCtrl+Del
- Equalize window sizes
- Mirrors WezTerm (ALT) and XMonad (Super) for cross-application consistency
Keybinding Philosophy
- Navigation: Optimized for speed using dedicated modifiers
- Management: Optimized for clarity using leader + semantic namespaces
- Separation of concerns: Keymaps separated from plugin configurations
- Container consistency: Matches WezTerm's LEADER+p/t namespace pattern
Platform Support
- Multi-platform flake supporting x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin
- Uses
pkgsWithUnfree
to allow unfree packages when needed - Each system gets its own package and check derivation
Module Import Strategy
- Central
default.nix
imports all configuration modules - Keymaps organized by domain (buffers, windows, find, git) not by plugin
- Plugin files contain only configuration, keymaps are extracted to
keymaps/
- Logical grouping by functionality (themes, LSP, editor, UI, etc.)
- Each plugin typically gets its own dedicated file for maintainability
Development Settings
- Uses 2-space indentation with tab expansion
- Clipboard integration with system (
unnamedplus
) - Persistent undo files enabled
- Split windows open to the right
- Update time set to 100ms for responsive interactions
- Session options configured for proper session restoration
When working on this configuration, always test changes with nix flake check
before committing, and consider the modular structure when adding new plugins or features.