search next or backward and goto line tips for vim
December 16th, 2006 mysurface Posted in Text Manipulation, vi, vim | Hits: 6537 |
To search in vim is very simple, even a noob vim user know that,
/keyword
To search for next?
simply follow by pressing n for next keyword match point and search backward with shift+n or N.
Wanna highlight the keyword and search for next keyword match point?
Place your cursor at the desire word, and press shift 8(8 not at number pad) or *.
To highlight the keyword search?
:set hlsearch
To toggle the high light for keyword search add in ! after hlsearch.
:set hlsearch!
Map this toggle to your fav key binding? check out this.
To goto desire line?
While opening the file sample.cc, I wanna goto line 165, which originally mention at here before.
vi sample.cc +165
While in vim, I am editing sample.cc, now I wanna travel to line 1024, use arrow key or Page up/Page down ? Don’t do that, do this
type 1024 then press shift g or G.
Goto first line?
gg
Goto Last line?
Without pressing number and press shift g or G
Live Chat!









Leave a Reply