You can use 0 or ^ to move to beginning of the line.
And can use Shift+I to move to the beginning and switch to editing mode (Insert).
Move the cursor to the begining or end with insert mode
I
- Moves the cursor to the first non blank character in the current line and enables insert mode.A
- Moves the cursor to the last character in the current line and enables insert mode.Here I
is equivalent to ^
+ i
. Similarly A
is equivalent to $
+ a
.
Just moving the cursor to the begining or end
^
- Moves the cursor to the first non blank character in the current
line0
- Moves the cursor to the first character in the current line$
- Moves the cursor to the last character in the current lineYou can also use
:-0
This sets the cursor at the present line (blank here) at the 0 column.
Type "^". And get a good "Vi" tutorial :)
A simple 0
takes you to the beginning of a line.
:help 0
for more information
I just found 0(zero) and shift+0 works on vim.
0 Takes you to the beginning of the line
Shift 0 Takes you to the end of the line
Try this Vi/Vim cheatsheet solution to many problems.
For normal mode :
0 - [zero] to beginning of line, first column.
$ - to end of line
There is another way:
|
That is the "pipe" - the symbol found under the backspace in ANSI layout.
Vim quickref (:help quickref
) describes it as:
N | to column N (default: 1)
If you have wrap lines enabled, 0
and |
will no longer take you to the beginning of the screen line. In that case use:
g0
Again, vim quickref doc:
g0 to first character in screen line (differs from "0" when lines wrap)
Source: Stackoverflow.com