10

I often use something like :80 to quickly go to a line (80 for example).

I'm in a unique situation where I want to go to column 80, to see if lines are too long in files.

Any quick way to do this in vim?

  • 4
    For your unique situation, you might also find the colorcolumn option useful. :set cc=80 will highlight the 80th column. You might also be able to automatically reformat everything to under 80 columns with gq. Setting textwidth will automatically wrap lines as you type. Not necessarily useful now, but possibly useful in the future. – 8bittree Jul 7 '17 at 16:50
16

Just type 80| -> :h |

This is perfect for interactive mode. When scripting, there are other ways.

| improve this answer | |
3

There is also a function to go to a specific line and column:

:call cursor(row, col)
| improve this answer | |
  • 1
    Welcome to our site Stéphane, for now your question is tagged as "low quality" because of the formatting (see the help to fix that) and because your answer doesn't really explain how your code works. Could you improve that to make sure your answer is useful to the greater number of future reader? – statox Feb 25 '19 at 15:59
  • 2
    Welcome Stéphane, to add to statox comment: Whenever you answer an question, just assume that the reader knows something about Vim, but less than you do. BTW: Also the accepted answer is correct, it it really short. – Ralf Feb 25 '19 at 16:23

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.