5 ms·
Does anyone run tmux with a tiling window manager for local development? If so, what are the advantages? I know automating sessions is one of them, as explaine
by nextos 10y ago
Does anyone run tmux with a tiling window manager for local development?
If so, what are the advantages? I know automating sessions is one of them, as explained in the article.
I am more interested in hearing about interactions with the terminal. You already get good mouse-less window management with something like i3 or xmonad.
How about copy & paste? I use urxvt plugin for this, but I often find myself using the mouse to select and middle-click. Is tmux better?
- ianleeclark 10y agoI run i3 and tmux. The biggest reason I do this is that I'm much more used to tmux key bindings rather than i3. Moreover, I don't think I'd get any huge benefits by getting more used to i3 key bindings. Edit for another reason: I use Tmux on my work laptop (OSX) and on my Desktop (FreeBSD + i3), so my key bindings are supported on essentially whatever machine I'm on.
- nilkn 10y agoI do. Part of it is just that I'm so used to it from using it remotely that I feel at home using it locally as well. But it's also very portable. For instance, I can use it in macOS or even on Windows using the Ubuntu bash subsystem. This makes it effectively a universal tiled window manager for me.
- devereaux 10y agoI do that, not in a real "tiling window manager" but something very close: openbox, set to show no titlebars, and using shortcuts to title the windows to precise positions. I have 3 position: most of my screen on the left, a small vertical slice on the right, a smaller chunk underneath. If I want a titlebar for some application, I have a shortcut that will give the window a titlebar, and then I can move it around with the mouse if I want to. So I get the best of both worlds. Surprise - I don't run tmux. It is simpler to have several roxterm, in these position, with various tabs open. When I work remotely, I use screen on the remote host, but that's all. To give you an idea of my shortcuts, in a real life scenario ; my caps lock is remapped to control or escape with xcape: - esc: pop a new roxterm and from wherever I am, bring me to the terminal desktop - f9: resize this roxterm to the left part of the screen - esc: pop another roxterm, focus it - ctrl-f9: resize it to the right vertical slice of the screen - f4: switch to the browser desktop - f12: put by browser in full screen, to check some reference without distraction - f5: switch back to the terminals desktop - alt-tab: switch to the roxterm that's currently on the right - f12: make this roxterm full screen to do something without distraction for a while - f12: demaximize and put back this roxterm where it was - f9: now move this roxterm to the left, over the other one - alt-tab: move to the other roxterm that was on the left - ctrl-f9: put this roxterm in the vertical slice position on the right - ctrl-space: make this roxterm sticky, showing on all desktop - f4: move back to the internet desktop to check more documentation - f9: resize the browser to be on the left part of the screen, so that I can see both the browser and the roxterm - f5: move back to the terminal desktop. The space occupied by the browser will be replaced by the roxterm I left there, on the left - alt-tab: move focus to this roxterm - ctrl-t: open a new tab in this roxterm - ctrl-v : paste some stuff from the internet browser (etc..) I have accomplished all that with about 20 keystrokes, from muscle memory. When I connect my extra wide screen, f10 and f11 have similar windows resizing function as f9 do on the laptop screen. f1 to f8 take me to desktop dedicated to some use or another (f7 is the windows desktop, with visual studio, f6 is the rstudio desktop, etc) One think I positively hated until recently: copy and paste. Muscle memory means ctrl-shift-c in one application and ctrl-c in another didn't work. So in the terminal, I remapped the sigint signals to ctrl-x with stty. Hitting ctrl-x is just as convenient as ctrl-c and now I can copy paste as needed. ctrl-v to enter verbatim sequences is done with ctrl-q, just like in vim. so ctrl-c and ctrl-v work everywhere. When I catch myself wanting to use the x copy paste buffer, the middle click is not so hard: on a thinkpad keyboard, it is right below the space key. But I just prefer ctrl-v. The luxury of having 2 independant copy-paste buffers is appreciable for some tasks however :) Anyway, sorry for the long reply. I just don't have a lot of opportunities to talk about my setup. I am some kind of an optimization freak, I know it. But I don't want an interface to bother me. I have been using that for the last 3 or 4 years after giving up on OSX, and it has one great quality: I don't have to think about it. It just work the way I want. YMMV of course.
- nextos 10y agoThanks, this is very interesting. I agree one of the major pain points of X11 systems, terminals, etc is the clipboard. So many different concepts and shortcuts across programs. I use xmonad, urxvt or xterm, emacs-nox and vimperator. I'm trying to make all them consistent. Perhaps the last thing to polish in my setup.
- devereaux 10y ago/bin/stty start "" stop "" intr ^x add to .inputrc: "\C-q": quoted-insert Then remap copy to ctrl-c, and paste to ctrl-v, and ctrl-x will work like your old ctrl-c, while ctrl-q will work like your old ctrl-v. remapping is easy with roxterm. I suppose xterm and urxvt can do the same. If you like to remove part of words in bash, the following can be helpful too: "\C-s": backward-kill-word "\C-g": kill-word "\C-w": unix-word-rubout Kill word vs word-rubout is a matter of taste, and which separators are in your filenames.
- ramblenode 10y agoNot ideal, but the best solution I've found so far for moving text between the command line and other applications in urxvt is setting Bash to vi mode and then using visual mode for yanking/putting. I have Vim as my $EDITOR, which is opened when entering visual mode (I believe opening the editor is default Bash behavior). Vim is set to use the system clipboard ("set clipboard=unnamedplus" in the .vimrc) so from there I can bus text to/from other applications. Dealing with stdout/err is another beast...
- atweiden 10y agoI use Openbox with some keybindings I picked up from ArchBang a while back, documented here [1]. tmux really comes into its own when you combine it with Vim and FZF [2]. I was initially hesitant to try tmux, but once I themed my tmux.conf and nailed down the keybindings, it became indispensable to me. I now use tmux as a basic organizational tool, and I always have at least one tmux session running on my desktop. I have Ctrl+A+S bound to split the tmux screen horizontally, and Ctrl+A+A to toggle maximizing the tmux pane. Shift-DownArrow opens up a new tmux window to the right of the current one. Shift-LeftArrow and Shift-RightArrow move left and right between the tmux windows. I wanted it to be reminiscent of URxvt tabs. Another one of my favorite bindings works as follows: visually highlight a line in Vim, then hit <leader>tj, which sends the highlighted line of code to an open terminal in a split tmux window below. Very useful for REPLs. You can also open Vim in the lower split terminal and use the same keybinding to send text directly from one Vim instance to another. It uses vim-tbone [3] and some custom bindings from @junegunn. [1] https://github.com/atweiden/dotfiles https://github.com/atweiden/dotfiles [2] https://github.com/junegunn/fzf https://github.com/junegunn/fzf [3] https://github.com/tpope/vim-tbone https://github.com/tpope/vim-tbone
- pfranz 10y agoSimilar to that, I've seen a lot of blog posts about Tmux and Vim, but I've been itching to see one where they talk about day-to-day. When do they use vim-split versus tmux pane, vim buffers versus tmux windows? I use both, but aren't very systematic...there's a bit of cognitive load when remembering which I'm using and using the different commands to navigate. You can't do diffs with panes and it's nice to use vim buffers instead of tmux windows when editing a series of files. I imagine using a tiling window manager with tmux you'd have a similar issue. Sshing into a box you can launch tmux and have windows and splits inside, but you couldn't use your WM.
- kornish 10y agoWhat I do, and would recommend, is spin up vim or emacs as a daemon, then connect to it as a client in one or more tmux windows. That way, you can yank/put easily using the usual shortcuts from any tmux window to any tmux window. Then, it's usually easiest to only use intra-process pane splitting (keeping it all in vim or emacs) unless you need to do something that doesn't follow a perfect division, like: top half vim / bottom left vim / bottom right trailing logfile or something. More than happy to write a blog post, if you're interested.
- nilkn 10y agoI already use tmux and vim regularly but I'd definitely be interested in a blog post on this technique.
- pfranz 10y agoInteresting to run it as a daemon and connect. I'd be curious to see how you set it up and use it in practice. Whenever I use vim splits I'm almost always diffing left and right. So, nothing fancy.
- kornish 10y agoDefinitely. If you shoot me an email (hello@tedkornish.com) I'll let you know when the post is up. As a disclaimer, I use emacs with evil mode, not vim proper, so the command is just emacs --daemon=myproject Then it's just emacsclient -nw -s myproject ./directoryhere to connect, and the first part of that can be aliased away. Not 100% sure that vim has a good daemon/client mode, but I seem to recall something existing along those lines. It can be extremely useful to have multiple collections of editor panes set up, each in a different part of the codebase, and the ability to switch back and forth quickly with tmux - really helps for debugging and keeping organized.
- nicwest 10y agoI was a long time tmux user while on mac. Since I've swapped to arch and i3 I don't use tmux at all, and just use the WM. I basically live in terminals nowadays and I've not really missed tmux. The thing I really do miss is vim-tmux-navigator. https://github.com/christoomey/vim-tmux-navigator https://github.com/christoomey/vim-tmux-navigator.
- pyre 10y agoOne thing that I like about tmux is using tools like tmuxinator to compose a project-related session where server processes are spun up in separate tmux windows. Do you have something equivalent to this with just i3 or is that just not your use-case?
- minhajuddin 10y agoI use it with Xmonad, for me tmux's scripting and ability to detach and attach to sessions is a big win. It also allows me to run async tests by triggering a test from vim without blocking. And, the copy paste support is also very good.
- 0xCMP 10y agoHow do you deal with switching between projects though? I find my self switching between several projects as I'm working through something and suddenly something needs to be done in another project which is blocking someone. Wouldn't tmux + tmuxp (or similar) be more useful than just i3? Or do you have scripts for launching all those windows and putting them in the right place?
- greenshackle2 10y agoI use awesome wm with tmux and urxvt. Tmux has a nice copy mode, which has emacs and vi modes. By default it copies to tmux buffers, but you can set it up to copy to the system's clipboard: https://coderwall.com/p/4b0d0a/how-to-copy-and-paste-with-tmux-on-ubuntu https://coderwall.com/p/4b0d0a/how-to-copy-and-paste-with-tm... It's rather idiosyncratic but I've gotten used to running all my terminals inside a single tmux window. I spend 95% of my time in either a terminal or Chrome so I basically only use awesome to switch between them, or put a browser and terminal side by side.
- julian_1 10y agoI use screen (like tmux) and xmonad. The tiling window-manager is used for longer running GUI apps - webbrowser, pdf/email viewer, CAD etc and for apps that I don't context switch as quickly. Also for handling the dual monitor setup. I use screen for managing a consistent cli environment - that could be anywhere - on my dev machine, or sshd to a dev container or cloud box. I also tend to context switch screen environments much more quickly - eg. between edit (vim), compile and run turnaround.
- roblabla 10y agoI'm writing an i3/tmux integration similar to iTerm2's[0], but working at the WM layer, using i3 and urxvt. The reason I'm doing this is that I'm often ssh'd into a box, and having to ssh into multiple terminal is a chore. I often create a spontaneous term that I close after a couple of minutes. Being able to have a dedicated ssh'd workspace where every split is ssh'd into the box would be a godsent. This would also fix the mouse integration and various other things that annoy me with raw tmux. [0]: https://www.youtube.com/watch?v=nGhfE9n1RLo https://www.youtube.com/watch?v=nGhfE9n1RLo
- opk 10y agoThis would be great if you get it working. I don't suppose you've got a link for what you've got so far in git or anything? I only make basic use of tmux because I'm more comfortable with i3 key bindings.
- roblabla 10y agoWell, it's extremely rudimentary but I put everything on github : https://github.com/roblabla/i3-tmux-integration/tree/in-progress https://github.com/roblabla/i3-tmux-integration/tree/in-prog... I'm still stumbling in the dark trying to understand how everything works. Also, the code might be an abomination, my goal was mostly to get stuff working, refactoring will come later. This project is at once a learning project for many things (tmux internals, Rust, IPC in general, i3 IPC) and a tool I've been really needing for a while, so progress is slow but steady (I mostly work on it in sleepless nights and week-ends).
- 20after4 10y agoThat's really cool. I'm a linux user who lusts after all the cool stuff in iTerm2, so I appreciate what you are trying to do.
- curioussavage 10y agoThis sounds cool. Especially for me since i have been using a chrome book with Linux. There is no cmd or windows key so I have to use alt for i3 but then have nothing for vim/tmux navigator.
- rcarmo 10y agoSince I can't use a tiling window manager everywhere, I do the next best thing: I have a set of key configs for most platforms that gives me (mostly) uniform control over windows, and then use the local terminal emulator with tmux inside. I use Moom on the Mac with hotkeys that match the Windows left/right-side tiling, and a custom OpenBox config[1] that matches those too: https://github.com/rcarmo/docker-templates/blob/master/desktop-chrome/home/user/.config/openbox/rc.xml https://github.com/rcarmo/docker-templates/blob/master/deskt... Then on the Mac I usually use the native Terminal (I keep trying to switch to iTerm, but most of the performance issues Terminal had have been ironed out by now), on Linux I usually use lxterminal, and on Windows I either use Cygwin's mintty or (more recently) wsltty to interact with Bash for Windows: https://github.com/mintty/wsltty https://github.com/mintty/wsltty (even though I'm a Microsoft employee, I strongly dislike the "feel" of the standard console and the way it handles both fonts and copy/paste, so I seldom use it at all) I also tried various hacks to do raise on hover and suchlike, but I found that some things were best left "native" and get along OK with these bare mouseless window management hotkeys. Incidentally, tmux has a growing following among my colleagues (there are a lot of Microsoft folk getting to grips with Bash and SSH these days, so when I tried to pass on some best practices, tmux was right at the top of the list)
- dllthomas 10y agoI use screen rather than tmux but the principal is the same. I have set things up so that I maintain separate screen sessions per context, including separate shell histories (the single biggest win, by far), separate shell defaults, aliases, etc.
- ams6110 10y agoI use a tiling window manager, and mainly use tmux to maintain ssh connections to other servers that I can connect to remotely. So my main "jumphost" machine has a tmux session with multiple "tabs" logged in to other systems I manage. I can connect to this tmux session from my work desktop machine, from my laptop, or from home (via VPN). Makes it very easy to stop, go somewhere else, and pick up with everything the way I left it. I also don't worry about dropped remote ssh connections anymore (not uncommon at home because I often have to reset my cheap wireless router). I don't do anything really advanced with tmux. One thing I'd like to know is a good way to deal with tmux within tmux, I have occasionally stumbled into that situation and then it's hard to get the "inner" tmux to do anything because the "outer" tmux intercepts all the key commands.
- GrinningFool 10y agoI use awesome wm, tmux and vim. awesome gets the job done. I don't see differences enough in the others to make me go through the trouble of switching. I'm not super fond of the default keybindings but I know the ones I need - easy to re-bind but not worth it. I use mostly the stock awesomewm taskbar/dock setup. I tried doing custom stuff there and it was doable ... but the "reload my wm and see if it fails to start even though syntax check passed" got old, and I gave up. I'll usually have my desktop split two thirds terminal, with the remaining third split between browser[1] and slack. (Or all terminal, with the other stuff on additional monitor(s)). I don't usually have enough windows open to use more than one 'tag' or desktop, but when I find myself wandering afield in my browsing, I tends to shunt offtopic stuff off to another tag. I use two tmux sessions , with one showing at any one time. I run them in Konsole - out of all the terminal emulators I've found, that's the one that can handle massive scroll rates without lagging. The first tmux session is named 'pairing' and is where I do my day-to-day work. Anyone on my team who sshs in will auto-connect to that session. For a while I had it prompting me for approval via an awesome popup but that broke with the ugprade to more recent versions and wasn't useful enough to fix. I now just have a notification that displays on connect/disconnect. Within each session, I have topical windows - usually per-project. A single vim and one or more shell panes. I have set up (neo)vim so that any time I "vi" in any pane of a tmux window, it opens in that window's vi session. A given window may have quite a number of shell panes depending on the environment. And for some testing cases, tmux's "synchronize-window" is invaluable. In vim, I prefer splits to tabs and end up using lots of both. I'm slowly learning to get comfortable with buffers and will see how that changes things. In the second named session ('private') I manage mail (mutt, but experimenting with more CLI-driven options like nmh), twitter (rainbowstream), irssi (via nested tmux on a cheap vps) and my project/notes/todo manager - which is another three-pane vim split, with shell functions that let me send stuff over there/read from there from anywhere. I rely heavily on small helper scripts and lately a growing number of custom macros on my keyboard. Some of the things I've read in the comments here have given me plenty more stuff to explore :) Heh. Now that I write it up, I see that it's apparently really complex - but it's evolved over time and suits my work really well. I'm still ironing out the info/todo management tooling but it looks promising. [1] If browsing text wasn't a horrible experience I'd do all of that in the shell too. Edit: If folks are remotely interested, I can write up a blog post and publish some of my hacks.
- trungaczne 10y agoI used to use i3 and tmux for a time. Advantage (of using tmux on top of i3): When you spin up a new window with i3, it doesn't retain the previous's current working directory. There are some hacks to make it kind of work, none of which work nicely. With tmux it just works. tmux has synchronized panes. It allows you to send same keystrokes to multiple terminals at once. This is useful for managing multiple host machines at once, i.e. ssh'ing into different machines at checking certain logs. Disadvantages: Double the amount of keybindings you need: one set for i3, one set for tmux. i3 allows you to active a mode where keystrokes are 'forwarded', so theoretically you can use the same keybindings for both, although it is very annoying if you forget to active this mode since you're now creating i3 windows instead of tmux panes and have to clean them up.