jporubek wrote:This may seem quite convoluted, but it works...
Now there's an understatement!
I actually assumed you wanted the
current line number (not necessarily the original one) sent to vim, which is why I took the approach I did.
For example, if you happened to browse to another line of the same document within ed2 (the original being scrolled away) before invoking Vim, you'd have Vim open immediately to what you were
actually looking at, not the original line. It could be argued as desirable either way, depending on the user, I guess.
For anyone viewing who may express a fondness for the
idea of this thread, but finds
jporubek's solution takes perhaps
too much skin off their cat, I created a simpler more flexible script which may be used with any editor which allows a command-line line-number reference (be that Vim or whatever).
Just download
Ed2Conceder and extract the EXE to a location of your choice. Then, in the Ed2 options, set the external editor as follows:
"<pathto>\Ed2Conceder.EXE" "<pathto>\MyEditor.EXE" "<line-designator>" "Close"
The <line-designator> argument is a string literal for whatever your editor uses to open to a specific line. In Vim this is the "+" symbol, while in Notepad++ it is "-n". Remember, this is not the line-number itself - that's generated automatically, this is just the prefix to it.
The last argument (the word "Close") is optional. If you add it, the Ed2 window will be closed and then the external editor is called. If you leave that argument off, the Ed2 window remains in the background while the new editor is opened over it.
In other words, for Vim, you might use:
"Ed2Conceder.exe" "gvim.exe" "+" "Close"
Or, for Notepad++, you could use:
"Ed2Conceder.exe" "notepad++.exe" "-n"
This way when you hit <F12> in Ed2, it just invokes the editor of your choice to whatever line# the cursor-caret is currently on. In the above examples, Vim would be opened and x2 closed, but Notepad++ and Ed2 would both be open.
Remember that you do require the double-quotes (") around both the EXE's if you happen to have any spaces in their full pathnames.
Anyway, that's it, all wrapped up in a single flexible package without console windows, muss, or fuss. And (more importantly) it's feline-friendly!