3 ms·
the top three default readline keybindings that would improve people's lives if they knew about them: - control-w, which julia mentions in the post, to delete
by kragen 2y ago
the top three default readline keybindings that would improve people's lives if they knew about them:
- control-w, which julia mentions in the post, to delete the last word
- control-o: when you're recalling a line from history, edited or no, runs the line and recalls the following line from history. so you can run a sequence of five commands from history by navigating to the first one and hitting control-o five times
- control-r: search backwards in time through your history as you type a search string. control-r again jumps to the previous hit, control-s goes back forward in time. hitting enter or control-o executes it
- dgfitz 2y agoOh I always do ctrl+shift+r for that last bit, like reverse-tabbing on a gui. Good to know about ctrl+s, though I imagine muscle memory will prevent me for ever using it. :)
- kragen 2y agonormally control-shift-r is just control-r; both key combinations send the same byte, 0x12, so they both search backwards in readline history. is your terminal emulator doing something different? if you type control-v control-shift-r enter control-d as the input to the command od -t x1a, what does it say?
- foresto 2y agoI've always wondered why control-s was chosen for this, given the obvious conflict with XOFF (pause), which in my experience is the default almost everywhere. One would have to (a) know why it wasn't working and (b) be willing to disable XOFF, in order to use that key combination for the forward history feature.
- kragen 2y agonowadays it is usually not the default anymore, since tcp connections and unix pipes have other ways to avoid overflowing their buffers. the history is that that keybinding originated on its. as i understand it, its also had another flow control protocol to avoid overflowing serial terminal buffers, the moral equivalent of the enq/ack scheme, which doesn't depend on hard real-time responsiveness to work reliably. (but it wasn't just literally ^e and ^f since emacs uses those even more than ^s.) initially to get emacs running on unix systems you had to do a lot more than just stty -ixon -ixoff; you had to upgrade your host's ram and convince the other users that an editor was a reasonable use of such a large amount of resources. by comparison, adding a couple of extra wires to the modem cable to support rts/cts flow control (which was more reliable anyway) was no big deal but yeah, it was a big pain for about 15 years, from 01990 to 02005. it still bites me occasionally when i accidentally type ^a^f in screen and accidentally enable xoff!