h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
311 stars 23 forks source link

REPL and readline bindings #9

Closed mwgkgk closed 6 years ago

mwgkgk commented 6 years ago

Most readline shortcuts are not supported by the REPL. The workaround wrapper called rlwrap is not working with min -i for some reason (does work for other projects).

h3rald commented 6 years ago

That's probably because min REPL internally uses nimline for line editing. It's a tiny surrogate for readline, just it is implemented in pure Nim and works on Windows as well, without relying on libreadline.

Of course not all shortcuts work, I only focused on providing the essential ones like tab completion, history, go to end/start of line, kill line, etc. What are you missing exactly and what platform are you running on?

mwgkgk commented 6 years ago

Oh, I see. I think of readline as a de-facto standard that you can meet even in places like world of warcraft macro window / login screen, even this very editor :) The widespread bindings are emulating emacs ones, there's also a vi mode.

Things lacking (that I use):

Ctrl-a     move cursor to beginning of the line
Ctrl-f      move forward a character
Ctrl-b     should move backward a character (currently moves cursor to beginning of a line)
Alt-f        Move forward to the end of the next word. 
Alt-b       Move back to the start of the current or previous word
Ctrl-p     Previous item in history
Ctrl-n     Next item in history
Ctrl-k     Kill til end of line
Ctrl-u     Kill whole line
Ctrl-w    Kill word backward

I'm not sure how much can I ask of you :D So there you go. Not insisting on Ctrl-b behavior change.

rlwrap thing not working on Archlinux bash/zsh with or without tmux, I'll provide versions if needed