Live data from Hacker News

Ask HN: What code editors or IDEs are easily scriptable?

news.ycombinator.com

61–68 of 68 posts

Re: Ask HN: What code editors or IDEs are easily scriptable?

#61
post #56

Of the “preferred not” languages you listed, Lisp and Lisp-derivatives are easily the most pragmatic languages you will see doing “real” work outside of the scripting environment. So, given the dearth of good scriptable editors using other languages, why not give Emacs a try? I will grant that Elisp is a bit of an odd dialect, but a lot of what you learn from learning Elisp will transfer to understanding other langua…

Emacs Lisp is my first Lisp, so I don't even really notice how supposedly weird it is. It's a fine language, don't let it get in your way, and it's just as important to be able to read other's code than it is to write your own. Unless you have all the time in the world, you want to use as much of other people's work as possible. Would I have preferred an editor written in Ruby? Sure. But I think I was right to not wo…

Indeed—most of the weirdness comes from things like dynamic scoping (deprecated, going away, good riddance—most of the packages I use have all switched to using lexical scoping anyway) and function names like `mapcar` instead of just `map`. But that's a trivial matter. Would I write a shell script in Emacs Lisp just for kicks? No. Is it more than good enough to script the crap out of my text editor? Oh yeah.

> read other's code

I'll second this: there are so many really good packages out there that it makes it easy to find something to get some pointers on how to proceed.

Re: Ask HN: What code editors or IDEs are easily scriptable?

#62

Plain old vim doesn't only do vimscript, you can also script it in Perl, Python, TCL, Lua and maybe one more I cannot remember. See e.g. this python howto: http://codeseekah.com/2012/03/04/vim-scripting-with-python-l...

This is probably the most promising answer to me.

> Plain old vim

By this, do you mean this is only available in vim, not NeoVim?

Re: Ask HN: What code editors or IDEs are easily scriptable?

#63

Zed is written in Rust: https://github.com/zed-industries/zed . It seems relatively straightforward to write an extension for it, but I've never personally tried (I suck at Rust). I will say that Lua is extremely easy to pick up, and as far as hacking on an IDE I think that simplicity might make it an ideal language.

I tried out Zed after reading this, super impressive and could overtake vscode in a year or two. Missing a few things like supporting editorconfig, but that's being worked on this week. Would switch immediately if it supported a few more things

Re: Ask HN: What code editors or IDEs are easily scriptable?

#64
post #46
post #15

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.

Here'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…

For 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

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 ':wqa'

^\^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 to learn the fundamentals.

I'd avoid neovim initially until you learn enough to decided if you want it - pros and cons both ways.

Re: Ask HN: What code editors or IDEs are easily scriptable?

#65

Some people live in their editor and occasionally drop into a shell. I've personally found a lot less friction in doing the opposite. Live in the shell, and occasionally drop into your editor. I used to think that it would be better to have a lot of scripting and automation built into my editor, but there are so many well-built, connect-able tools already available in a unix shell that it's usually easier to write sc…

+1 .. Came to say the same thing. My favorite IDE is the Unix shell. Multiple great editors to pick from, multiple and very flexible ways to hook all your tools together. Easy to use on remote systems. All of it free software.

Re: Ask HN: What code editors or IDEs are easily scriptable?

#66
post #63

Zed is written in Rust: https://github.com/zed-industries/zed . It seems relatively straightforward to write an extension for it, but I've never personally tried (I suck at Rust). I will say that Lua is extremely easy to pick up, and as far as hacking on an IDE I think that simplicity might make it an ideal language.

I tried out Zed after reading this, super impressive and could overtake vscode in a year or two. Missing a few things like supporting editorconfig, but that's being worked on this week. Would switch immediately if it supported a few more things

nobody is going to take VSCode so soon. But I'm starting to feel the VSCode fatigue in the air. Kinda like with React. I was looking for another editor to use or maybe get back to emacs. Funny enough, as I have a lot of free time right now, I decided to code my own editor. It is very fun!

Re: Ask HN: What code editors or IDEs are easily scriptable?

#67
post #62

Plain old vim doesn't only do vimscript, you can also script it in Perl, Python, TCL, Lua and maybe one more I cannot remember. See e.g. this python howto: http://codeseekah.com/2012/03/04/vim-scripting-with-python-l...

This is probably the most promising answer to me. > Plain old vim By this, do you mean this is only available in vim, not NeoVim?

NeoVim has additional scripting functionality over Vim actually, which is why some of their plugins aren’t compatible with Vim. So OP is referring to Vim over the likes of vscode, jetbrains etc

Re: Ask HN: What code editors or IDEs are easily scriptable?

#68
post #64
post #46

Earlier quoted context omitted.

Here'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…

For 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 Basically (or gvim, yu might want --remote-silent too): vim --servername foo --remote-silent filename [ filename ... ] The end of that doc explain…

Great 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.
Post reply on HN