I would like to pass the file name and the current line number where my cursor is at, separated by colon, to an external shell script. For example, if am editing the file "foo.c" and I am currently on line 77, I'd like to call my script from vim with the argument "foo.c:77".
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
An alternative to Karalos's answer:
Of course, you replace "echo" with the name of your shell script. The advantage of system() is that it returns the output of the command run, so you can capture it for further use in a Vim script if you need to. You may need to look at the modifiers in |
|||||
|
|
Although quite cumbersome, you could try the following
or you could use an intermediate variable
and call
|
|||
|
|
