Linux Tutorials – VIM Editor
VIM is a command line editor for files in linux.We can open VIM by using vi or vim from the command prompt.
VI – Visual display editor
VIM – Visual display editor improved
In VIM editor there are 3 modes,
1 . Command Mode
2 . Insert Mode
3 . Extended Command Mode
By default Vi will open with Command mode only.In the command mode here is the simple letters to move the cursor position in a file.h/l/k/j are for cursor left/right/up/down.
Insert Mode
i | To skip into insert mode |
l | To Insert beginning of line |
a | To Append to the next word of the letter |
A | To Append the end of the line |
o | Insert the new line at below of cursor position |
O | Insert the new line at above of the cursor position |
Command Mode
gg | To go begin of the page |
G | TO go end of the page |
w | To Move the cursor forward word by word |
b | To Move the cursor backward word by word |
nw | To Move cursor forward to n words ex: 3w |
nb | To Move cursor backward to n words ex:3b |
u | To undo last change |
U | To Undo previous Changes |
Ctrl+R | To redo the previous changes |
yy | To copy entire line |
nyy | To copy n lines ex: 4yy |
p | TO paste the line below the cursor |
P | To paste the line above the cursor |
dw | To delete the word each letter by letter |
x | To delete the word by word |
dd | To delete the entire line |
ndd | To delete the n number of lines from the cursor position |
/ | To search a particular word in a file |
Extended Mode (Or) Colon Mode
Each command need to execute using esc button with the combination of : in extended mode.
ESC+:w | To save the changes in a file |
ESC+:q | To quit from a file without save |
ESC+:wq | To save and quit from a file |
ESC+:w! | To save very forcefully |
ESC+wq! | To save and quit from a file forcefully |
ESC+:x | To save and quit |
ESC+:X | To give the password to a file and remove the password |
ESC+:10 | To go line number 10 place the number n |
ESC+:se nu | To set the numbers to a file |
ESC+:se nonu | To remove the lines numbers In a file |
To open multiple files in vim editor here is the simple command is
#vim -o file1 file2
To shuffle between the files use Ctrl+w
Tags:Vim,VI editor,VIM editor,streamline editor,SED,vi commands,VIM modes,VI modes
Add Comment