Hacker News new | ask | show | jobs
by sewer_bird 3210 days ago
"feels like Vim, just different enough for you to be frustrated" is true, but I like the Lua built-in: it's a fantastic language for this kind of thing, and feels more inviting to a new plugin-writer than, say, Vimscript might.
5 comments

"It isn’t widely known that Vim has interfaces into several popular scripting languages: Python, Ruby, Perl, Scheme, and Tcl."

https://items.sjbach.com/97/writing-a-vim-plugin

A lot of those languages don't come activated by default on the packaged versions of Vim - Lua is one of them, at least on osx/homebrew.

That strongly dissuades me from writing plugins in anything other than Vimscript. It might work for the guy who recompiles his Vim often, but it will not work on that vim instance running in your server. Ubiquity is one of Vim's main points.

Doesn't Vim have Lua support too?
Neovim does, and it will be a first class scripting citizen in 0.3.

https://neovim.io/roadmap/

I know there are plugins for the lua file type (syntax highlighting, etc.). I don't know if you can write plugins in lua.
Lua is a valid language to write plugins.
My own fork of Antirez's kilo was created specifically to add Lua support:

http://github.com/skx/kilua

Having even basic support, for key-bindings, and reacting to events, is very useful.

I wrote a console-based mail client which is configured and scripted via Lua, and would love to see Lua added to "all the things".

If you're after something lightweight, similar enough to be vim to be useable, and lua built-in checkout vis: https://github.com/martanne/vis

The structural regular expressions are also pretty interesting.

Yeah, the comment was a little tongue-in-cheek. I didn’t think just writing yet another Vim clone would be very interesting, whereas trying to keep it minimal yet usable would be an interesting challenge.
I actually really like Vimscript. It has features that many popular languages lack or have only recently got, like destructuring

    let [file, line, col] = split("hello.c:39:10", ":")
This is the sort of feature I just assumed it didn't have, because few enough real programming languages have it.

The main issue I think is that there are lots of different contexts where you can put vimscript, and different bits of vimscript are legal in those contexts, or at least seem to be.