vim Movement Searching

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Jumping to characters

f{char} - move to the next occurrence of {char} to the right of the cursor on the same line

F{char} - move to the next occurrence of {char} to the left of the cursor on the same line

t{char} - move to the left of the next occurrence of {char} to the right of the cursor on the same line

T{char} - move to the right of next occurrence of {char} to the left of the cursor on the same line

Jump forward / backward between the 'results' via ; and ,.

Further you can search for whole words via /<searchterm>Enter.


Searching for strings

* - move to the next occurrence of the word under the cursor

# - move to the previous occurrence of the word under the cursor

/searchtermEnter brings you to next match (forward-search). If you use ? instead of /, searching goes backwards.

Jump between the matches via n (next) and N (previous).

To view/edit your previous searches, type / and hit the up arrow key.

Helpful are also these settings: (note :se is equal to :set)

  • :se hls HighLightSearch, highlights all search matches; use :noh for temporarily turning off the search/mark highlighting (:set noh or :set nohls turns off.)
  • :se is or :set incs turns Incremental Search on, cursor jumps to the next match automatically. (:se nois turns off.)
  • :se ic IgnoreCase, turns case sensitivity off. (:se noic turns on again.)
  • :se scs SmartCaSe, can be used when IgnoreCase is set; makes case (in)sensitivity smart! e.g. /the will search for the, The, ThE, etc. while /The only will look for The.


Got any vim Question?