A feature-rich Neovim configuration with AI integration optimized for LaTeX, Markdown, Jupyter Notebooks, and managing NixOS.
This setup provides a streamlined environment for academic writing, code development, and system management.
The AI integration makes it easy to learn and configure this setup for your specific needs.
Every subdirectory includes a README.md file which documents the modules contained in that directory.
Recommended: See the Claude Code-Assisted Installation Guide for AI-powered setup assistance that automates dependency checking, troubleshooting, and configuration validation.
Migrating from Existing Config: See the Migration Guide for systematic instructions on moving from your current Neovim setup while preserving your customizations, keybindings, and preferences.
Traditional Setup: See the Installation Guide for manual step-by-step setup instructions, including how to fork the repository, install dependencies, and run health checks.
Want to customize notifications? See the Notification System Documentation for configuring notification behavior across all modules and plugins.
nvim/
├── init.lua # Main configuration entry point
├── lazy-lock.json # Plugin version lockfile
├── CLAUDE.md # Project guidelines and policies
├── after/ # Post-load configurations
│ ├── ftdetect/ # File type detection rules
│ └── ftplugin/ # File type specific settings
├── lua/neotex/ # Main configuration modules
│ ├── bootstrap.lua # Plugin system initialization
│ ├── config/ # Core Neovim settings
│ ├── plugins/ # Plugin configurations
│ └── util/ # Utility functions
├── templates/ # Document templates
│ ├── *.tex # LaTeX templates
│ ├── report/ # Multi-chapter documents
│ └── springer/ # Publisher templates
├── snippets/ # Code snippet collections
├── scripts/ # Maintenance utilities
├── sessions/ # Saved editor sessions
└── spell/ # Custom spell check dictionaries
This Neovim configuration includes specialized support for:
- LaTeX Editing: Comprehensive LaTeX support through VimTeX with custom templates, PDF viewing, citation management, LaTeX-specific text surrounds, and more
- Markdown Writing: Enhanced Markdown editing with smart list handling, checkboxes, markdown-specific text surrounds, and live preview
- AI Assistance: Multiple AI integration options for code completion and development workflows:
- Claude Code - Official Claude integration with session management and worktree support
- Avante - AI assistant with MCP-Hub tools integration
- Lectic - AI-assisted writing for markdown files
- Jupyter Notebooks: Interactive notebook support with cell execution, navigation, and conversion between formats
- NixOS Management: Convenient commands for managing NixOS configurations, packages, and updates
- Development Tools: LSP configuration, syntax highlighting, Git integration, and diagnostics
- Session Management: Save and restore editing sessions with persistent workspaces
- File Navigation: Telescope integration for fuzzy finding, project navigation, and more
- Code Operations: LSP-powered code actions, diagnostics, and reference exploration
- Unified Notifications: Intelligent notification system with category-based filtering and module-specific controls
- Performance Optimized: Fast startup with optimized lazy-loading and efficient autocmd configuration
NeoVim will open with the dashboard which includes the following options:
| Key | Description |
|---|---|
s |
Restore Session - Load a saved session |
r |
Recent Files - Browse and open recently edited files |
e |
Explorer - Toggle the NvimTree file explorer |
f |
Find File - Search for files in your project |
g |
Find Text - Search for text content across files |
n |
New File - Create and start editing a new file |
c |
Config - Browse Neovim configuration files |
i |
Info - View Neovim configuration information |
m |
Manage Plugins - Open the Lazy plugin manager |
h |
Checkhealth - Run Neovim's health diagnostics |
q |
Quit - Exit Neovim |
The dashboard provides quick access to common actions and makes it easy to start working on your projects such as:
- Resume previous work in a session
- Navigate recent files
- Start new projects
- Access configuration
- Manage your Neovim setup
Press the corresponding key to activate any option, or use your mouse to click on the desired action.
This configuration requires several dependencies including Neovim (≥ 0.9.0), Git, Node.js, Python 3, and the uv package manager for MCP-Hub AI integration.
For complete installation requirements and step-by-step setup instructions, see the Installation Guide.
This configuration features comprehensive documentation following DOCUMENTATION_STANDARDS.md. Every directory contains a README.md with detailed information about its purpose, components, and usage.
Topic-focused documentation covering major systems and workflows:
- Architecture - System design, initialization flow, and component architecture
- Installation - Setup instructions, dependencies, and health checks
- Mappings - Complete keybinding reference organized by context
- AI Tooling - Git worktrees with OpenCode for parallel development
- Research Tooling - LaTeX, Markdown, Jupyter, and academic workflows
- NIX Workflows - NixOS system integration and management
- Formal Verification - Lean 4 and model-checker integration
- Notifications - Unified notification system
- Code Standards - Lua coding conventions
- Documentation Standards - Documentation requirements
Detailed READMEs in every directory documenting modules and functionality:
- NeoTeX Namespace - Configuration overview and bootstrap process
- Configuration Core - Essential Neovim settings (options, keymaps, autocommands)
- Plugin System - Plugin organization and management
- AI Integration - Avante, Claude Code, and MCP Hub
- Editor Enhancements - Navigation, formatting, and terminal integration
- LSP Configuration - Language server setup and completion
- Text Processing - LaTeX, Markdown, Jupyter, and Lean support
- Development Tools - Git, snippets, and productivity enhancements
- UI Components - File explorer, status line, and visual elements
- Core Functionality - Fundamental utilities and base functionality
- Utility Functions - Helper functions and performance optimization tools
- Deprecated Code - Legacy code preserved for reference
- File Type Support - Language-specific configurations and detection
- Templates - Document templates for LaTeX, presentations, and academic writing
- Code Snippets - Custom snippet collections for rapid development
- Scripts - Maintenance and diagnostic utilities
Each README follows DOCUMENTATION_STANDARDS.md and includes:
- Purpose Statement: Clear description of directory role
- Module Documentation: Details for each file with examples
- Related Documentation: Cross-references to relevant docs
- Navigation Links: Parent and subdirectory relationships
This documentation structure ensures information is easily accessible with consistent organization throughout the configuration.
The scripts/ directory contains utility scripts for maintaining and troubleshooting the configuration:
- Plugin Analysis:
scripts/check_plugins.lua- Verify plugin loading and organization - MCP Integration: Scripts for testing and repairing AI tool integration
- Diagnostics: Comprehensive tests for configuration components
See scripts/README.md for detailed script documentation and usage instructions.
-
Check for Conflicts: Before adding new keybindings, check for conflicts with:
:verbose map <key-combo>This shows if the key is already mapped and in which file.
-
Test Changes Incrementally: Make small changes and test them before proceeding to more complex modifications.
-
Update Documentation: Always update docstrings in the corresponding files when making changes:
- For keymappings: Update comments in
keymaps.lua - For which-key entries: Update the reference at the top of
which-key.lua - For new features: Add documentation to this README.md
- For keymappings: Update comments in
-
Organize Related Functions: Keep related functionality together in appropriate files:
- Core settings:
lua/neotex/core/ - Plugin configurations:
lua/neotex/plugins/ - Filetype-specific settings:
after/ftplugin/
- Core settings:
Avante provides AI-powered code assistance directly within Neovim, offering intelligent code completion, explanations, refactoring suggestions, and conversational help. It supports multiple AI providers including Claude (Anthropic), GPT (OpenAI), and Gemini (Google).
[Info] The
leaderkey is set tospace.
- Access the AI: Press
<leader>aato ask a question or<leader>atto toggle project-specific TTS notifications - Edit with AI: Select text in visual mode and press
<leader>aeto edit with AI assistance - Claude Code: Use
<C-c>to toggle Claude Code sidebar (works in any mode)
- Switch Models: Press
<leader>amto select a model for the current provider - Change Provider: Press
<leader>apto select AI provider (Claude, OpenAI, Gemini) - Resume Sessions: Use
<leader>arto open Claude session picker
More details are provided in Making Configuration Changes below.
Avante is particularly useful for understanding and modifying this Neovim configuration:
- Explore Features: Ask Avante about specific features, e.g., "How do I use VimTeX in this configuration?"
- Get Help with Keymappings: Ask "What are the keybindings for this [feature]?"
- Customize Settings: Ask "How can I change [setting]?" or "Help me add a new keybinding for [action]"
- Troubleshoot Issues: Describe any problems you encounter for guided troubleshooting
- Add New Features: Get assistance with integrating new plugins or features and understanding documentation
Example prompts:
- "I want to add a new LaTeX template. How should I do that?"
- "Help me understand the Markdown list handling in this setup"
- "Show me how to create a custom system prompt for Avante"
When in an Avante buffer (AI interface):
| Key | Action |
|---|---|
q |
Quit Avante |
<C-t> |
Toggle Avante interface |
<C-c> |
Reset/clear Avante content |
<C-m> |
Select model for current provider |
<C-p> |
Select provider and model |
<C-s> |
Stop AI generation |
<C-d> |
Select provider/model with default |
<CR> |
Create new line (not submission) |
<C-j> |
Move up between panes |
<C-k> |
Move down between panes |
<C-l> |
Accept suggestion (insert mode) |
<C-h> |
Dismiss suggestion |
o |
Select 'ours' in diff |
t |
Select 'theirs' in diff |
a |
Select all 'theirs' in diff |
b |
Select both in diff |
c |
Select at cursor in diff |
n |
Jump to next |
N |
Jump to previous |
A |
Apply all in sidebar |
a |
Apply at cursor in sidebar |
<Tab> |
Switch windows in sidebar |
<S-Tab> |
Reverse switch windows in sidebar |
Avante AI can be an invaluable tool when modifying this configuration. When modifying this Neovim configuration, follow these guidelines to ensure consistency and prevent conflicts.
-
Ask for Documentation: Use Avante to generate detailed docstrings by asking:
Help me create a comprehensive docstring for this function: [paste function] -
Understand Existing Code: Ask Avante to explain complex parts of the configuration:
Explain how this (LaTeX) code works: [paste code] -
Find Keybinding Conflicts: Ask Avante to help identify conflicts:
Check if these keybindings might conflict with existing ones: [list keys] -
Generate Configuration Snippets: Get help creating new configuration:
Help me create a configuration for [plugin/feature] that works with my existing setup/needs -
Troubleshoot Issues: When something isn't working, ask Avante:
I'm having an issue with [feature]. Here's the relevant configuration and error...
This configuration provides extensive keybinding customizations to enhance productivity and provide a cohesive editing experience. The keybindings are organized through two main systems:
For complete keybinding reference, see:
- Complete Mappings Documentation - Comprehensive reference of all keybindings organized by context and functionality
- Which-Key Configuration - Interactive keybinding discovery system with contextual menus
- Core Keymaps Configuration - Base keybinding definitions and customizations
Defines the fundamental key mappings including:
- Navigation: Window movement, buffer switching, and cursor positioning
- Editing: Text manipulation, folding, and basic operations
- Terminal: Terminal mode bindings and window management
- File operations: Basic file handling and URL opening
Provides the which-key system for:
- Leader-based mappings: Organized hierarchical command structure under
<space> - Contextual help: On-screen menus showing available key combinations
- Filetype-specific bindings: Dynamic keybindings that appear based on current file type
- Plugin integration: Unified access to plugin functionality
- Leader key:
<space>- Access to all major functionality through organized menus - Help system: Press
<leader>and wait to see available commands - Complete reference: See docs/MAPPINGS.md for full details
- Avante AI integration: Ask Avante about specific keybindings with
<leader>ai
Lectic provides AI-assisted writing for markdown files with these features:
- Quick File Creation:
<leader>mncreates a new Lectic file with a template - Full-File Processing:
<leader>mlruns Lectic on the entire file - Visual Selection Processing:
- Select text in visual mode (
v,V, or<C-v>) - Press
<Esc>to exit visual mode - Press
<leader>msto process the selected text - You'll be prompted to add a message/question about the selection in a multi-line input box
- Both the selected text and your message will be added to the end of the file with appropriate formatting
- Lectic will then process the entire file
- Select text in visual mode (
Use Lectic for AI-assisted writing, brainstorming, or refining your markdown documents.
This configuration uses nvim-surround with filetype-aware buffer configurations to provide context-appropriate text manipulation. The same keybindings produce different outputs depending on the file type.
ys{motion}{char}- Add surround around motionds{char}- Delete surrounding charactercs{old}{new}- Change surround from old to newS{char}- Surround visual selection (visual mode)
Examples:
ysiw"- Surround word with double quotesds{- Delete surrounding curly bracescs"'- Change double quotes to single quotes
Markdown Files (.md) Special surrounds available only in markdown:
| Key | Result | Description |
|---|---|---|
b |
**text** |
Bold (strong emphasis) |
i |
*text* |
Italic (emphasis) |
` |
`text` |
Inline code |
c |
```lang\ntext\n``` |
Fenced code block (prompts for language) |
l |
[text](url) |
Link (prompts for URL) |
~ |
~~text~~ |
Strikethrough (GFM) |
LaTeX Files (.tex) Special surrounds available only in LaTeX:
| Key | Result | Description |
|---|---|---|
e |
\begin{env}...\end{env} |
Environment (prompts for name) |
b |
\textbf{text} |
Bold text |
i |
\textit{text} |
Italic text |
t |
\texttt{text} |
Typewriter (monospace) |
q |
`text' |
LaTeX single quotes |
Q |
text'' `` |
LaTeX double quotes |
$ |
$text$ |
Math mode |
Filetype Isolation
This design prevents cross-filetype pollution - pressing ysiw + b on "word" produces:
**word**in markdown files (markdown bold)\textbf{word}in LaTeX files (LaTeX bold)
For complete surround documentation, see:
This configuration includes a smart folding system with the following features:
- Performance-Focused: Default folding method is
manualfor better performance - Smart Toggling: Press
<leader>mfto toggle between:- Manual folding (better performance)
- Smart folding (expr for markdown, indent for other filetypes)
- Persistent Settings: Your folding preference persists between Neovim sessions
- Markdown-Aware: When smart folding is enabled for markdown files, folds will be created at headers
- Comprehensive Mappings:
<leader>ma- Toggle all folds open/closed<leader>mf- Toggle fold under cursor<leader>mt- Toggle folding method (manual/smart)- All standard Vim folding keys (za, zo, zc, zR, zM) also work
The system is integrated throughout the configuration to provide a consistent experience across all file types while prioritizing performance.
This configuration includes a comprehensive URL handling system for all file types:
- Universal Functionality: Works in any file type, not just markdown
- Multiple URL Types: Recognizes various URL formats:
- Standard URLs (https://, http://, file://)
- Markdown links (text)
- HTML links (text)
- Email addresses (user@example.com)
- Convenient Access:
- Press
gxto open URL under cursor Ctrl+Clickto open URL at mouse position<leader>muto open URL under cursor via keybinding
- Press
- Cross-Platform: Works on Linux, macOS, and Windows
This configuration provides comprehensive support for working with Jupyter notebooks through three integrated plugins:
- Jupytext: Converts between Jupyter notebooks (.ipynb) and text formats (.md, .py)
- NotebookNavigator: Enables cell-based navigation and execution
- Iron.nvim: Provides REPL integration for Python, Julia, R, and Lua
- Notebook Mode: Work with notebook-style cells in markdown or Python files
- Format Conversion: Convert between .ipynb, .md, and .py formats
- Cell Navigation: Move between code/markdown cells with keyboard shortcuts
- Cell Execution: Run cells directly and see output in a REPL
- Interactive REPL: Send code snippets, lines, or files to the REPL
- Smooth Workflow: Integrated keybindings for all notebook operations
| Key | Action |
|---|---|
<leader>je |
Execute current cell |
<leader>jj |
Navigate to next cell |
<leader>jk |
Navigate to previous cell |
<leader>jn |
Execute cell and move to next |
<leader>jo |
Insert new cell below |
<leader>jO |
Insert cell above |
<leader>js |
Split cell at cursor position |
<leader>jc |
Comment current cell |
<leader>ja |
Run all cells in file |
<leader>jb |
Run current and all cells below |
<leader>ju |
Merge with cell above |
<leader>jd |
Merge with cell below |
<leader>ji |
Start IPython REPL |
<leader>jt |
Send motion to REPL |
<leader>jl |
Send current line to REPL |
<leader>jf |
Send entire file to REPL |
<leader>jv |
Send visual selection to REPL |
<leader>jq |
Exit REPL |
<leader>jr |
Clear REPL screen |
<leader>jc |
Show jupytext config |
The system recognizes cells based on these markers:
- Python: Cells are delimited by
# %%or#%%comments - Markdown: Cells are delimited by code blocks starting/ending with ``` (triple backticks)
- Create a Python or Markdown file with cell markers
- Navigate between cells with
<leader>jjand<leader>jk - Execute cells with
<leader>jeor execute and move to next with<leader>jn - Add new cells with
<leader>jo(below) or<leader>jO(above) - Use additional features like
<leader>js(split cell),<leader>jc(comment cell), or<leader>ja(run all cells)
This integration provides a seamless experience for data analysis, scientific computing, and literate programming without leaving Neovim.
This configuration includes convenient keybindings for managing NixOS systems directly from Neovim, streamlining system administration tasks:
| Key | Action |
|---|---|
<leader>nr |
Rebuild system from flake |
<leader>nh |
Apply home-manager changes |
<leader>nu |
Update flake dependencies |
<leader>ng |
Clean up old nix packages |
<leader>nd |
Enter nix development shell |
| Key | Action |
|---|---|
<leader>np |
Open NixOS packages website |
<leader>nm |
Open MyNixOS website |
- System Rebuilding: Quickly rebuild your NixOS configuration from flakes
- Home Manager: Apply user-specific configuration changes
- Package Management: Update dependencies and clean up old generations
- Development Environment: Enter development shells for project-specific dependencies
- Resource Access: Quick links to NixOS package search and configuration tools
These commands integrate NixOS system management into your development workflow, allowing you to manage system configuration, packages, and environments without leaving your editor.
This configuration is optimized for fast startup and responsive editing:
- Optimized Lazy-Loading: Plugins load precisely when needed, not earlier
- Session Manager loads on VeryLazy event (after startup complete)
- LSP file operations load on BufReadPost (when reading files)
- nvim-surround loads on BufReadPost (ready for text manipulation)
- Efficient Autocommands: File reload detection uses FocusGained and BufEnter events
- No CursorHold/CursorHoldI events that cause cursor pause lag
- Reduced autocmd fires by 98% compared to cursor-based detection
- Enhanced Icons: nvim-web-devicons includes common file type icons (TypeScript, Rust, Go, YAML, TOML, Dockerfile, .env)
- Clean Logging: Markdown preview uses 'warn' log level (90% reduction in debug output)
Built-in tools for analyzing and improving performance:
- Startup Analysis: Run
:AnalyzeStartupto identify bottlenecks in your NeoVim startup process - Plugin Profiling: Use
:ProfilePluginsto measure load times for all plugins - Optimization Reports: Generate comprehensive reports with
:OptimizationReport - Lazy-Loading Suggestions: Get plugin-specific recommendations with
:SuggestLazyLoading
These tools provide actionable insights to help you maintain a fast and responsive editing environment. See the comprehensive documentation in lua/neotex/utils/README.md for more details on the optimization workflow.
After making changes:
- Source the modified file with
<leader>rror (better) restart Neovim - Test the functionality in realistic scenarios
- Check for any error messages in
<leader>rs - Use
:checkhealthto verify plugin health (also linked in the dashboard<leader>rd) - If issues occur, use
:verbosecommands to debug
Remember that a well-documented configuration is easier to maintain and extend. Take the time to add clear comments and keep this README updated as the configuration evolves.
- Configuration → - Options, keymaps, and autocommands
- Plugins → - Plugin system and organization
- Utilities → - Helper functions and optimization tools
- Templates → - LaTeX document templates
- Snippets → - Code snippet collections
- Scripts → - Maintenance and diagnostic utilities
- File Types → - Language-specific configurations
- Installation Guide → - Setup instructions
- Keybinding Reference → - Complete keymap documentation
By default, debug messages are hidden to keep your Neovim experience clean. If you need to see these messages for troubleshooting:
-
View all notification levels:
:lua vim.notify_level = vim.log.levels.DEBUG
-
View even more verbose messages (including trace level):
:lua vim.notify_level = vim.log.levels.TRACE
-
Check notification history: Press
<leader>rmto view the notification history, which includes all past messages. -
Return to normal notifications (hide debug messages again):
:lua vim.notify_level = vim.log.levels.INFO
These debug messages can be helpful when diagnosing plugin loading issues, performance problems, or other configuration concerns.