Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jump to next white space

Tags:

vim

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.

like image 508
Matthias Guenther Avatar asked Mar 25 '11 13:03

Matthias Guenther


People also ask

How can you go to the next word based on whitespace in Linux?

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

What is white spacing?

Alternatively referred to as spacing or whitespace, white space is any section of a document that is unused or space around an object. White spaces help separate paragraphs of text, graphics, and other portions of a document, and helps a document look less crowded.

How do I go to the first word in Vim?

Press 0 to go to the beginning of a line, or ^ to go to the first non-blank character in a line.

What is white space in code?

Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line feeds). These characters allow you to format your code in a way that will make it easily readable by yourself and other people.


1 Answers

  • 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).
like image 188
Benoit Avatar answered Sep 21 '22 17:09

Benoit