For anyone using a Mac, the basic cursor movement commands available in readline and emacs—C-f, C-b, C-a, C-e, C-n, C-p—are also available in virtually any text input in any program, namely web browser inputs, url bars, and textareas, as well as all system UIs. Once you get used to using these shortcuts that means you can compose and edit text anywhere without ever moving your hands. I recently switched to using Linu…
> “ I try to move my cursor up to edit a previous line using C-p and end up brining up a print dialogue. ” I used to be a big enthusiast of keyboard shortcuts, now I’m getting fed up of how many there are, every program has a zillion shortcuts all stacked on top of each other. Someone needs to come up with a better way (cough Jeff Raskin THE?). This one is notably egregious, hands up anyone who prints often enough to…
Keyboard shortcuts for GNU Readline
131–140 of 174 posts
Re: Keyboard shortcuts for GNU Readline
#132One thing I do, is turn the key repeat speed up as fast as I can stand, and turn the delay to repeat down as low as possible. I have always done this and over the years I've experimented to find the fastest possible settings.
On the Mac, use:
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 7
See: http://hints.macworld.com/article.php?story=2009082319301814...
After getting so used to these fast speeds, when I see folks attempting to type with the slow default speeds ... it is quite hilariously slow and I must confess I feel a little pity for them.
Re: Keyboard shortcuts for GNU Readline
#133Re: Keyboard shortcuts for GNU Readline
#134Lots of comments about small improvements to typing efficiency. It is an important topic. One thing I do, is turn the key repeat speed up as fast as I can stand, and turn the delay to repeat down as low as possible. I have always done this and over the years I've experimented to find the fastest possible settings. On the Mac, use: defaults write NSGlobalDomain KeyRepeat -int 1 defaults write -g InitialKeyRepeat -int…
Re: Keyboard shortcuts for GNU Readline
#135Earlier 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
I don't want to discount how valuable this may be to you. However, for the average sysadmin, or developer who spends time in shells on many different machines, I would gently suggest that this is not a good idea. It's not a significant enough improvement over the way it works out-of-the-box to merit both (1) not getting used to Ctrl-r and (2) getting used to a different behavior for the arrow keys. Just my opinion, o…
Re: Keyboard shortcuts for GNU Readline
#136Earlier quoted context omitted.
C-f(orwards) C-b(ackwards) The reason you use them is that they allow you to not leave the home row. So say you're writing something and need to move back and delete a mistype, it's much faster to do that with C-b C-b C-b backspace M-f than moving your right hand to the arrow keys and moving it back to type the letter and then moving it to the arrow keys again. Now, lot's of people can't be bothered to take the time…
>The reason you use them is that they allow you to not leave the home row How do you press the control key or the alt key while touch typing without loosing home row position? For alt, I try using my thumb, extremely folded down, but for control...?
Re: Keyboard shortcuts for GNU Readline
#137I have two frustrations with keyboard shortcuts that I think most people generally share: 1. They are usually inconsistent, so muscle memory conflicts. 2. You usually can't edit them. If only we could just edit them. The possibilities....
Why can't you edit them? Have you looked at .inputrc? If not, read the article ;P. You can also certainly edit anything in vim/Emacs. On macOS, you can even remap the keyboard shortcuts in almost every GUI app--and even sometimes universally across apps due to conventions--because of how they try to model shortcuts as convenience for the menu bar.
And while you can edit (remap) the keybinds in [neo]Vim, there are limitations. You can't edit all of them at the same time without running into race conditions. I've tried and failed.
And even Emacs - a nearly best-case scenario - is a struggle. First, you have to remap all the Emacs functions you want to change. Then you have to remap all the plugins you use. It's a lot of unnecessary work, and it's tricky to find your way around.
Re: Keyboard shortcuts for GNU Readline
#138Two issues with readline: it's GPL and it's big. For embedded systems intended to become products you really need something else. My tiny variant is this, but for sure there are many others: https://github.com/nklabs/libnklabs ("nkreadline" has editing, tab-completion (for embedded "nkcli" commands) and history)
Of course, if you ship software for your hardware and want to lock your customers out of their own hardware, then I can see why you'd not choose it.
Re: Keyboard shortcuts for GNU Readline
#139It's perhaps worth mentioning the smaller and more liberally licensed editline library if you want to embed the same line-editing functionality in your own CLI. It's been used in non-GNU Unixes for decades. https://troglobit.com/projects/editline/ See also the note at the bottom of that page about other versions of editline/libedit.
Re: Keyboard shortcuts for GNU Readline
#140Less Useful Key Bindings: C-l Clear screen This is the one I use most frequently. All day every day. I hate clutter and unless I need to refer to the output from the previous commands, it's gone.