7 ms·
What are a sane set of key bindings between i3wm, tmux, and vim?
I'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't really make much sense. I'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'm interested, or if you have any input on how you've made the keybindings across them mesh, I'd be glad!
- geekodour 9y agothis 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 9y agoI 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.
- rocqua 9y agoI use _ instead of - for the vertical split. But other than that, I can really recommend these splits. I also agree with OP on keeping with Vim defaults. Simply because you are more likely to find yourself behind a non-configured Vim than a non-configured tmux.
- sevensor 9y agoI 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.
- simlevesque 9y agoI 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
- francis-io 9y agoI agree that i3 and tmux features overlap a lot. I tend to use 4 desktops usually, then throw terminals I'm not using into the 4+ desktops. I've never liked detaching sessions, I always forget about them. As for remembering keybindings, what I did was comment/remove all but the basic keybindings from i3, then added them back in when I needed them. The only ones I really use are left/right to rearrange windows, moving items to a new desktop, moving to the new desktop, and closing windows. If your going down this rabbit hole, you might want to look at rofi (as a launcher), i3lock-color and i3blocks, which lets you put any script onto a bar at the top or bottom of the screen. This is also a good chance to remove everything, and add it back in when needed. Things I have on my bar are cpu usage, date, time, wifi, a toggle for num/caps lock, a vpn indicator to show when I'm connected, as well as one showing when my webcam is plugged in or on. Having all these things with config files makes managing them really easy with config management. I use Saltstack personally to keep terminal config, desktop setup and packages consistent across work and home. This helps me remember shortcuts if I can expect them to be the same on all PCs I use.
- MachineGunPablo 9y agoThis 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 9y agoI 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.
- saysjonathan 9y agoI created some dwm-inspired tmux pane management that works well for me: https://github.com/saysjonathan/dwm.tmux https://github.com/saysjonathan/dwm.tmux
- mxschumacher 9y agoI have been using Vim + i3wm for years and have never felt the need to overwrite keybindings; what behaviour would you like to achieve?
- burdickjp 9y agoI haven't had any problems with vim and i3. i3 behaves sanely. It's adding tmux between them that is muddying the waters.
- mxschumacher 9y agookay. From what I understand there's significant overlap between i3 and tmux - why do you need both?
- diabeetusman 9y agoI 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.
- atemerev 9y agoDefault keybinding for tmux is absolutely awful. Any attempt to press Ctrl-B with either hand immediately leads to strain.
- mvanbaak 9y agoTry to remap the useless capslock key to act as a control and you will see how Ctrl+b is a very nice key combo!
- rocqua 9y agoI am hesitant to remap capslock because it will fuck me on any computer that isn't mine. Besides. If I'd remap anything to capslock it'd be escape, but thats down to Vim.
- grzm 9y ago> I am hesitant to remap capslock because it will fuck me on any computer that isn't mine. I understand the concern. This does trip me up from time to time, as do other UI preferences such as tracking speed and scroll direction. How much time do you spend (both frequency and duration) using others' computers? Regardless, I suggest you give it a try to see how often it actually does cause an issue, and whether or not it's manageable. Of course, YMMV. It's a trivial change to revert if it doesn't work for you. I know for me personally it's been a substantial overall win to remap caps lock.
- Jtsummers 9y agoI use Dvorak on my home computer and any computer I have a chance to use regularly (like my primary office PC). I've remapped capslock to control at home, but not at work. Typically, the context shift requires no more than 5 minutes, and usually 0 minutes, for me to stop making mistakes. In my experience, the fact that I don't have the precise same physical keyboard helps a ton. My primary office desktop keyboard is different than in the labs (where I have less control), and different than my home laptop. So what I'm typing on feels different and I'm able to quickly adjust. It takes some practice, I won't lie, but after a few weeks you'll probably not be making any major mistakes.
- iopuy 9y agoI 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.
- jff 9y agoIt'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 9y agoI 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".
- mbrock 9y agoThis is basically the reason I've been using Ratpoison or Stumpwm as my window manager since 2004. I don't want to deal with somebody's arbitrary clobbering of hotkeys!
- MachineGunPablo 9y agoI'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
- mikojan 9y agoJust 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.
- GhostVII 9y agoI 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 9y agoI 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 9y agoSure, 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 9y agoI 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 9y agoI 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)
- tobbe2064 9y agoThere 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