Skip to content

My Custom KeyBindings

Mode(s)Key(s)Action / CommandDescription
Normal;:Enter command mode
Insertjk<ESC>Exit insert mode
Normal, Insert, VisualCtrl + S<cmd> w <cr>Save file
InsertAlt + h<Left>Move left in insert mode
InsertAlt + j<Down>Move down in insert mode
InsertAlt + k<Up>Move up in insert mode
InsertAlt + l<Right>Move right in insert mode
NormalCtrl + AggVGSelect all
InsertCtrl + A<ESC>ggVGSelect all in insert mode
VisualCtrl + A<ESC>ggVGSelect all in visual mode
Normal<leader>lg<cmd>LazyGit<CR>Open LazyGit
Visual<leader>iviSelect inside {}
Visual<leader>avaSelect around {}
Normal, Visual<leader>1…<leader>9Switch buffer using buffer list lookupBuffer navigation
Normal, TerminalAlt + irequire("nvchad.term").toggle { pos="float", id="floatTerm", ... }Toggle floating terminal
NormalCtrl + h<cmd>TmuxNavigateLeft<CR>Tmux navigate left
NormalCtrl + j<cmd>TmuxNavigateDown<CR>Tmux navigate down
NormalCtrl + k<cmd>TmuxNavigateUp<CR>Tmux navigate up
NormalCtrl + l<cmd>TmuxNavigateRight<CR>Tmux navigate right
NormalCtrl + \<cmd>TmuxNavigatePrevious<CR>Tmux navigate previous

Vim/Neovim (CheatSheet)

Vim operates in different modes: Normal (default, press Esc), Insert (typing text, press i/a/o), Visual (selecting text, press v), and Command (executing commands, press 😃

Tips for Beginners

  • Start with vimtutor - run this command in your terminal for an interactive tutorial
  • Use hjkl for movement instead of arrow keys to build muscle memory
  • Stay in normal mode as much as possible - only enter insert mode when actively typing
  • Learn one new command per day rather than trying to memorize everything at once
  • Practice the most common operations: navigation, insertion, deletion, and saving
  • Use :help extensively - Vim's built-in documentation is excellent

Configuration

Add these common settings to your ~/.vimrc file:

Display Settings

vim
set number          " Show line numbers
set relativenumber  " Show relative line numbers
syntax on           " Enable syntax highlighting

Buffer Settings

vim
set hidden                  " Allow unsaved buffer switching
set autowrite              " Auto-save when switching buffers
set confirm                 " Ask before discarding changes
set switchbuf=useopen       " Jump to existing window if open

Indentation

vim
set tabstop=4       " Set tab width
set shiftwidth=4    " Set indent width
set expandtab       " Use spaces instead of tabs
set autoindent      " Auto-indent new lines

Search Settings

vim
set hlsearch        " Highlight search results
set incsearch       " Incremental search
set ignorecase      " Case-insensitive search
set smartcase       " Case-sensitive if uppercase present

Interface Settings

vim
set cursorline      " Highlight current line
set showmatch       " Highlight matching brackets
set ruler           " Show cursor position
set laststatus=2    " Always show status line
set wildmenu        " Enhanced command completion
set scrolloff=5     " Keep lines above/below cursor

Editor Behavior

vim
set noswapfile              " Disable swap files
set nobackup               " Disable backup files
set undofile               " Enable persistent undo
set clipboard=unnamedplus  " Use system clipboard
set mouse=a                " Enable mouse support

Modes

Mode Switching

CommandDescription
EscNormal mode
vVisual mode
VVisual line mode
Ctrl+vVisual block mode

Entering Insert Mode from Normal Mode

CommandDescription
iInsert mode
IInsert at line start
aAppend after cursor
AAppend at line end
oNew line below
ONew line above
sDelete char and insert
SDelete line and insert
giInsert at last position

Basic Movement

CommandDescription
h j k lLeft, down, up, right

Word Movement

CommandDescription
wWord forward
bWord backward
eEnd of word
WWORD forward
BWORD backward
EEnd of WORD

Line Movement

CommandDescription
0Line start
^First non-blank char
$Line end

Screen Movement

CommandDescription
HTop of screen
MMiddle of screen
LBottom of screen

File Navigation

CommandDescription
ggGo to top
GGo to bottom
:NGo to line number
Ctrl+fPage down
Ctrl+bPage up
Ctrl+dHalf page down
Ctrl+uHalf page up

Jump Navigation

CommandDescription
Ctrl+oJump back
Ctrl+iJump forward
g;Previous change
g,Next change

Character Motions

CommandDescription
f{char}Find character forward
F{char}Find character backward
t{char}To character forward
T{char}To character backward
;Repeat character motion
,Reverse character motion

Editing

Delete & Change

CommandDescription
xDelete character
XDelete char before cursor
ddDelete line
dwDelete word
d$Delete to end of line
d0Delete to start of line
DDelete to end of line
cwChange word
ccChange line
rReplace character

Copy & Paste

CommandDescription
yyCopy line
ywCopy word
y$Copy to end of line
y0Copy to start of line
pPaste after
PPaste before

Undo & Redo

CommandDescription
uUndo
Ctrl+rRedo
UUndo line changes

Text Objects

Word & Paragraph

CommandDescription
iwInner word
awA word (with space)
isInner sentence
asA sentence
ipInner paragraph
apA paragraph

Brackets & Quotes

CommandDescription
i(Inner block
a(A block
ibInner block
abA block
i"Inside quotes
a"Around quotes

Useful Combinations

CommandDescription
ciwChange inner word
di"Delete inside quotes
ya(Yank around block
>ipIndent paragraph
=GAuto-indent to end

Registers

Named Registers

CommandDescription
"ayYank to register a
"apPaste from register a
"AyAppend to register a

Special Registers

CommandDescription
"+System clipboard
"*Selection clipboard
"0Last yank
"1Last delete
"_Black hole register
:regShow all registers

Search & Replace

Searching

CommandDescription
/patternSearch forward
?patternSearch backward
nNext match
NPrevious match
*Search word under cursor
#Search word under cursor (back)

Replacing

CommandDescription
:s/old/new/Replace first on line
:s/old/new/gReplace all on line
:%s/old/new/gReplace all in file
:%s/old/new/gcReplace all with confirm

Global Commands

Pattern Matching

CommandDescription
:g/pattern/cmdExecute on matching lines
:v/pattern/cmdExecute on non-matching lines

Common Examples

CommandDescription
:g/pattern/dDelete lines containing pattern
:g/^$/dDelete empty lines
:g/pattern/t$Copy matching lines to end
:g/pattern/m$Move matching lines to end
:g/pattern/pPrint matching lines
:g/pattern/#Print with line numbers

File Operations

CommandDescription
:wSave file
:w filenameSave as
:qQuit
:q!Force quit
:wqSave and quit
:xSave and quit
:e filenameOpen file
:r filenameInsert file contents
:sp filenameHorizontal split open
:vsp filenameVertical split open

Shell Commands

Execute Commands

CommandDescription
:!commandRun shell command
:r!commandInsert command output
:%!commandFilter through command
:shellOpen shell

Common Examples

CommandDescription
:r!dateInsert date
:%!sortSort lines
:%!jq .Format JSON
:!wc %Word count

Visual Mode

Visual Selection

CommandDescription
vCharacter-wise selection
VLine-wise selection
Ctrl+vBlock-wise selection
oGo to other end
gvReselect last selection

Operations on Selection

CommandDescription
dDelete selection
yCopy selection
cChange selection
UUppercase
uLowercase
>Indent right
<Indent left
=Auto-indent

Folding

Create & Toggle

CommandDescription
zfCreate fold
zaToggle fold
zoOpen fold
zcClose fold
zdDelete fold

Fold Levels

CommandDescription
zROpen all folds
zMClose all folds
zrOpen one level
zmClose one level
:set fdm=indentFold on indent

Buffers

CommandDescription
:lsList buffers
:b NSwitch to buffer
:bnNext buffer
:bpPrevious buffer
:bdDelete buffer

Windows

Window Splits

CommandDescription
:splitSplit horizontal
:vsplitSplit vertical
Ctrl+w sSplit horizontal
Ctrl+w vSplit vertical

Window Navigation

CommandDescription
Ctrl+w wSwitch windows
Ctrl+w hMove to left window
Ctrl+w jMove to bottom window
Ctrl+w kMove to top window
Ctrl+w lMove to right window
Ctrl+w cClose window
Ctrl+w oClose all other windows
Ctrl+w =Equalize window sizes

Window Resizing

CommandDescription
Ctrl+w +Increase height
Ctrl+w -Decrease height
Ctrl+w >Increase width
Ctrl+w <Decrease width

Advanced

Marks

CommandDescription
m[a-z]Set local mark
m[A-Z]Set global mark
'[mark]Go to line of mark
`[mark]Go to exact position
''Go to previous position
'.Go to last edit

Macros

CommandDescription
q[a-z]Record macro
qStop recording
@[a-z]Execute macro
@@Repeat last macro

Repeat & Help

CommandDescription
.Repeat last command
:set nuShow line numbers
:help [cmd]Get help

Emergency

CommandDescription
EscReturn to normal mode
Ctrl+cReturn to normal mode
:q!Quit without saving
uUndo mistake
:helpGet help

Extra


#tech #vim #productivity #text-editor

Basic Movement

  • h - Move cursor left.
  • j - Move cursor down.
  • k - Move cursor up.
  • l - Move cursor right.
  • 0 - Move to the start of the line.
  • $ - Move to the end of the line.
  • G - Move to the end of the file.
  • gg - Move to the start of the file.
  • <C-g> - Show cursor location and file status.
  • number G - Move to a specific line number.

Editing Commands

  • x - Delete the character under the cursor.
  • dw - Delete a word.
  • d$ - Delete to the end of the line.
  • dd - Delete the entire line.
  • u - Undo the last change.
  • U - Undo all changes on the current line.
  • <C-r> - Redo the last undone change.
  • p - Paste text after the cursor.
  • P - Paste text before the cursor.
  • r - Replace the character under the cursor.
  • R - Enter Replace mode (replace multiple characters).
  • ce - Change text until the end of the word.
  • c$ - Change text until the end of the line.
  • o - Open a new line below the cursor and enter Insert mode.
  • O - Open a new line above the cursor and enter Insert mode.
  • a - Append text after the cursor.
  • A - Append text at the end of the line.
  • i - Insert text before the cursor.
  • y - Yank (copy) text.
  • yw - Yank a word.
  • yy - Yank a line.

Search and Replace

  • /phrase - Search forward.
  • ?phrase - Search backward/
  • n - Repeat the last search in the same direction.
  • N - Repeat the last search in the opposite direction.
  • % - Move to the matching parenthesis, bracket, or brace.
  • :s/old/new/ - Substitute "new" for the first occurrence of "old" in the current line.
  • :s/old/new/g - Substitute "new" for all occurrences of "old" in the current line.
  • :#,#s/old/new/g - Substitute "new" for "old" between two line numbers.
  • :%s/old/new/g - Substitute "new" for "old" in the entire file.
  • :%s/old/new/gc - Substitute with confirmation for each occurrence.

File Operations

  • :w - Save the file.
  • :w FILENAME - Save the file with a new name.
  • :q - Quit Neovim.
  • :q! - Quit Neovim without saving changes.
  • :wq - Save and quit.
  • :r FILENAME - Insert the contents of a file below the cursor.
  • :r !command - Insert the output of a shell command below the cursor.
  • :!command - Execute a shell command (e.g., :!ls).

Visual Mode

  • v - Start Visual mode (character-wise selection).
  • V - Start Visual mode (line-wise selection).
  • y - Yank (copy) the selected text.
  • d - Delete the selected text.
  • :w FILENAME - Save the selected lines to a file.

Settings and Options

  • :set ic - Ignore case in searches.
  • :set noic - Disable ignore case in searches.
  • :set hls - Highlight search matches.
  • :set is - Enable incremental search.
  • :set invic - Toggle ignore case.
  • :nohlsearch - Remove search highlighting.

Help and Completion

  • :help - Open the help system.
  • :help TOPIC - Get help on a specific topic.
  • <C-d> - Show command completions.
  • <Tab> - Use a completion.

Miscellaneous

  • <Esc> - Return to Normal mode.
  • <C-w><C-w> - Switch between windows.
  • <C-o> - Go back to the previous cursor position.
  • <C-i> - Go forward to the next cursor position.

Released under the MIT License.