Vim Practical useful tips

 

:g/^$/d  (for removing extra empty lines)
gg=G (for indentation)
:se hls (to highlight an identifier)
:syn off (for decreasing brightness in vi editor) 
:vsp <filename> for opening split window [Filename should be in current directory]
:sp <filename> for opening split window horizontally [Filename should be in current directory]
CTAGS usage in VIM 
------------------
For creation of tag file we need to run ctags command in linux as given below

ctags --langmap=c:.c.h.x -h .h.x --tag-relative=no -VR >/dev/null &
or 

ctags -R *
:se tags=$PWD<press-tab to replace $PWD with actual present path>/tags

Crtl+} braces to jump to definition
Ctrl+T to jump back 
Shift/Crtl + 5 for toggling(jumping) to end of the block(from '{' to '}')
vim -t <funcname> (to jump to function defination after creation of tag file)
:100 (to jump to line number 100 in a text file)
:$ (to jump to end of the file)
44yy (for copying 44 lines)
p (to paste code from yy command)
':se paste' then press 'i' for insert mode (to copy using GUI by right clicking) 

Comments

Popular posts from this blog

OS Books

How to get symbol table in gcc/g++ ?

Memory corruption issue