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

How do I jump to a specific column number on the current line?

Answer

{N}|

Explanation

The | command (pipe character) moves the cursor to a specific column number on the current line. Prefix it with a number to jump directly to that column.

How it works

  • 20| moves to column 20 on the current line
  • 1| moves to the very first column (same as 0)
  • 80| moves to column 80 — useful for checking line length limits

Example

You have a long CSV line and need to jump to column 40:

40|

The cursor lands exactly on the 40th character.

Practical uses

  • Checking line length: Jump to column 80 or 120 to see where the limit falls
  • Fixed-width file editing: Navigate to specific fields in fixed-width data formats
  • Aligning columns: Quickly position the cursor for visual block operations

Comparison with other column motions

0     " First column (column 1)
^     " First non-blank column
$     " Last column
{N}|  " Column N exactly

Tips

  • The column count is 1-based, not 0-based
  • If the line is shorter than the specified column, the cursor moves to the last column
  • Works as a motion with operators: d20| deletes from cursor to column 20
  • Combine with :set colorcolumn=80 to visually see the column you want to jump to
  • Documented under :help bar

Next

How do I run the same command across all windows, buffers, or tabs?