
What are a sane set of key bindings between i3wm, tmux, and vim? - burdickjp
I&#x27;m test-driving using i3wm, tmux, and vim on a regular basis, and am in the process of learning how to use the three of them together. The default key bindings for each of them individually is decently sane, but together they don&#x27;t really make much sense. I&#x27;d like to put together bindings which are designed for the three together. If you have any links which detail keybindings for these programs, I&#x27;m interested, or if you have any input on how you&#x27;ve made the keybindings across them mesh, I&#x27;d be glad!
======
simlevesque
I never found that i3 and tmux were so useful together... i3 gives me 90% of
what tmux offers when you configure it right. The only thing that i3 lacks is
to detach a session. I don' use that feature often so I'm not missing much.

Also, check this out: [https://github.com/jwilm/i3-vim-
focus](https://github.com/jwilm/i3-vim-focus)

~~~
MachineGunPablo
This exactly. I honestly don't quite get the need for a terminal multiplexer
inside a tiling window manager. I also get along with ctrl-Z + fg for
'detaching'.

~~~
oneweekwonder
I rarely use tmux on my local machine. But as soon as I ssh in somewhere you
will see me `tmux attach` and if that fails `tmux`. Also for unattached
sessions hanging around on production servers we kill nightly with a cron.

------
sevensor
I worked with that combination for several years, until I switched to Kakoune.
(The nice thing about kakoune is that you can connect multiple clients to the
same session, instead of doing splits in the editor.) I still use both i3
(Sway when I can) and tmux, at any rate. I recommend avoiding nested
heterogenous splits, as much as possible. In other words, the cognitive burden
of having vim's "windows" inside tmux panes inside terminal emulators (which
can _also_ introduce splits and tabs) inside i3 windows, is just too great. So
if I'm running tmux, I try to have it be the only thing running on that i3
screen. If I'm splitting Vim, I try to have it occupy an entire i3 screen or
tmux window. If I'm splitting a tmux window into panes, I try not to split vim
inside it. And I _never_ use terminal emulator splits or tabs.

------
tobbe2064
There is a tmux/vim plugin which let's you move seemlessly between vim and
tmux panes within tmux. I use it all the time since I'm running tmux on a
remote machine. It would be awesome I'd there was a similar plugin that worked
between tmux and i3 over ssh.

Im using windows key for i3 and ctrl space for tmux and i cant say ive ever
experienced any problems.

I strictly use i3 for displaying windows at certain monitors and stacking
windows

------
atemerev
Default keybinding for tmux is absolutely awful. Any attempt to press Ctrl-B
with either hand immediately leads to strain.

~~~
mvanbaak
Try to remap the useless capslock key to act as a control and you will see how
Ctrl+b is a very nice key combo!

~~~
atemerev
The same. Even worse in fact, as Caps-B has even larger distance between the
keys than Ctrl-B.

Ctrl-T, Ctrl-G, Ctrl-B, Ctrl-Y, Ctrl-H and Ctrl-N should never be used for
control key sequences except for something invoked rarely (and certainly not
at the beginning of each command).

Besides, Ctrl-B is not even logical. It was decided upon as "well, screen uses
Ctrl-A, so we'll use Ctrl-B". Zero concerns about usability.

~~~
grzm
While distance between keys (in this case ctrl and B) is one factor, it's not
the only factor. The position of Caps Lock is just to the left of A, which is
part of the home row on a QWERTY keyboard, while depending on hand position,
control is much harder to get to. I know the curl required for my pinky to
engage Control is less comfortable for me than the slight shift to engage Caps
Lock.

~~~
atemerev
Yes, just have tested it; marginally better, but still not something I'd want
to push repeatedly.

------
diabeetusman
I moved my i3 arrow keybindings over from jkl; to hjkl. MOD+H does horizontal
split, I think? I remapped it to MOD+B to be right next to the vertical split
key.

------
mxschumacher
I have been using Vim + i3wm for years and have never felt the need to
overwrite keybindings; what behaviour would you like to achieve?

~~~
burdickjp
I haven't had any problems with vim and i3. i3 behaves sanely. It's adding
tmux between them that is muddying the waters.

~~~
mxschumacher
okay. From what I understand there's significant overlap between i3 and tmux -
why do you need both?

~~~
burdickjp
detaching and reattaching sessions.

~~~
sea6ear
maybe the dtach utility would be helpful.

It's basically just the detach / attach functionality of tmux or screen,
without any of the window/frame handling functionality.

(often paired with dvtm but will also work for other setups)

------
jff
It's not what you're asking, but I've always had similar problems with tiling
window managers. They want to use a lot of keybindings, typically keyed on Alt
as the modifier; the problem is that lots of programs such as Emacs and
Firefox also want to use Alt bindings.

Eventually I settled on stumpwm because the default bindings didn't interfere.
In the same way Emacs commands often start with a C-x followed by some other
key (e.g. C-x C-c to quit), stumpwm prefixes every command with C-t. So to
split a pane, you do C-t s, then C-t n to jump to the next pane, C-t k to kill
the window in the current pane, etc. The only thing it conflicts with is
opening a new tab in a browser, and you can accomplish that by hitting 'C-t t'
which quickly becomes second nature.

The other alternative is to use a mouse-oriented WM like fvwm or rio, but
that's easy and doesn't involve memorizing dozens of key bindings ;)

~~~
lgunsch
I set my key binding in i3 to the super (windows key), and for the majority of
the time it stays out of the way of Emacs, Conkeror, and other programs. I
don't really have any issues with it taking up the keybinding "space".

------
GhostVII
I find that it is sometimes inevitable that you will have conflicting key
combinations, so I added an empty i3 mode called "pause" which prevents i3
from reading the key combinations until you press Escape.

~~~
burdickjp
I think I'm going to do something similar with tmux and i3. Do you have a
config you can point me to?

I'm thinking I can have a key combination load a config file, which will
include loading the command mode key bindings and some visual indication of
entering a command mode; another key combination unloads them and returns to
an "insert" mode.

~~~
GhostVII
Sure, just put this somewhere in your i3 config file:

    
    
      mode "pause" {
          bindsym Escape mode "default"
      }
    
      bindsym $mod+p mode "pause"
    

That should show a 'pause' indicator in the i3 bar when you press $mod+p, and
unpause when you press escape

------
zeveb
I like to use C-z for tmux and Super for my window manager, but I really
prefer chords over modes (as you can guess, I use emacs rather than vim). In
my ideal world, applications would handle Ctrl & Meta, tmux would handle Super
and my window manager would handle Hyper. But I don't live in a perfect world.

~~~
waaks
I almost live in this world in a VM. Because of the VM I dont use Super
because host seems to capture that before the VM either on Mac or Windows.

CapsLock -> Hyper -> mod3 (used for i3wm) Alt+key (used for tmux) Ctrl+key (as
usual in vim)

------
MachineGunPablo
I'm not sure tmux makes a lot of sense alongside i3wm. For i3wm + vim
consistent navigation check this out: [https://github.com/termhn/i3-vim-
nav](https://github.com/termhn/i3-vim-nav)

------
iopuy
I generally work on i3wm in virtualBox on Mac. Add the Mac key into the mix
and there goes one more level of complexity. My only other thing to add is i3
may be the most useful piece of software I have adopted in the last 2 years.

------
saysjonathan
I created some dwm-inspired tmux pane management that works well for me:
[https://github.com/saysjonathan/dwm.tmux](https://github.com/saysjonathan/dwm.tmux)

------
mikojan
Just throw out tmux and write a custom script for that one feature i3wm
doesn't provide? I've yet to come across any key binding issue resulting from
vim/i3wm cross-usage.

------
geekodour
this really depends on you configure it the way you want, I went through
various dot files and found few very useful.

one tmux lifesaver is this one for me:

# split panes using | and -

bind | split-window -h

bind - split-window -v

unbind '"'

unbind %

I think you should just explore various dotfiles. does not take much time that
way.

~~~
burdickjp
I think I need to sit down with a list of available behaviors and default
keybindings and parallelize them, leaning toward keeping vim's default.

But, even better, I think I can make tmux and i3 modal by mapping config
switching to a keybinding. In this way they can be put into a command mode and
all keybindings in command mode can be shared. Include a visual indicator and
I think it'd work really well.

