Labels

APPLE (1) IDL (4) LSD (2) Mac (2) astro (1) life (2) linux (5) teaching (1) volleyball (2) work (1)
Showing posts with label VI. Show all posts
Showing posts with label VI. Show all posts

Tuesday, July 20, 2010

How To Config the Default Settings for VI editor

1. create a file named .exrc in your home directory
2. config your settings in this file
And you are good to go

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