Skip to content

VIM Basics

PK0207 edited this page May 9, 2021 · 1 revision

How to get into a file: vim /path/to/file

To edit the file:

i or the INSERT key

To move around the file:

Use the arrow keys or

j -→ to move down

k -→ to move up

l -→ to move right

h -→ to move left

Quit the file without saving your work: :q!

Quit the file and save your work: :wq!

Write to the file and continue working: :w

:e! - edit same file without saving

:e </path/to/file/filename> goes to that file

:e# goes back to previous file edited

yy p -→ copy - paste

dd p - cut paste

u - undo

/(insert searched object) - search

:(number) - goes to line number

:se(t) nu(m) - show line numbers

r - replace

R - continuously replace

I - insert from the beginning of the line

A - insert from next line

a - insert from next character

f - search for a character in line

% - find matching parenthesis

b,w - move word

C - change

Cw - change word

Cf[] - change upto [character]

Clone this wiki locally