3 ms·
What kind of things do you want to script? Personally I use macros in an editor for "text manipulation", and drop to Python/sed/awk for "text processing". I do
by weebull 2y ago
What kind of things do you want to script?
Personally I use macros in an editor for "text manipulation", and drop to Python/sed/awk for "text processing". I don't find I have a need for anything in-between.
- ericb 2y agoHere's an example of extending an IDE (IntelliJ/PyCharm/RubyMine/WebStorm) by driving it externally: I used just a little bit of code to make it so when I command-click a filepath anywhere, it opens in IntelliJ. This works in the browser, on chrome links, (github, gitlab, jenkins, error pages, etc) and also in iTerm on stack traces, spec/test paths. I made a chrome plugin, a shell script, and used the remote control plugin (not mine). The result was super-satisfying. I'll probably open source the bits soon. Now, I didn't script the IDE myself--the Remote Control Plugin did that work, but for an open source solution, I wouldn't mind building a remote control plugin myself. Making this work got me wondering about doing the same with an open-source editor. I also would like to drive things internally, but I want it to be easy so I get a good return on the effort.
- mzs 2y agoFor that you can just make the scripts 'gvim file' If on MacOS and you are using the apple native build, 'open -a gVim file' opens each file in the same editor. If you want to do that on X11 (even macos X11.app) or MS Windows: https://vimhelp.org/remote.txt.html#remote.txt https://vimhelp.org/remote.txt.html#remote.txt Basically (or gvim, yu might want --remote-silent too): vim --servername foo --remote-silent filename [ filename ... ] The end of that doc explain you can use either Windows messages or OLE. But the same doc explains how you can completely script vim from the command line: Tell the remote server "foo" to write all files and exit: vim --servername foo --remote-send '<C-\><C-N>:wqa<CR>' ^\^N is what you press on a keyboard to enter normal mode from every mode except ex mode without a beep. :wqa means do the command Write All and Quit. so with --remote-send you can send any sequence of key-strokes to act on buffers. You probably want to read from https://vimhelp.org/intro.txt.html#notation https://vimhelp.org/intro.txt.html#notation to learn the fundamentals. I'd avoid neovim initially until you learn enough to decided if you want it - pros and cons both ways.
- ericb 2y agoGreat response, thank-you! I've bounced into vim before. The modal nature threw me a bit--finding :wq written to my code wasn't awesome. :-) I might give it another shot.