Wednesday, April 16, 2008

VIM (visual improved editor)

VIM (visual improved editor)

It has 3 modes of operations.
1. Escape / command mode
2. Insert mode
3. Replace mode

To create a file with VIM issue
$vim (filename)
This would open the vim editor Escape/command mode
To enter to insert mode ------->> "i" or insert key
To switch to replace mode ------->> press insert key twise
:q ---->> quit out of the file
:q! ----->> quit without saving
:w ----->> write
:wq---->> write and quit

To copy a line ----->> yy
To paste a line ----->>p
To delete a line ----->> dd
Deleted files can be in the buffer it can be pasted with p.

To undo ----->> u
To redo ------>> ctrl+r
To copy three lines ---->> 3yy
To paste 5 times ------>> 5p
To delete 10 lines ------>> 10dd
To go to the top of the file ----->>gg
To got to the bottom of the file ----->>g
To go to the Nth line ----->> :N
To go to the previous ocurance type N
To disable the search highilition ------>> nohl
nohl(no highlition)

To disable the case sensitive search ------->> set ic
ic(ignore case)
To re-enable case sensitive search ------->>set noic
To issue bash command from the VIM editor , issue the bash command after :!
Also if we want to know host name when we are using VIM editor then just give
:!hostname

FILE ENCRYPTION WITH VIM
Say we need to Encrypt a file with a passphrase
issue :X
then enter passphrase twise and save the file with :wq
Now when we reopen the file , we will prompted to enter the passphrase
On issuing the correct passphrase only , the file will be readable. Otherwise
the content of the file will be seen as gibberish.
File encryption with vim is not safe
File encrypted with VIM is not executable.

1 comment:

Aron said...

Enthonnede Ithu... Got only 2 adds... Post some more articles on nano and pico....