5 ms·
For those who are just getting started with tmux: I advise looking around others' .tmux.conf files for some sensible settings. Like Vim, Tmux ships with a lot o
by jbnicolai 11y ago
For those who are just getting started with tmux: I advise looking around others' .tmux.conf files for some sensible settings. Like Vim, Tmux ships with a lot of powerful features disabled by default.
My absolute favorite has to be binding a hotkey to opening URLs in the current window [0]. See [1] for a small demo I just recorded.
To get started, here's my current config: [1]
[0]: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L129 https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L12...
[1]: http://recordit.co/vdxy09GpYG http://recordit.co/vdxy09GpYG
[2]: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf https://github.com/jbnicolai/tmux/blob/master/.tmux.conf
- Jaepa 11y agoYou use ctl+s as your bind?
- jbnicolai 11y agoI do. It's closer to the prefix/leader I was used to when using screen (<C-a>), and I find it easier to type.
- JoshTriplett 11y agoWhy not use C-a?
- GrandTheftR 11y agoI assume ctrl-s is easier to press than ctrl-a, I have trouble with ctrl-a on Mac with reconfigured CapsLock, and my bind key is ctrl-space.
- Lio 11y agoThat's why I remap the right alt key on mac (laptops) to ctrl. Having left right balanced ctrl keys is much more important for my workflow.
- St-Clock 11y agoI also use C-s on my local machine because: 1. I can still use C-a with readline (go to first character) 2. If I ssh and then use screen, I can use C-a to navigate my remote screen and C-s to navigate my local tmux. 3. C-s is closer to C-a then other letters on my keyboard.
- e3b0c 11y agoC-a still works with readline. You just need to C-a first to 'escape' tmux and then C-a again. Actually just hold ctrl and hit 'a' twice. C-s will suspend the terminal on some platforms. (Which can be resumed by C-q.)
- jbnicolai 11y agoFor a while I ran a setup where I did all of my work in a local tmux session, but part of this work involved SSH-ing and attaching to a screen session. When using both, especially nested, I found it beneficial to have a different leader for each. I also use <^-a> to go to the start of the line, so I'd miss that.
- eddiezane 11y agoI use `bind a send-prefix` and do a `<^-a> a` to make up for the bind :)
- maw 11y agoBecause C-a already does something useful.
- aclissold 11y agoAhhhh. Maybe I'll switch from <C-a> to <C-s>, I still miss using <C-a> in Vim to increment integers!
- jbnicolai 11y agoExactly! And don't forget about <C-a> to move your cursor to the start-of-line in your terminal.
- jkyle 11y agoI use ctrl+s on my local config and I use ctrl+a on my remote tmux.conf's. That way I can attach to a remote tmux in a local session and not produce a terminal muxing singularity that swallows worlds.
- thedaemon 11y agoI made the mistake of having the same hotkey once. I can verify the existence of said singularity.
- rylee 11y agoConsider using <C-Space>. I recently switched and it's made a world of difference to my speed.
- ghshephard 11y agoCtl+s is particularly nice if you've remapped CapsLock to Ctl.
- smw 11y agoUsing ` as my bind (no modifier) has been the best thing that's ever happened to my productivity in tmux.
- jwhitlark 11y agoI do the same, and also set up many ` commands to work the same way in emacs.
- msutherl 11y agoFWIW, I spent some time deciding what to use years ago and decided on <C-j>. No complaints, and <C-s> feels awkward to me trying it now.
- amjith 11y agoZoom/Unzoom is now part of default tmux. <bind>z So you can remove this line from your config: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L98 https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L98
- jbnicolai 11y agoYou're absolutely right, thank you!
- lysis 11y agoWhy do you create a new window to maximize a pane [1] instead of using resize-pane -Z (mapped to bind-key z by default)? [1]: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L96 https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L96
- jbnicolai 11y agoBecause <Leader-Z> didn't exist in the latest version of tmux at the time. I've removed it now though, thanks!
- olalonde 11y agoHere's mine: https://github.com/olalonde/dotfiles/blob/master/tmux.conf https://github.com/olalonde/dotfiles/blob/master/tmux.conf One tweak I can't live without is having the same key bindings to seamlessly switch between tmux panes and Vim split windows. (https://gist.github.com/mislav/5189704 https://gist.github.com/mislav/5189704) TPM is also really useful for managing tmux plugins https://github.com/tmux-plugins/tpm https://github.com/tmux-plugins/tpm. My prefix key is Ctrl-Space. It's very convenient to press on the keyboard, I'm surprised to not see it used more widely (maybe because it's commonly bound to some OS utilities?).
- jbnicolai 11y agoI use <C-s> myself, but <C-Space> works just as well I suppose. Not bound to any OS utilities on OS X afaict. Thank you so much for pointing me towards that vim+tmux gist!
- danieloaks 11y agoI use <C-s> for my local machine, and I make the servers I login to use <C-a>. I bind the caps-lock key to ctrl, so it works out pretty well, and lets me work with both local and remote contexts at the same time fairly nicely.
- saidajigumi 11y ago> One tweak I can't live without is having the same key bindings to seamlessly switch between tmux panes and Vim split windows. YES, THIS! Setting up directional pane navigation to work with both tmux and vim panes as first-class entities was a huge workflow boon for me as well. It was a significant change that helped kick my setup over into vim+tmux+zsh as IDE vs. merely a collection of separate parts. It's worth noting that some relevant bits of @mislav's stuff has been packaged up nicely as a Vim plugin: https://github.com/christoomey/vim-tmux-navigator https://github.com/christoomey/vim-tmux-navigator I also just noted that @tarruda (of neovim fame) chimed in on @mislav's gist with his own independently created version of the Vim-side of things. It looks worth comparing some of the implementation details from @tarruda's work, he's done some stuff to eliminate redraws in Vim, etc.
- victorquinn 11y agoI wrote a book titled "Getting started with tmux" which can be a helpful guide for those who may want to get started. http://gettingstartedwithtmux.com http://gettingstartedwithtmux.com (Sorry if the self plug is not cool, I'm happy to delete this comment if it's not ok but I figure the community may get use out of my work)
- hans_mueller 11y ago90% of HackerNews is self plug ... so don't worry :)
- fsloth 11y agoThanks! It was most helpfull when I got to know tmux.
- kbenson 11y agoAs long as the comment is useful and contributes, I think it's fair game. This definitely qualifies. That said, if it's not free, I personally would prefer that be mentioned, (and at the same time a link to a free sample chapter or equivalent if it exists would be useful).
- jwhitlark 11y agoIt was quite a good book! It might be due for an update, what with tmux plugins and other new tools. I'd buy an updated version.
- digitalzombie 11y ago> Like Vim, Tmux ships with a lot of powerful features disabled by default. lol, my tmux keys are basically model after vim. This is the book I used to learn tmux and has vim key settings: https://pragprog.com/book/bhtmux/tmux https://pragprog.com/book/bhtmux/tmux
- bphogan 11y agoThanks for reading.
- dezgeg 11y ago> My absolute favorite has to be binding a hotkey to opening URLs in the current window. I suppose this stops working if you SSH into some box and run tmux there? I've implemented something similar, but as an urxvt plugin instead, which avoids that limitation: http://www.cs.helsinki.fi/u/tmtynkky/urxvt.png http://www.cs.helsinki.fi/u/tmtynkky/urxvt.png (Once Alt-O is pressed, the hotkeys with the red background appear next to each link; pressing the hotkey opens the link in browser and copying to clipboard is also possible)
- jbnicolai 11y agoYou're absolutely correct, although I do all my terminal work locally in tmux as well (and often nest any remote work in a secondary remote session). Liking the plugin you wrote!
- klinquist 11y agoLove your shell prompt. Mind posting your .zshrc/.bashrc?
- klinquist 11y agoNevermind, looks like you are using powerline, found it, got it. :)
- klinquist 11y agoLove your shell prompt. Mind posting your .zshrc/.bashrc?