Jump to next white space

Vim

Vim Problem Overview


Instead of using w to jump to the beginning of the next word or using e to jump to the end of the next word I want to have a shortcut which jumps to the next whitespace between words.

Vim Solutions


Solution 1 - Vim

  • Use f and then space. See :help f and :help t for that.
  • Alternatively use /[[:space:]] or /\s if you want to also match tab.
  • otherwise El will do it (capital e and lowercase L).

Following a suggested edit that was rejected, here is how to do it backwards (jump to previous space):

  • Use F and then space. See :help F and :help T for that.
  • Alternatively use ?[[:space:]] or ?\s if you want to also match tab.
  • otherwise Bh will do it (capital b and lowercase h).

Solution 2 - Vim

On the same line :

fSpace will work.

Generally, f+<char> allows you to jump on the next character on the same line.

See :help f for more information.

Solution 3 - Vim

as mentioned: you can use f and then Space but then use ; to hop to all the remaining spaces. My sequence is then often:

f<Space>;;;;

The semicolon is a repetition for the f-key (find char in Line)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMatthias GuentherView Question on Stackoverflow
Solution 1 - VimBenoitView Answer on Stackoverflow
Solution 2 - VimXavier T.View Answer on Stackoverflow
Solution 3 - Vimnils petersohnView Answer on Stackoverflow