2

My text contains five lines (5th line contain two blank-spaces at the beginning) and I'm at the middle of the first one. How could I go to the beginning of the 4th line with the Vim editor? I thought I could use 5G command, but it didn't work as I wanted.

  • @Zanna No, both command bring me to the first character of the line and not at the first blank of the line – user597313 Dec 19 '16 at 20:26
1

5GHome

The 5G gets you to the first non-blank character of your 5th line; pressing Home or 0 moves to the start of the line.

By the way, do you know about https://vi.stackexchange.com/

Or, you can opt for set nosol in which case if you're at the start of a line and you move 5G you'll be at the start of line 5. help startofline

  • I'm learning Vim with Vim-advantures so far. Therefore, I cannot use Home to do that. – user597313 Dec 19 '16 at 20:32
  • 1
    If you don't have a home key (I don't) you can press 0 instead – Zanna Dec 19 '16 at 20:32
  • 1
    Upvoted :) Probably 0 is more standard than the home key? I learned 0 originally but never knew home could do the same thing – Zanna Dec 19 '16 at 20:35
  • Yeah, I would recommend 0 over home. Additionally, you could even use | to achieve the same thing as 0. – James Dec 19 '16 at 21:18

Your Answer

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