go to character in vim
I'm getting an error message from a python script at position 21490
.
How can I go to this position in Vim?
Solution 1:
:goto 21490
will take you to the 21490th byte in the buffer.
Solution 2:
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).