Code Commenting: Comment.nvim
Comment.nvim provides intelligent code commenting that understands multiple languages and contexts.Features
- Context-Aware: Understands JSX/TSX and adjusts comment style based on cursor position
- Language Support: Works with all languages supported by tree-sitter
- Multiple Comment Styles: Line comments and block comments
- Visual Mode: Comment selections in visual mode
Keybindings
Normal Mode
| Keybinding | Action |
|---|---|
gcc | Toggle line comment |
gbc | Toggle block comment |
gc{motion} | Comment using motion (e.g., gcip for paragraph) |
gb{motion} | Block comment using motion |
Visual Mode
| Keybinding | Action |
|---|---|
gc | Toggle line comment for selection |
gb | Toggle block comment for selection |
Usage Examples
JSX/TSX Context Awareness
Comment.nvim integrates with nvim-ts-context-commentstring to use the correct comment style:Configuration
Location:lua/magictt/plugins/comment.lua
Auto Pairs: nvim-autopairs
nvim-autopairs automatically inserts matching brackets, quotes, and parentheses as you type.Features
- Auto Insert: Automatically adds closing pairs
- Auto Delete: Deletes both pairs when backspacing
- Fast Wrap: Quick wrapping of text in pairs
- Treesitter Integration: Smarter pair insertion based on syntax
- Completion Integration: Works seamlessly with nvim-cmp
Smart Behavior
The plugin is smart enough to:- Not add pairs inside strings (Lua)
- Not add pairs in template strings (JavaScript)
- Jump over closing pairs instead of inserting duplicates
- Delete both pairs when backspacing an empty pair
Treesitter Configuration
Special rules for specific languages:Usage Examples
Configuration
Location:lua/magictt/plugins/autopairs.lua
Surround Text: nvim-surround
nvim-surround provides powerful operators to add, delete, and change surrounding characters (quotes, brackets, tags, etc.).Core Operations
| Operation | Description | Example |
|---|---|---|
| Add | Add surrounding | ysiw" adds quotes around word |
| Delete | Delete surrounding | ds" removes surrounding quotes |
| Change | Change surrounding | cs"' changes ” to ‘ |
Keybindings
Add Surroundings (ys)
ysiw)- Surround word with ()ysiw]- Surround word with []ysiw}- Surround word withysiw"- Surround word with ""ysiw'- Surround word with ”ysiwt- Surround word with HTML tagyss)- Surround entire line
Delete Surroundings (ds)
ds"- Delete surrounding ""ds'- Delete surrounding ”ds)- Delete surrounding ()ds}- Delete surroundingdst- Delete surrounding HTML tag
Change Surroundings (cs)
cs"'- Change ” to ’cs'"- Change ’ to ”cs(- Change ( to other delimitercs)"- Change ) to ”cst"- Change tag to “
Usage Examples
Visual Mode
Select text in visual mode, then pressS followed by the desired surrounding:
- Select text →
S"→ wraps in quotes - Select text →
S)→ wraps in parentheses - Select text →
St→ prompts for HTML tag
Configuration
Location:lua/magictt/plugins/surround.lua
Quick Substitution: substitute.nvim
substitute.nvim provides a quick way to substitute text without affecting registers.Features
- Register Preservation: Doesn’t overwrite your yanked text
- Motion Support: Works with any Neovim motion
- Visual Mode: Substitute selected text
- Quick Operations: Faster than traditional substitute commands
Keybindings
| Keybinding | Mode | Action |
|---|---|---|
s{motion} | Normal | Substitute using motion |
ss | Normal | Substitute entire line |
S | Normal | Substitute from cursor to end of line |
s | Visual | Substitute visual selection |
Workflow
- Yank the text you want to use for substitution
- Use
soperator with a motion (e.g.,siwfor inner word) - The motion target is replaced with yanked text
- Your yank register remains unchanged
Usage Examples
Configuration
Location:lua/magictt/plugins/substitute.lua
Keybinding Helper: which-key.nvim
which-key.nvim displays available keybindings in a popup window after you start typing a key sequence.Features
- Automatic Display: Shows after 500ms timeout
- Grouped Keybindings: Organizes keys by functionality
- Search: Filter keybindings in the popup
- Learning Aid: Perfect for discovering and remembering keybindings
Defined Key Groups
Magictt defines these leader key groups:| Prefix | Group | Description |
|---|---|---|
<leader>d | Diagnostics | LSP diagnostics commands |
<leader>e | Explorer | File explorer commands |
<leader>f | Find | Telescope find commands |
<leader>h | Harpoon | Harpoon navigation |
<leader>l | Lazy | Lazy.nvim panels |
<leader>m | Mason | Mason LSP installer |
<leader>n | NoHighlight | Clear search highlight |
<leader>s | Splits | Window split commands |
<leader>t | Tabs | Tab management |
<leader>w | Workspace | Session management |
<leader>x | Trouble | Trouble diagnostics list |
Usage
- Press
<leader>(Space key by default) - Wait 500ms - which-key popup appears
- See all available keybindings for that prefix
- Press the next key to execute the command
Configuration
Location:lua/magictt/plugins/which-key.lua
TODO Comments: todo-comments.nvim
todo-comments.nvim highlights and provides navigation for comment annotations like TODO, HACK, BUG, etc.Supported Keywords
- FIX / FIXME: Things that need to be fixed
- TODO: Tasks to be done
- HACK: Temporary workarounds
- WARN / WARNING: Important warnings
- PERF / PERFORMANCE: Performance-related notes
- NOTE / INFO: General information
- TEST: Test-related notes
Keybindings
| Keybinding | Action |
|---|---|
]t | Jump to next TODO comment |
[t | Jump to previous TODO comment |
<leader>ft | Search all TODOs with Telescope |
<leader>xt | Open TODOs in Trouble list |
Usage Examples
Configuration
Location:lua/magictt/plugins/todo-comments.lua
Diagnostic List: trouble.nvim
trouble.nvim provides a beautiful list for viewing diagnostics, references, quickfix items, and more.Features
- Diagnostic List: All workspace or document diagnostics
- Quickfix Integration: Enhanced quickfix list
- Location List: Better location list display
- TODO Integration: View all TODO comments in one place
- Auto-focus: Automatically focuses the trouble window
Keybindings
| Keybinding | Action |
|---|---|
<leader>xw | Open workspace diagnostics |
<leader>xd | Open document diagnostics |
<leader>xq | Open quickfix list |
<leader>xl | Open location list |
<leader>xt | Open TODO comments list |
Usage Workflow
- Code with errors/warnings shows diagnostic indicators
- Press
<leader>xdto see all document diagnostics - Navigate through the list with
j/k - Press
Enterto jump to diagnostic location - Press
qto close the trouble window
Configuration
Location:lua/magictt/plugins/trouble.lua
Split Maximizer: vim-maximizer
vim-maximizer allows you to temporarily maximize the current split window, hiding all others.Features
- Toggle Maximize: Make current split fullscreen and restore
- Preserved Layout: Original split layout is restored
- Quick Toggle: Single keybinding to maximize/restore
Keybinding
| Keybinding | Action |
|---|---|
<leader>sm | Toggle maximize/minimize current split |
Usage
- Open multiple splits
- Press
<leader>smto maximize current split - Work in fullscreen
- Press
<leader>smagain to restore split layout
Configuration
Location:lua/magictt/plugins/vim-maximizer.lua
Markdown Rendering: markview.nvim
markview.nvim enhances the markdown viewing experience with live rendering.Features
- Live Preview: See rendered markdown in the editor
- Syntax Highlighting: Enhanced markdown syntax
- Better Visuals: Improved heading styles, lists, and formatting
Configuration
Location:lua/magictt/plugins/markview.lua
Keybindings Summary
Quick Reference
| Plugin | Key | Action |
|---|---|---|
| Comment | gcc | Toggle line comment |
| Comment | gc{motion} | Comment with motion |
| Autopairs | Auto | Pairs automatically |
| Surround | ysiw" | Add surround |
| Surround | ds" | Delete surround |
| Surround | cs"' | Change surround |
| Substitute | s{motion} | Substitute with motion |
| Substitute | ss | Substitute line |
| Which-key | <leader> | Show keybindings |
| TODO | ]t / [t] | Next/prev TODO |
| Trouble | <leader>xd | Document diagnostics |
| Trouble | <leader>xw | Workspace diagnostics |
| Maximizer | <leader>sm | Toggle maximize |
Related Documentation
Plugin Overview
See all installed plugins
Keybindings
Complete keybinding reference