In vim, both ^
and _
can be used to move to the first non-blank character of the line.
However, ^
doesn’t work with motion. This mean that 3^
doesn’t move to the non-blank character of the third line. It ignore the motion and only move to the non-blank character of the first line.
Consider that your cursor is at this position:
* This is the first line
-
* This is the second line
* This is the third line
with 3^
, the cursor will move to the first non-blank character of the first line:
* This is the first line
-
* This is the second line
* This is the third line
However, with 3_
, since it works with motion, the cursor will move to the first non-blank character of the third line:
* This is the first line
* This is the second line
* This is the third line
-
For more details, refer to :help _
and :help ^
when using vim.