Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to use regular expression for movement in vim. For example, I want to move my cursor to the first occurrence of the pattern abc. So can I do something analogous to fa but now a character replaced by a pattern? And can I use regular expressions with t and f command?

share|improve this question
You can search with regex and the cursor will move to the start of the regex. Is this what you mean? – Sardathrion Aug 20 '12 at 7:10

As stated in a comment by Sardathrion, you can search to navigate. This is actually too useful in Vim to ignore. A few tips regarding search to navigate:

  • Use / to search forward, ? to search backward.
  • You may want to turn on incsearch so that Vim will jump to matches as you type. Hit Enter when you are at the location you want.
  • You may also want to turn on search highlight with hlsearch.
  • After arriving at the location you want, you can use nohlsearch to disable the highlight. It will be enabled again when you do the next search.
  • If you find yourself using lots of regex consider using \v ("very magic").
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.