VIM editor
Many times users may need to edit a file, so there are many files editor that you can use to edit files like as nano, vi, vim, emacs, gvim, gedit etc. Vim stands for "Vi IMproved". Vim is a text editor which includes almost all the commands from vi editor and few more. Apart from the vim command, the vim packages may also provide gvim, the Gnome version of vim. vim can operate in two modes: command mode and insert mode.
The editor always starts in command mode. it is used to copy, move, replace, delete, and perform some other functions. These are some popular vi commands:
Moving commands
h to move the cursor to the left
l to move it to the right
k to move up
j to move down
Save and exit commands
:w will save (write) the file.
:q! forces the exit without saving.
:wq will save and exit.
:wq! overrides read-only permission.
Copy and paste commands
dd will delete a lines.
dw will delete a word.
x will delete the character on which the cursor is positioned.
yy will copy a whole line.
p will paste copied data.
Search commands
/search will perform the search any word you will put, replace serach with word that you want to search.
:num replace num with number to go for particular line.
Insert mode is used to insert text in the file. To go insert mode press i and you will see insert message on bottom side, if you want to come back in command mode just press ESC key.
a will append a new line.
i will insert text on current cursor position.
o will insert a blank line under the current cursor position.
For more information there is a built-in tool called vimtutor that can be used learn a lot, just type
#vimtutor
The editor always starts in command mode. it is used to copy, move, replace, delete, and perform some other functions. These are some popular vi commands:
Moving commands
h to move the cursor to the left
l to move it to the right
k to move up
j to move down
Save and exit commands
:w will save (write) the file.
:q! forces the exit without saving.
:wq will save and exit.
:wq! overrides read-only permission.
Copy and paste commands
dd will delete a lines.
dw will delete a word.
x will delete the character on which the cursor is positioned.
yy will copy a whole line.
p will paste copied data.
Search commands
/search will perform the search any word you will put, replace serach with word that you want to search.
:num replace num with number to go for particular line.
Insert mode is used to insert text in the file. To go insert mode press i and you will see insert message on bottom side, if you want to come back in command mode just press ESC key.
a will append a new line.
i will insert text on current cursor position.
o will insert a blank line under the current cursor position.
For more information there is a built-in tool called vimtutor that can be used learn a lot, just type
#vimtutor
No comments:
Post a Comment