Earlier quoted context omitted.
On Mac Os you can also add some other ones that are not enabled by default, there's various write ups on how to do this. https://irreal.org/blog/?p=259 I really missed C-w for delete word personally. There's also a vim plugin by tim pope that adds a few readline keys that don't clash. https://github.com/tpope/vim-rsi And if you use the fish shell you can have both vi and Emacs shortcuts activated at the same time for…
Until you get used to C-w in any text box, and then randomly close browser tabs (ff on Linux) because muscle memory.
Keyboard shortcuts for GNU Readline
141–150 of 174 posts
Re: Keyboard shortcuts for GNU Readline
#142Just enable vim mode (`set -o vi`) and call it a day.
Yes! I never got the hang of the read line short cuts. Only one I remember and regularly use is reverse history search: ctrl-R. The downside is that while vim mode works nicely on bash, other commands like gdb etc that also use read line aren’t as easy to get into vim mode, if they support it at all…
Here is my config from a happy gdb vim mode user :
set editing-mode vi
# If set to ‘on’, Readline performs filename matching and completion in a case-insensitive fashion. The default value is ‘off’.
set completion-ignore-case on
# If set to ‘on’, Readline displays possible completions using different colors to indicate their file type. The color definitions are taken from the
set colored-stats on
# Perform partial (common) completion on the first Tab press, only start # cycling full results on the second Tab press (from bash version 5)
set menu-complete-display-prefix on
### MAPPINGS ###
# Allow to refresh the screen
"\C-l":clear-screen
# If there are multiple matches for completion, Tab should cycle through them
TAB:menu-complete
Re: Keyboard shortcuts for GNU Readline
#143Earlier quoted context omitted.
Yes! I never got the hang of the read line short cuts. Only one I remember and regularly use is reverse history search: ctrl-R. The downside is that while vim mode works nicely on bash, other commands like gdb etc that also use read line aren’t as easy to get into vim mode, if they support it at all…
ime, most programs using readline parse ~/.inputrc. set editing-mode vi set keymap vi-command That does the trick for me in python shell, psql, etc. First thing I do on any fresh unix box is setting above, and echo "set -o vi" >> ~/.bash_profile.
Re: Keyboard shortcuts for GNU Readline
#144Earlier quoted context omitted.
>by far the most useful shortcut for me is Ctrl-r I rarely ever use Ctrl-r since I usually know the starting part of the command I want. So, I type those starting characters and use up/down arrow keys, courtesy these lines in `~/.inputrc` "\e[A": history-search-backward "\e[B": history-search-forward
a really cool hack I found in an HN thread long ago was to stick "hashtags" (aka bash end-of-line comments) at the ends of commands you want to find in your history quickly: sudo systemctl restart myservice #bounce and then ctrl-r and type your hashtag to get right to it
Re: Keyboard shortcuts for GNU Readline
#145I'm using bash (and thus GNU readline) all day every day at work, and by far the most useful shortcut for me is Ctrl-r (reverse history search). I also sometimes use Ctrl-a (start of line, if the keyboard doesn't have a convenient Home key) and Ctrl-e (end of line, in lieu of End key). Btw the post disses Ctrl-s / Ctrl-q for pausing/resuming terminal output, but it can be useful when you're outputting a lot of text (…
set keymap vi-command
"ci\"": "T\"ct\""
I don't think you can do bracket matching/counting, but, even so, ci( is also pretty handy.
Re: Keyboard shortcuts for GNU Readline
#146"Shame, then, that even serious command line hackers never bother learning about its capabilities, as they can supercharge your command line productivity." Because it is really confusing if you are not an emacs user.
I'm a vim guy, and I don't find the readline commands confusing. I just think of it as "Insert" mode in Vim (many of the readline commands work there too!!) and it feels pretty natural.
Then you can use vi(m) commands, modal editing, even press v to drop into a full vim instance for doing more advanced editing of a command line.
It's amazing.
Re: Keyboard shortcuts for GNU Readline
#147Earlier quoted context omitted.
I'm a vim guy, and I don't find the readline commands confusing. I just think of it as "Insert" mode in Vim (many of the readline commands work there too!!) and it feels pretty natural.
Have you tried vi mode in bash? "set -o vi" I think. Then you can use vi(m) commands, modal editing, even press v to drop into a full vim instance for doing more advanced editing of a command line. It's amazing.
Re: Keyboard shortcuts for GNU Readline
#148I'm using bash (and thus GNU readline) all day every day at work, and by far the most useful shortcut for me is Ctrl-r (reverse history search). I also sometimes use Ctrl-a (start of line, if the keyboard doesn't have a convenient Home key) and Ctrl-e (end of line, in lieu of End key). Btw the post disses Ctrl-s / Ctrl-q for pausing/resuming terminal output, but it can be useful when you're outputting a lot of text (…
Re: Keyboard shortcuts for GNU Readline
#149Earlier quoted context omitted.
I'm a vim guy, and I don't find the readline commands confusing. I just think of it as "Insert" mode in Vim (many of the readline commands work there too!!) and it feels pretty natural.
Have you tried vi mode in bash? "set -o vi" I think. Then you can use vi(m) commands, modal editing, even press v to drop into a full vim instance for doing more advanced editing of a command line. It's amazing.
(n.b.: i didn't try to configure this that hard so unless they fixed this in zsh or some configuration thing and that would be great)
Re: Keyboard shortcuts for GNU Readline
#150I'm using bash (and thus GNU readline) all day every day at work, and by far the most useful shortcut for me is Ctrl-r (reverse history search). I also sometimes use Ctrl-a (start of line, if the keyboard doesn't have a convenient Home key) and Ctrl-e (end of line, in lieu of End key). Btw the post disses Ctrl-s / Ctrl-q for pausing/resuming terminal output, but it can be useful when you're outputting a lot of text (…
> but it can be useful when you're outputting a lot of text (for example tailing a logfile). Use "tail +F" and press ^C when you need to pause at some line. Press F to resume tailing.