What is the difference between ^ and _ for cursor movement
Clash Royale CLAN TAG#URR8PPP
What is the difference between ^ and _ for cursor movement
They both seem to move the cursor to the first non-blank character of the current line and I wonder what was the reason for duplicating this functionality
1 Answer
1
Hello and welcome to this site!
:help left-right-motions
is your friend here.
:help left-right-motions
The difference is that _
accepts a [count]
before it, citing the manual:
_
[count]
_ <underscore> [count] - 1 lines downward, on the first non-blank
character linewise.
while:
^ To the first non-blank character of the line.
exclusive motion.
Obviously, _
by itself is equivalent to 1_
, so the outcome is 0 lines downward, on the first non-blank character linewise, which means the current line (just like ^
).
_
1_
^
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
@lox You might also want to read this to get better at using Vim's documentation
– statox♦
4 hours ago