Search code examples
vimvi

Go to beginning of line without opening new line in VI


For ages now I've used SHIFTO and SHIFT$ to move to the beginning and end of a line in vi.

However SHIFTO is more for opening a new line above the cursor.

Is there any command which just takes you to the start of a line?


Solution

  • You can use ^ or 0 (Zero) in normal mode to move to the beginning of a line.

    ^ moves the cursor to the first non-blank character of a line
    0 always moves the cursor to the "first column"

    You can also use Shifti to move and switch to Insert mode.