2

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

5

Hello and welcome to this site!

:help left-right-motions is your friend here.

The difference is that _ accepts a [count] before it, citing the manual:

_  <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 ^).

  • 2
    @lox You might also want to read this to get better at using Vim's documentation – statox Sep 18 '18 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.