Vim Movement Shortcuts

https://tryhackme.com/room/toolboxvim

This list covers movement shortcuts for navigating in Vim (Normal & Visual modes).
Mastering these is key to efficient editing.


Temp / most recent:

vim:

I frequently use, e.g., dt: or ct: to delete/change everything up until a colon (or some other character).

t and f work without a command as well, so to move to colon use f: and to move to right before colon use t:

ctrl + w delete everything before the cursor
ctrl + k delete everything after the cursor

Basic Movement

ShortcutAction
hMove left one character
lMove right one character
0Move to beginning of line
^Move to first non-whitespace character
$Move to end of line
wMove to beginning of next word
eMove to end of current/next word
geMove to end of previous word
bMove to beginning of current/previous word

Screen Movement

ShortcutAction
HMove to top of screen
MMove to middle of screen
LMove to bottom of screen
Ctrl + uMove up half a screen
Ctrl + dMove down half a screen
Ctrl + bMove up one screen
Ctrl + fMove down one screen
zzCenter cursor on screen
ztMove cursor line to top of screen
zbMove cursor line to bottom of screen

Search Movement

ShortcutAction
/patternSearch forward for pattern
?patternSearch backward for pattern
nRepeat search in same direction
NRepeat search in opposite direction
*Search forward for word under cursor
#Search backward for word under cursor

Paragraph & Sentence Movement

ShortcutAction
{Move backward one paragraph
}Move forward one paragraph
(Move backward one sentence
)Move forward one sentence

Mark & Jump Movement

ShortcutAction
maSet mark a at current position
`a`Jump to exact position of mark a
'aJump to beginning of line with mark a
Jump back to last position before latest jump
''Jump back to beginning of line before latest jump
Ctrl + oJump to older cursor position
Ctrl + iJump to newer cursor position

Search Matching Brackets

ShortcutAction
%Jump to matching bracket, brace, or parenthesis

Line & Character Navigation

ShortcutAction
fxFind next occurrence of x in current line
FxFind previous occurrence of x in current line
txMove before next occurrence of x in current line
TxMove before previous occurrence of x in current line
;Repeat last f, t, F, or T
,Repeat last f, t, F, or T in opposite direction

Scrolling Without Moving Cursor

ShortcutAction
Ctrl + yScroll up one line
Ctrl + eScroll down one line

Tip: Use counts before motions (e.g., 5w moves forward 5 words).
See :help motion.txt in Vim for more details.

Vim Editing Shortcuts

This list covers editing shortcuts for Vim, including copying, deleting, yanking, pasting, and replacing.


Copying (Yanking)

ShortcutAction
yyYank (copy) the current line
3yyYank 3 lines
ywYank to beginning of next word
y$Yank from cursor to end of line
y^Yank from cursor to first non-whitespace character
y}Yank to end of paragraph
yiwYank inner word (without spaces)
yawYank a word (with spaces)
"+yYank to system clipboard
"+yyYank line to system clipboard

Deleting

ShortcutAction
xDelete character under cursor
XDelete character before cursor
ddDelete current line
3ddDelete 3 lines
dwDelete to beginning of next word
d$Delete from cursor to end of line
d^Delete from cursor to first non-whitespace character
d}Delete to end of paragraph
diwDelete inner word
dawDelete a word (with spaces)
"+dDelete to system clipboard
"+ddDelete line to system clipboard

Pasting

ShortcutAction
pPaste after cursor or below current line
PPaste before cursor or above current line
"+pPaste from system clipboard after cursor
"+PPaste from system clipboard before cursor

Changing (Replace + Insert)

ShortcutAction
rXReplace character under cursor with X
REnter replace mode (type over existing text)
cwChange to beginning of next word (delete + insert mode)
c$Change to end of line
ciwChange inner word
cawChange a word (with spaces)
CChange from cursor to end of line

Undo & Redo

ShortcutAction
uUndo last change
UUndo all changes to current line
Ctrl + rRedo undone change

Indentation

ShortcutAction
>>Indent current line
<<Un-indent current line
3>>Indent 3 lines
3<<Un-indent 3 lines
=Auto-indent selection or motion
=%Auto-indent between matching braces

Tip: Motions can be combined with commands.
For example: y$ (yank to end of line), d} (delete to end of paragraph), caw (change a word).

Terminal Movement Shortcuts

This list covers common movement shortcuts for navigating in the terminal (Bash, Zsh, etc.).
Most of these work in Readline-based shells (default on Kali).


OSCP essentials (use constantly)

ShortcutAction
Ctrl+ABeginning of line
Ctrl+EEnd of line
Ctrl+UDelete to beginning of line
Ctrl+KDelete to end of line
Ctrl+WDelete previous word
Alt+BackspaceDelete previous word
Alt+DDelete next word
Ctrl+YPaste (yank) last deleted text
Ctrl+LClear screen
Ctrl+RSearch command history
Ctrl+_Undo last edit (Readline)
Ctrl+A   # Start of line
Ctrl+E   # End of line
Ctrl+W   # Delete previous word
Alt+D    # Delete next word
Ctrl+U   # Delete to beginning
Ctrl+K   # Delete to end
Ctrl+R   # Search history
Ctrl+Y   # Paste deleted text
Ctrl+L   # Clear screen

tmux · Shell


Basic Cursor Movement

ShortcutAction
Ctrl + AMove to beginning of the line
Ctrl + EMove to end of the line
Ctrl + FMove forward one character
Ctrl + BMove backward one character
Alt + FMove forward one word
Alt + BMove backward one word
Ctrl + Left ArrowMove backward one word (depends on terminal)
Ctrl + Right ArrowMove forward one word (depends on terminal)
Ctrl + XXToggle between start of command and current cursor position

Editing Shortcuts

ShortcutAction
Ctrl + DDelete character under cursor (EOF if line is empty)
Ctrl + HDelete character before cursor (Backspace)
Alt + DDelete word after cursor
Ctrl + WDelete word before cursor
Ctrl + UDelete from cursor to beginning of line
Ctrl + KDelete from cursor to end of line
Ctrl + YPaste (yank) last deleted text
Alt + BackspaceDelete word before cursor

History Navigation

ShortcutAction
Ctrl + PPrevious command in history
Ctrl + NNext command in history
Up ArrowScroll back in history
Down ArrowScroll forward in history
Ctrl + RReverse search through command history
Ctrl + SForward search through command history
Ctrl + GCancel search
Alt + .Use last argument from previous command

Process Control

ShortcutAction
Ctrl + CCancel current command
Ctrl + ZSuspend current process
fgResume a suspended job in the foreground
bgResume a suspended job in the background

Screen Navigation

ShortcutAction
Ctrl + LClear the screen (same as clear)
Ctrl + SPause terminal output
Ctrl + QResume terminal output
Shift + PageUpScroll up terminal buffer
Shift + PageDownScroll down terminal buffer

Miscellaneous

ShortcutAction
TabAutocomplete file/folder/command
Alt + ?Show autocomplete suggestions
Ctrl + _Undo last change in line
Ctrl + GAbort command in progress

Tip: These shortcuts mostly work in Bash, Zsh, and other Readline-based shells.
For customizations, see man readline or your shell’s documentation.