1. create a file named .exrc in your home directory
2. config your settings in this file
And you are good to go
Labels
About Me
Showing posts with label VI. Show all posts
Showing posts with label VI. Show all posts
Tuesday, July 20, 2010
Wednesday, July 22, 2009
[VI] find and replace
Find the 'txt': /txt (forward searching)
?txt (backward searching)
/\ (searching for the whole word 'txt')
Get rid of the highlighting after search:
:set nohlsearch
Enable highlighting searching:
:set hlsearch
Find the replace:
:s/word/replacement/ ( once )
:s/word/replacement/g ( all at once on a single line )
:.,.+Ns/word/replacement/g ( all at once on the current line and
the next N lines )
:%s/word/replacement/g ( all at once the whole text )
:s/word/replacement/cg ( you need confirm whether or not to
replace )
:s/word/replacement/gi ( case insensitive )
:set ic ( case insensitive )
:set noic ( case sensitive )
:%//g ( remove all tab characters )
ref: http://www.linux.ie/articles/tutorials/vi2.php
?txt (backward searching)
/\
Get rid of the highlighting after search:
:set nohlsearch
Enable highlighting searching:
:set hlsearch
Find the replace:
:s/word/replacement/ ( once )
:s/word/replacement/g ( all at once on a single line )
:.,.+Ns/word/replacement/g ( all at once on the current line and
the next N lines )
:%s/word/replacement/g ( all at once the whole text )
:s/word/replacement/cg ( you need confirm whether or not to
replace )
:s/word/replacement/gi ( case insensitive )
:set ic ( case insensitive )
:set noic ( case sensitive )
:%
ref: http://www.linux.ie/articles/tutorials/vi2.php
Subscribe to:
Posts (Atom)