Hey, is there any way to get vi mode in the Nix repl, please?
There is a tool called rlwrap that offers a vi-mode according to this question, though I canât find any docs on that.
That might be an option. Nix repl does not support vi mode natively.
Thank you for the tip. rlwrap sounds like too much trouble. I wonât bother. I do wonder, however⌠does nix repl use GNU readline?
Emacs has a vi mode. Emacs has a nix repl mode. Use emacs!
Seems like it doesnât by default but can be compiled with Readline support so that it honors .inputrc
?
This is one for the books.
Oh wow thatâs an amazing solution, I had no idea that was possible. Iâll certainly try that out sometime!
I got all excited by this but it looks like itâs pretty vestigal, there is that ifdef but configure hardcodes editline. Which is not the more capable libedit from BSD, but a very minimal one with entirely hardcoded keys.
I also tried rlwrap but the catch is that it disables tab completion, since naturally rlwrap has no idea about nix. The commit that adds readline is from 2018, and mentions it doesnât support completion and its trivial anyway. configure
has libeditline hardcoded, so having a civilized REPL experience would amount to updating both configure and repl.cc, basically implementing from scratch. Itâs not complicated though.
But, the bigger issue is that the standard line editing libraries in both GPL and BSD have existed for decades, yet nix chose to not use them, which implies itâs on purpose. So any work done to support a better REPL experience might just be rejected, without first finding out why it is the way it is.
You can open a feature ârequestâ, explain your reasoning and research, and indicate that youâre willing to implement, you just want to know whether it has any chance of being approved first.
It might take a while to get a response, but if you get a go, thatâs at least a start.
The original reason for not including more complex libraries might have to do with binary size or other technical concerns that are not current anymore, Nix is almost 20 years old after all.