Keep in mind, most of these work anywhere in OS X,
not just in the terminal.
That's one of my absolute favourite things about Mac OS -- because Cmd exists, and takes over what Ctrl is used for on Windows and Linux, I can use these Ctrl commands and they work as I expect.I wonder if it's possible to get Linux to work the way the Mac does in this regard? Allocate a Meta key to do what Ctrl does move of the time, so that these Ctrl commands became available again? I'd really find it easier to use Linux if that was possible.
https://encrypted.google.com/search?tbm=isch&q=kde+rebind+ke...
Mine too, but I'm on Windows where none of this work out of the box. However, I've found XKeymacs [0] which allows Emacs keys system wide. It is not fool proof, but I've found that the movement keys can be used without much trouble.
Currently I use:
Movement:
C-b C-f backward/forward-char
M-b M-f backward/forward-word
C-p C-n previous/next-line
C-a C-e Home End
C-x h
Capitalisation:
M-l M-c downcase-word, capitalise-word
M-F12 rollup-window
C-z iconify-deiconify-frame
C-q enable-disable xkeymacs
[0] https://github.com/fujieda/xkeymacs http://xkeymacs.osdn.jp/
I also use TouchCursor [1] to get vim like hjkl movement system wide while Space is pressed
[1] https://martin-stone.github.io/touchcursor/overview.html
Keep in mind, most of these work anywhere in OS X, not just in the terminal.
Adding on to this - this works in many places in OS X, since many programs happen use NSTextField, which can have shortcuts configured at the OS level.You can further customize the shortcuts available in a file called DefaultKeyBinding.dict
I use a very slightly modified version of this: https://gist.github.com/cheapRoc/9670905
I highly recommend looking into that, for anyone who is familiar with emacs keybindings and would like them everywhere.
However as a Vim user (mostly motivated by the fact that I can move around pressing single keys which I find more "wrist-ergonomic" - potential fast navigation is a nice plus), I always wonder how heavy emacs users deal with CTRL-acrobatics and movement - do you use c-f/c-b for going forward/backward or the usual cursor keys?
For vi users it makes sense to set $readline (~/.inputrc) to vi-style, so for completion here the vi-style bindings (although probably obvious if you used to Vim).
l "Move forward"
h "Move backward"
k "Move up" (step history backward)
j "Move down" (step history forward)
^ "Jump to beginning of line"
$ "Jump to end of line"
Deleting works as usual with `d` combinations. Furthermore it is convenient to search the history via `/`.I'm hearing people say that "that's impossible" or "it's weird", but I've used this method for ~2 years now. It has become muscle memory.
I put a little pad over the Ctrl Keys to press it easily with muy palm.
That way you can press Control or Alt/Meta (or both at the same time) with the thumb of either hand without a lot of movement. C-f and C-b can be done with either left hand only, or left hand for f/b and right thumb on Control (what used to be Alt, on PC keyboards). Rebinding Caps Lock to Backspace also saves a lot of hand movement. Only a handful of small changes and you get a much better keyboard layout.
Looking at the keys below maybe it was for up/down.
I do. With emacs, you usually have a finger near the Ctrl key at all times anyway, so hitting f or b is much more convenient than moving my right hand over to the arrow keys.
I meant to include it in my original post but I can't edit it now.
# MOTD
function echo_color
printf "\033[0;90m$argv[1]\033[0m\n"
end
echo_color "c-f Move forward"
echo_color "c-b Move backward"
echo_color "c-p Move up"
echo_color "c-n Move down"
echo_color "c-a Jump to beginning of line"
echo_color "c-e Jump to end of line"
echo_color "c-d Delete forward"
echo_color "c-h Delete backward"
echo_color "c-k Delete forward to end of line"
echo_color "c-u Delete entire line"
And a slightly optimized bash version (YMMV): # MOTD
function echo_color() {
printf "\033[0;90m$1\033[0m\n"
}
echo_color "c-f Move forward"
echo_color "c-b Move backward"
echo_color "c-p Move up"
echo_color "c-n Move down"
echo_color "c-a Jump to beginning of line"
echo_color "c-e Jump to end of line"
echo_color "c-d Delete forward"
echo_color "c-h Delete backward"
echo_color "c-k Delete forward to end of line"
echo_color "c-u Delete entire line"Also, for c+h/d there's always a dedicated key/single stroke for at least one of those delete actions.
Historically, many of those keybindings date back to very crude remote terminals where control codes and tty modes were a real concern. For example, I’ve used systems (in the 90’s) where the delete key could freeze your remote connection. Emacs, because of it’s age and ubiquity, has grown up somewhat “around” those traps.
Unless one is a court typist, where wpm matters fully, maybe moving a little and not keeping one's hands on the home row can help avoid carpal tunnel and RSI?
c-t Swap chars (useful for correcting typos)
Keep in mind, most of these work anywhere in OS X, not just in the terminal.
Put this in your .bashrc or .zshrc