go to character in vim

Vim

Vim Problem Overview


I'm getting an error message from a python script at position 21490.

How can I go to this position in Vim?

Vim Solutions


Solution 1 - Vim

:goto 21490 will take you to the 21490th byte in the buffer.

Solution 2 - Vim

vim +21490go script.py

From the command line will open the file and take you to position 21490 in the buffer.

Triggering it from the command line like this allows you to automate a script to parse the exception message and open the file to the problem position.


Excerpt from man vim:

> > +{command} > > -c {command} >{command} will be executed after the first file has been read. {command} is interpreted as an Ex command. If the {command} contains spaces it must be enclosed in double quotes (this depends on the shell that is used).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCato JohnstonView Question on Stackoverflow
Solution 1 - VimBrian CarperView Answer on Stackoverflow
Solution 2 - Vimljs.devView Answer on Stackoverflow