VIM ( Vi Improved)
This is one of the most useful editor comes in Unix . It can be used as editor for coding in perl , c , c++ even some people use it for Java. GVim ( Graphical Vim ) is also available.
Open a file using VIM and how to edit it
vim filename
vim -g filename ( g switch is to open the GVim )
You can also adjust the size of the window ( height and width) in which Vim opens the file.
vim -g -geom 84x67 filename
now this opens the file in a window of size 84x67 .
There is .vimrc file configuration file for vim either set the geometry option in the .vimrc file or
create a n alias say v for the command and use as
v filename
Moving Around : h ==> left
l ==> right
j ==> down
k ==> up
To edit the file go into the insert mode . To enter in the insert mode press i . Now u can add to the file .
Cut , Copy & Paste
v ==> enter into visual mode
select the text u want to copy or cut
yy ==> copy
x ==> cut
p ==> paste
Saving the file
:w ==> save
:wq ==>save and quit
:q! ==> quit without saving
Programming Specific ShortCuts
open new tab ==> :tabnew
go to next tab ==> gt
go to previous tab ==> gT
go to begining of the line ==> ^
go to end of the line ==> $
go to end of the file ==> shift + g
go to start of the file ==> gg
undo ==> u
erase current line ==> dd
paste after the current line ==> p
paste before the current line ==> P
find ==> /exprr
find from end ==> ?regex
next occurence of the find item ==> n
previous occurence of the application ==> N
autocomplete ==> ctrl + p/n
go to variable definition==> gd
go to matching parenthesis ==> %
reindent the whole file ==> ggVG=
Sunday, June 21, 2009
Subscribe to:
Comments (Atom)