12

I use Mac OS X and Arch Linux and occasionally log into FreeBSD and Debian servers by ssh. My favoured tools are zsh, ssh, tmux, git, vim and irssi. I use iTerm2 on Mac OS X and unicode-rxvt on Arch Linux, where I also use Xmonad as window manager.

Currently Ctrl+a+n shifts to the next window in tmux, Alt+right shifts to the next in irssi, Cmd+right shifts to the next tab in iTerm2, Ctrl+w+w shifts to the next buffer in vim and so on. Basically it's just a mess and even though some of these sit in the muscle memory most don't. I'm looking for what could be a consistent keybinding scheme.

In my mind I figure Cmd/Super/Win ought to be used by the OS desktop environment and/or window manager, Alt would be tmux and Ctrl would be vim and irssi. That is going from right to left on the keyboard; Cmd, Alt, Ctrl, and in a somewhat hierarchical way, OS/DE/WM, multiplexer, editor/irc client.

Hence, something like this:

Cmd+Left/+Right - Switch workspace (Xmonad)
Alt+Left+/Right - Switch tmux window
Ctrl+Left/+Right - Switch irssi window/vim buffer

Cmd+1 - Switch to workspace 1 (Xmonad)
Alt+1 - Switch to tmux window 1
Ctrl+1 - Switch to irssi window 1/vim buffer 1

Would this be viable? If not, what uniform keybindings could be used?


UPDATED

I drew a picture (the colours are horrible, I know) to illustrate what I had in mind. I use Dvorak and replaced vim hjkl movement with dhtn - I'll write left/down/up/right to have it make sense for those who don't use vim. Let's keep it to iTerm2 rather than the entire OS X desktop environment (as well as Gnome and KDE). Basically it comes down to this:

cmd+left/right/number for workspaces in Xmonad (or whatever window manager you like)
alt+left/right/number for windows in tmux
ctrl+alt+left/down/up/right/number for buffers in vim
ctrl+alt+left/right/number for windows in irssi
ctrl+left/down/up/right for home/pg down/pg up/end in vim, irssi and zsh

enter image description here In OS X ctrl+left/down/up/right already works like the above, and alt+left/right moves the cursor by word as opposed to just left/right which moves it by character.

Wouldn't this be fairly logical and intuitive? Am I missing something (conflicting keybindings) or is this doable?

1
  • Ugh, good luck there ... that's the road to paradise, that is ...
    – Rook
    Jan 17, 2012 at 0:21

1 Answer 1

5

I tried putting together a cheat sheet or reference card. After exploring various possibilities I ended up doing the following:

  1. Switch from a Swedish keyboard to an English (international) due to the latter being (in my opinion) superior when writing code as well as still being able to type åäö by alt+a/+w/+u+a/+o.
  2. Switch from QWERTY to Dvorak because I like how the keys are positioned (no scientific claims here) for programming purposes (had a look at "Programmer Dvorak" but that was too much).
  3. Replace vim hjkl movement with dhtn, dD with jJ (mnemonic: "junk"), K with H and the ctrl+w prefix with ctrl+o.
  4. Some minor additions (and unbinding advanced features to start out easy)...

TL;DR - stick to using prefixes where available, e.g. ctrl+a in tmux, ctrl+o (Dvorak)/ctrl+s (QWERTY) in vim and irssi. This seems to have the least consequences and be somewhat cross-platform-friendly.

vim dvorak reference card

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .