36

In VI, I know that if you do

:some_number

and hit enter, you will jump to the line specified by "some_number". Is there an equivalent for jumping to a specific character in a single line?

Basically, I have a large csv and there is some characters that are breaking the parser; so I have to debug it.

I'm getting an error message that basically says "unexpected character on line XXX character YYY".

I know how to get to XXX but how do I get to YYY?

1
  • 1
    to go to line 300 , char 20 do: 300G20|
    – JJoao
    Oct 16, 2019 at 23:24

2 Answers 2

58

If you want the cursor on a particular column, the command n|, where n is the column number, and | is the pipe symbol, puts the cursor on the intended column in the line the cursor already appears on.

3
  • 13
    Also useful: t/T to go to the character before the given character, and ; to repeat the previous t/T/f/F.
    – Edd Steel
    Sep 21, 2011 at 17:19
  • 10
    And , to go in the opposite direction using the same previous letter. Sep 21, 2011 at 19:47
  • 1
    Just a note to readers after 2022-04-15, this has been edited so drastically, it's really no longer my answer. This has happened to me a lot. I'm about to delete my account, if that's even possible.
    – user732
    Apr 16, 2022 at 13:31
13

if you want to go to the 12th character on a line:

12|

For the 6th character in the line:

6|

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .