Mastering Neovim and tmux can streamline your coding workflow, but remembering all the key mappings can be challenging. This post outlines the essential keybindings I use in my Neovim setup, covering navigation, editing, search, and window management. For the full configuration, check out my GitHub repository . Let's explore the key combinations that make Neovim so powerful!
Navigation
`h`
: move cursor left-
`l`
: move cursor right -
`j`
: move cursor top -
`k`
: move cursor down -
`w`
: move to next word -
`b`
: move to previous word -
`e`
: move to next end of word -
`ge`
: move to previous end of word -
`0`
: move to the start of a line -
`$`
: move to the end of a line -
`gg`
: move the first line of the document -
`G`
: move to then last line of the document -
`u`
: undo change -
`ctrl + r`
: redo changes -
`ctrl + u`
: Half-page up -
`ctrl + d`
: Half-page down -
`ctrl + b`
: page down -
`ctrl + f`
: page up -
`K`
: show definition -
`gi`
: go to implementation using LSP -
`%`
: jump to matching parenthesis or brace or bracket
Search & Replace
-
`:%s/article/tutorial/g`
: To search and replace all occurrences on every line of the file -
`:%s/article/tutorial/gi`
: same as above but Case-Insensitive -
`:%s/article/tutorial/gc`
: with confirmation Each time we get a prompt, we have the option to press "y" for yes, "n" for no, and "a" for all occurrences. We can also press "q" to quit, or "l" to replace only one line - see this for more https://www.baeldung.com/linux/vim-search-replace
Search
-
`/`
: search -
`n and N`
: to move between the results of the search -
`:noh`
or`space + nh`
: to clear search highlights
Edit
-
`ci"`
: change inside double quotes -
`ciB`
: change inside brackets -
`ro`
: example to replace character under curser with the letter o, this work in normal mode, To replace multiple characters with different characters, use R -
`D or d$`
: to delete to the end of the line -
`A`
: insert at the end of the line
Inside/Around tags
-
`yit`
: yank inside tags -
`cit`
: change inside tags -
`dat`
: delete around tags
Copy Paste
-
`yiw`
: Yank inner word (copy word under cursor, say "first") - Move the cursor to another word (say "second")
-
`ciw + ctrl + r + 0`
: Change "second", replacing it with "first" - Move the cursor to another word (say "third")
-
`.`
: Change "third", replacing it with "first"
Select and copy all
-
`ggyG`
: go to the first line and yank to the end of a file
Selection (visual mode)
`iw`
: select inter word-
`viW`
: select any sequence of none blank characters -
`vip`
: select a paragraph (sequence of none empty lines) -
`vi"`
: select inter between those braces -
`va"`
: select around those braces -
`ctrl + v`
: visual block select -
`o`
: for switching selection direction in visual mode -
`vK or vJ`
: move selected line up or down
Vim window & tab management
-
`space + sv`
: split vertical -
`space + sh`
: split horizontal -
`space + se`
: split equal -
`space + sx`
: close current split window -
`space + to`
: open new tab -
`space + tx`
: close current tab -
`space + tn`
: go to next tab -
`space + tp`
: go to previous tab
Vim buffers
-
`:b + tab`
: show and move between opened buffers -
`:1bw`
: to close the buffer with the id 1
Telescope
-
`space + ff`
: find `files` by name -
`space + fs`
: find `string` in current working directory as you type -
`space + fc`
: find string under `cursor` in current working directory -
`space + fb`
: list open `buffers` in current neovim instance -
`ctrl + c`
: quit or hide
nvim-tree
-
`g?`
: show mappings -
`a`
: create a file -
`c`
: copy -
`d`
: delete -
`D`
: trash -
`r`
: rename -
`S`
: search -
`y`
: copy name -
`ctrl + t`
: Open file in New Tab
Tmux
-
`tmux new -s name`
: to create a new session -
`tmux detach`
: to exit the session -
`tmux ls`
: list of sessions created -
`tmux attach -t name`
: to go back to specific session -
`ctrl + as`
: see and navigate between all sessions created -
`ctrl + ar`
: reload -
`ctrl + aI`
: install plugins -
`ctrl + ac`
: create a new window -
`ctrl + a + index of window`
or (`n` or `p`too) : to navigate between windows -
`ctrl + a,`
: rename a window -
`ctrl + aw`
: list of windows created