vi search - dylanwan/dylanwan.github.io GitHub Wiki

/ - search forward

You just type / , enter the search keyboard, and hit

It search the text after your cursor.

n or // - search again

You can keep moving to the next matched text in the file.

< / key>, < / key>, and = < n key >

n is much easier.

? - search reverse direction

It will find the matched text above where your cursor is.

?? - continue search above or n - continue search next matched text

You do not need to re-enter the keyword, it will search based on the current entered keyword.

to reverse the direction, hit / or ? depending on what you did last time, or just simply N

It reuses the keyword entered last time.

</ key> then or <? key> then = < N key>

N is much easier. < Shift > + < n >

Search the current word

  • use * to quickly move to the next place with the same word as the cursor is on
  • use # to move back

Cursor movement

These help you to move to the starting point, before you start searching.

  • gg or 1G - the top of the file
  • G - the bottom of the file
  • H - the top of the screen
  • L - the bottom of the screen
  • { begin of the previous paragraph
  • } the begin of the next paragraph
  • < enter a number >, } - quickly move multiple paragraphs
⚠️ **GitHub.com Fallback** ⚠️