3

There are commands to distinguish between the beginning of a line (0) and the beginning of the first word of the line (^), basically ignoring leading whitespace. But I can only find one way to move to the end of a line ($), including whitespace, much like 0, but no way to move to the end of the last word.

Is there an end-of-line equivalent to ^, which ignores trailing whitespace?

3 Answers 3

8

g_ will to go to the last non-blank character of the line

For more help see :h g_

4
  • $ or <End> - goes to end of line
  • g_ - goes to last non blank of line
  • g$ or g<End> (both take a count) - goes to end of last screen n-1'th line
  • <Ctrl><End> (takes a count) - goes to end of absolute n'th line
2

Yes, see :h g_

g_          To the last non-blank character of the line and
            [count - 1] lines downward |inclusive|.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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