5 ms·
GNU Readline is really quite a remarkable piece of technology that everyone uses and yet hardly anyone has any idea how to actually use it efficiently. Along t
by farisjarrah 7y ago
GNU Readline is really quite a remarkable piece of technology that everyone uses and yet hardly anyone has any idea how to actually use it efficiently.
Along the same lines of the article, these things have served me well:
This one is great for just getting the quick commands to help you get around the command line more efficiently
https://readline.kablamo.org/emacs.html https://readline.kablamo.org/emacs.html
This one gives you all the exhaustive options around how you can tweak readline via your inputrc file
https://linux.die.net/man/3/readline https://linux.die.net/man/3/readline
Its sounds really dumb, but after getting to know the bash and readline man pages I have stopped using fish and zsh and just started using more vanilla bash and built in linux tools and its been fantastic. I don't feel like I have lost any productivity and my terminal is a lot more responsive.
- snagglegaggle 7y agoThe line editing is good, as well as reverse search. I don't find myself using anything else sadly.
- dig1 7y agoGNU Readline, for those who doesn't know, also comes with vi mode, where you can search with '/' and '?' keys. You can enable it with 'set -o vi' in bash shell or putting 'set editing-mode vi' it in ~/.inputrc. If you put it in ~/.inputrc, you will get vi mode in all tools/shells which are using Readline like mysql, rlwrap, psql... https://github.com/pkrumins/bash-vi-editing-mode-cheat-sheet/blob/master/bash-vi-editing-mode-cheat-sheet.txt https://github.com/pkrumins/bash-vi-editing-mode-cheat-sheet...
- catalogia 7y agoIf using readline in vi-mode, I recommend also setting `set show-mode-in-prompt on` to provide visual feedback on which mode you're in. Maybe it's just me, but sometimes I walk away from a repl for quite a while (weeks sometimes) and when I come back to it I stumble for a moment because it wasn't in the mode I was expecting.
- brujoand 7y agoAgreed, I just wish it could be a bit more customisable. like so https://savannah.gnu.org/support/?109610 https://savannah.gnu.org/support/?109610
- joombaga 7y agoIt's completely customizable! Just takes some creativity. https://superuser.com/a/1467056/731833 https://superuser.com/a/1467056/731833
- johnchristopher 7y agoWow ! I have been using set -o vi for years but somehow completely missed that / and ? were available ! Thanks !
- fanf2 7y agovi command line editing mode is required by POSIX (see under EXTENDED DESCRIPTION at https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/sh.html https://pubs.opengroup.org/onlinepubs/9699919799.2018edition...)
- yrro 7y agoThe long-form documentation is really useful: https://tiswww.case.edu/php/chet/readline/rluserman.html https://tiswww.case.edu/php/chet/readline/rluserman.html - GNU Readline User Interface (info rluserman) https://tiswww.case.edu/php/chet/readline/readline.html https://tiswww.case.edu/php/chet/readline/readline.html - The GNU Readline Library (info readline, long-form equivalent to the readline(3) man page) Why these are hidden away on some random .edu web site rather than being under gnu.org... -\_:/_/- (OK, to be fair it's on the official GNU Readline web page, but why _that_ isn't on gnu.org is the real source of my shrug!) The Bash manual also includes a brief summary of readline usage (I guess they too didn't know where to find Readline's official documenation) and can be read at https://www.gnu.org/software/bash/manual/html_node/Readline-Interaction.html https://www.gnu.org/software/bash/manual/html_node/Readline-... or info '(bash)Readline'.