Email or username:

Password:

Forgot your password?
Julia Evans

more weird terminal stuff: line editing

22 comments
Julia Evans

(describing readline keybindings as "those weird keyboard shortcuts from emacs" and libedit as "like readline but worse" is maybe questionable but that is how I feel about them)

Lucas Werkmeister

@b0rk no, you’re right and you should say it

jade

@b0rk i call editline Great Value brand readline. so, well, probably not wrong. libedit is also definitely store brand readline.

Ted Mielczarek

@b0rk as an emacs user for two decades: you're 100% right.

Tyler Smith

@b0rk

I think this is #emacs super power. It provides a universal UI for all kinds of text. Files, shells, file browsers, REPLs for any language, email, RSS feeds etc. All with the same weird set of keybindings, and fully customizable .

I can appreciate Emacs is not for everyone, but I don't know why other editors don't take this approach (or maybe they do?)

mixed berry social anxiety disorder πŸ“

@b0rk i actually didn't realize readline was something that got used in things like bash, or even really a library you can just use, i never thought too hard about why rlwrap was called that and just thought "that's the thing you run to use readline"

maybe a tool i wrote for work should have readline shoved into it... πŸ€”

Julia Evans

@monorail I believe readline is GPL licensed (not LGPL) so to use readline you need to have a GPL compatible license

mixed berry social anxiety disorder πŸ“

@b0rk it's a strictly internal tool used by only people on my team, which i don't believe counts as "redistribution" for the purposes of GPL, but i'll make sure i take a look. thanks for the heads up :3

Meriel :leafeon:

@b0rk zle (zsh's custom line editor) is a thing of horrible, fantastic beauty

Dan Neuman

@omni @b0rk My system is on zsh, so I should look that up.

Tagomago

@b0rk I remember an interview with Brian Fox where he said that Readline was one of the things he was most proud when he finished developing Bash.

Christmas Tree

@b0rk "libedit (which is like readline but worse)"

πŸ˜‚

I feel this in my bones though. I know it's a bad idea, but I've stayed on python3.10 specifically because 3.11 has transition to libedit and it's ruined my muscle memory.

Julia Evans

@christmastree it looks like if you go to python 3.13 you get a new (non-readline-based) interactive shell which seems to work much better than the libedit one docs.python.org/3.13/whatsnew/

Schamschula

@b0rk There is a reason why a lot of Mac users install #MacPorts or #Homebrew!
However, you can blame GPL 3.0 for the current situation. Under GLP 2.0 Apple could provide OSS packages w/o giving away their core OS technology to Richard Stallman for free.

WTL

@b0rk I've used control-A for decades, and only last year learned about Control-E.

Just keep learning!

fs111

@b0rk maybe mention that with set -o vi you get from weird emacs to weird vi keys

Julia Evans

@fs111 hmm i guess I just don't really believe in modal editing in the readline context for some reason, like I love vim but somehow I just never want to use it to edit a 1-line command

fs111

@b0rk fair, but it is an option that can be enabled and I know people using that

Jeff

@b0rk I did not know about rlwrap. (I did know about readline, this image is great, and "readline but worse" is totally reasonable commentary)

@ed1conf `rlwrap ed` is basically quick'n'dirty en/ex enhancements for `ed(1)`. I'm probably still going to just use vanilla ed(1), but having the arrow keys work was interesting.

ed(1) conference

@overeducatedredneck

Once you're comfortable with rlwrap(1), you can investigate cpwrap(1), a CoPilot wrapper for CLI applications. :flan_evil:

@b0rk

David Hashe

@b0rk My personal taxonomy puts prompt_toolkit (the custom lib used by ipython) at the same level as readline and libedit.

It's a reusable component, and it definitely aims to be the Python version of readline. I've used it to add line editing to a personal project and I quite like it.

Julia Evans

@dhashe thanks, I was trying to remember the name of that and couldn't remember

Go Up