Vim Keyboard Shortcuts | vim shortcuts

Hello in this article. I will show you shortcut keys for vim. With the help of vim, you can do everything with a keyboard which means, you won’t need a mouse to move around the code. The main purpose of vim is to save your time which simply means you will be on laser-sharp focus on code rather than wasting time on moving your mouse etc.
Vim Keyboard Shortcuts | vim shortcuts

Editing Shortcuts

Action

Shortcuts

To Replace a single character

r

To Join the line below to the current one

j

To Change an entire line

cc

To Change to the end of the word

cw

To Change to the end of line

c$

To Delete the character at the cursor and substitute text

s

To Delete line at the cursor and substitute text

S

To Transpose two letters

xp

To Undo

u

To Repeat the last command

.

 

Cursor Movement Shortcuts

Action

Shortcuts

To Move left

h

To Move down

j

To Move up

k

To Move right

l

To Jump by the start of words

w

To Jump by words

W

To Jump to end of words

e

To Jump to end of words no punctuation

E

To Jump backwards by wordsv

b

To Jump backwards by words no punctuation

B

To Start of line

0

To First non-blank character of the line

^

To End of line

$

To Go To command

G

To Start insert mode at the cursor

i

To Insert at the beginning of the line

I

To Append after the cursor

a

To Append at the end of the line

A

To Open blank line below the current line

o

To Open blank line above the current line

O

To Append at end word

ea

To Exit insert mode

Esc

 

Visual Mode Shortcuts

Action

Shortcut

To Start visual mode, mark lines, then do command

v

To Start Linewise visual mode

V

To Move to other ends of the marked area

o

To Start visual block mode

Ctrl + V

To Move to other corners of the block

O

To Mark a word

aw

To A () block

ab

To A {} block

aB

To Inner () block

ib

To Inner {} block

iB

To Exit visual mode

Esc

 

To Cut & Paste Shortcuts

Action

Shortcut

To Yank (copy) a line

yy

To Yank 2 lines

2yy

To Yank word

yw

To Yank to end of line

y$

To Paste the clipboard after the cursor

p

To Paste before the cursor

P

To Cut a line

dd

To Cut the current word

dw

To Cut current character

x

 

Visual Commands Shortcuts

Action

Shortcut

To Shift right

> 

To Shift left

< 

To yank marked text

y

To Delete marked text

d

To Switch case

~

 

 

Search & Replace Shortcuts

Action

Shortcut

To Search for pattern

/pattern

To Search backward for pattern

?pattern

To Repeat the search in the same direction

n

To Repeat the search in the opposite direction

N

To Replace all old with new throughout the file

:%s/old/new/g

To Replace all old with new throughout the file with confirmations

:%s/old/new/gc

 

Working with Files Shortcuts

Action

Shortcut

To Edit a file in a new buffer

:e filename

To Go to the next buffer

:bnext

To Go to the previous buffer

:bprev

To Delete a buffer

:bd

To Open a file in a new buffer and split the window

:sp filename

To Split windows

Ctrl + ws

To Switch between windows

Ctrl + ww

To Quit a window

Ctrl + wq

To Split windows vertically

Ctrl + wv

 

Exit Shortcuts

Action

Shortcut

To Write (save) the file, but doesn’t exist

:w

To Write (save) and quit

:wq

To Quit (fails if anything has changed)

:q

To Quit and throw away changes

:q!

thanks for reading this article. let me know what you think of this article in the comment section and don’t forget to share it with your friends.

Post a Comment

0 Comments