vimtricks.wiki Concise Vim tricks, one at a time.

How do I jump to just before a specific character on the current line?

Answer

t{char}

Explanation

The t{char} command moves the cursor forward to the character just before the next occurrence of {char} on the current line. It is called the "till" motion and is one of Vim's most precise horizontal navigation tools.

How it works

  • t initiates the "till" motion
  • {char} is the character you want to stop just before
  • The cursor lands on the character immediately preceding the target character
  • The search only covers the current line — it does not cross line boundaries

Example

Given the text with the cursor on the T:

The quick (brown) fox

Pressing t( moves the cursor to the space before (, landing on the between quick and (. This is useful when you want to operate on text up to but not including a delimiter.

Compared to f{char}

  • f( moves the cursor onto the ( character
  • t( moves the cursor to the character before (
  • This distinction matters when combining with operators like d or c

For example, dt) deletes everything from the cursor up to but not including the ). Meanwhile, df) deletes everything up to and including the ).

Tips

  • Use T{char} (uppercase) to search backward to just after a character
  • Use f{char} to land directly on the character instead of before it
  • Use ; to repeat the last t or f motion in the same direction
  • Use , to repeat the last t or f motion in the opposite direction
  • Combine with operators: ct) changes everything up to the ), dt, deletes up to the next comma, yt; yanks up to the next semicolon
  • Use 2t{char} to jump to just before the second occurrence of the character

Next

How do I edit multiple lines at once using multiple cursors in Vim?