Neovim Configuration
Config-Sway includes a modern Neovim setup based on NvChad v2.5, providing a powerful IDE-like experience with LSP support, syntax highlighting, and efficient keybindings.Configuration Structure
NvChad Framework
What is NvChad?
NvChad is a Neovim configuration framework that provides:- Pre-configured LSP (Language Server Protocol)
- Modern UI with custom statusline
- File explorer (NvimTree)
- Fuzzy finder (Telescope)
- Git integration
- Syntax highlighting (Treesitter)
Initialization
~/.config/nvim/init.lua
Space
Plugin Management
- Lazy loading improves startup time
- NvChad v2.5 provides base functionality
- Custom plugins loaded from
lua/plugins/
Core Configuration
Editor Options
~/.config/nvim/init.lua
- Line numbers: Absolute line numbers displayed
- Relative numbers: Distance from current line (useful for motions like
5j)
Additional Options
~/.config/nvim/lua/options.lua
Keybindings
Exit Mode Bindings (ZX)
Exit Mode Bindings (ZX)
NvChad Default Keybindings
NvChad Default Keybindings
LSP Configuration
Language Server Setup
~/.config/nvim/lua/configs/lspconfig.lua
:Mason
Install servers:
LSP Keybindings
Once LSP is active in a buffer:Code Formatting
Conform.nvim
~/.config/nvim/lua/configs/conform.lua
Space + fm
Auto-format on save:
File Explorer (NvimTree)
Opening NvimTree
Ctrl + N- Toggle file explorerSpace + e- Focus file explorer
NvimTree Navigation
Fuzzy Finding (Telescope)
Search Commands
Quick Keybindings
Space + ff- Find filesSpace + fw- Find word (live grep)Space + fb- Find buffersSpace + fh- Find helpSpace + fo- Find old filesSpace + fz- Find in current buffer
Telescope Navigation
Syntax Highlighting (Treesitter)
NvChad includes Treesitter for advanced syntax highlighting and code understanding.Installing Parsers
Treesitter Features
- Syntax highlighting - Context-aware colors
- Code folding - Fold functions, classes, blocks
- Incremental selection - Expand selection based on syntax tree
- Indentation - Smart auto-indent
Customization
Adding Custom Plugins
Adding Custom Plugins
Edit Restart Neovim to install new plugins.
~/.config/nvim/lua/plugins/init.lua:Changing Theme
Changing Theme
NvChad includes multiple themes:List themes:Or use keybinding:
Space + thSet default theme:Edit ~/.config/nvim/lua/chadrc.lua:Custom Auto-commands
Custom Auto-commands
Edit
~/.config/nvim/lua/autocmds.lua:Useful Commands
NvChad Commands
Plugin Management
Mason (LSP/Tools)
Troubleshooting
Neovim slow to start
Neovim slow to start
Profile startup time:Optimize plugin loading:
- Ensure plugins are set to
lazy = truewhere possible - Use
event,ft, orcmdtriggers for lazy loading
LSP not working
LSP not working
Check if LSP is attached:Install language server:Restart LSP:Check logs:
Treesitter highlighting broken
Treesitter highlighting broken
Update parsers:Reinstall specific parser:Check health:
Plugins not loading
Plugins not loading
Sync plugins:Clear cache:Then restart Neovim.
Neovim Tips
Learning Vim motions
Learning Vim motions
Built-in tutor:Practice with:
vimtutor- Interactive tutorial- Vim Adventures - Game-based learning
- OpenVim - Interactive tutorial
Useful motions
Useful motions
ciw- Change inner worddi"- Delete inside quotesva{- Select around curly bracesgg=G- Auto-indent entire file:%s/old/new/g- Replace all occurrences.- Repeat last change*- Search for word under cursor<C-o>- Jump to previous location<C-i>- Jump to next location
Macro recording
Macro recording
- Press
q+ letter (e.g.,qafor register ‘a’) - Perform actions
- Press
qto stop recording - Play macro with
@a - Repeat with
@@
qa, type :s/foo/bar<CR>, press q, then @a to replay.Related Configuration
Kitty Terminal
Terminal emulator where Neovim runs
Sway Keybindings
Window manager shortcuts
Additional Resources
- NvChad Documentation - Official NvChad docs
- Neovim Documentation - Neovim reference
- Lua Guide for Neovim - Learn Lua config
- Awesome Neovim - Plugin directory