Is it possible to execute a VIM script in a non-interactive mode

scriptingvim

The Gnats bug tracker has a command (edit-pr) that opens a ticket in $EDITOR. My $EDITOR is VIM, and when this command opens the ticket in $EDITOR, I'd like to automatically perform some scripted edits without having to make any additional keystrokes.

Is there a way to write a VIM script that can be run non-interactively like this?

Best Answer

I've never used gnats, so it's hard to say what exactly edit-pr is expecting to be done. But from what you've given us, you could try changing the EDITOR env variable to a custom shell script, or maybe even a python script or something.

EDITOR=/path/to/script.(sh|py) edit-pr <args>

But like I said, I don't know what kind of edits it wants, or what needs to be done in the editor. Maybe if you gave us an example of what you'd want to automate?

Related Question