7 ms·
Spent too much time wonking a tmux config only realizing it was never going to work how I liked. You can't have it all with the mouse no matter your settings, t
by asdff 7y ago
Spent too much time wonking a tmux config only realizing it was never going to work how I liked. You can't have it all with the mouse no matter your settings, there will always be a compromise. It also doesn't help that no one cites the version of tmux they wrote their configs for, nor that the configs are not backwards compatible with all versions of tmux for all settings.
It's really clunky, but I went from tmux to just opening new shell windows as needed. I need to be able to resize and scroll, selecting text and copy behavior should be exactly like mac os. Even used a tiling window manager with it for a bit, but it felt pretty restrictive so I went back to just using the cursor to move things around.
- enriquto 7y agoYes, the mouse situation in tmux is catastrophic. As much as I love tmux, I wonder what would it take that the program respects the usual copy-paste conventions like all the rest of X programs. You need to do two things, that are apparently impossible when tmux has "mouse enabled": 1. select some text in your xterm so that it gets copied 2. middle click on the xterm and your copied text (possibly from other window, web browser, whatever) gets pasted at the cursor position This is really simple and sane behavior but it's completely impossible to achieve with the current version of tmux. I have spend much more time that I am willing to admit seriously trying to do that.
- nmarriott 7y agoThis is little to do with tmux and much to do with the features offered to terminal applications by terminal emulators. Both clipboard and mouse support in terminals generally is quite limited. For the clipboard, this page documents how to configure it within the limits of what is possible: https://github.com/tmux/tmux/wiki/Clipboard https://github.com/tmux/tmux/wiki/Clipboard
- p1esk 7y agoThat's the main problem with tmux in my experience, whenever I open an issue or a feature request on tmux github, the devs say it's a terminal issue. I then open the same issue on the terminal github and the devs there say it's a tmux problem. Perhaps a solution could be combining a terminal and tmux into one product, so there would be no more excuses, however I don't think core devs are interested in getting a proper mouse support working in tmux.
- diggan 7y agoThe top reason I did start using tmux was because of how you can select text with the keyboard in copy mode (like visual in vim mode). Then I got the plugin tmux-plugins/tmux-yank which adds "y" command to copy the text. Also works with selection by mouse. I've run this setup now for something like 5 years across multiple tmux versions and OSes (Ubuntu and Arch) without any hiccups. But then I think tmux is a tool geared towards keyboard usage and not mouse. The mouse stuff was added because others wanted it, not because it was part of the core idea of what tmux wanted to provide. So if you go against that, you'll bang your head a little.
- enriquto 7y ago> The top reason I did start using tmux was because of how you can select text with the keyboard in copy mode (like visual in vim mode). Then I got the plugin tmux-plugins/tmux-yank which adds "y" command to copy the text. Also works with selection by mouse. Sure, but this is the internal "copy mode" of tmux, and is not useful to copy text in and out of your terminal.
- nmarriott 7y agoYou can configure tmux to synchronize with the X clipboard, although it is somewhat fiddly because of how terminal emulators work. See this page: https://github.com/tmux/tmux/wiki/Clipboard https://github.com/tmux/tmux/wiki/Clipboard In most terminal emulators you can also use Shift (or sometimes a different modifier) to bypass application mouse mode and have the terminal emulator handle the mouse event. Of course you can't copy out of the history with this, but that is another limitation of terminal emulators.
- enriquto 7y ago> that is another limitation of terminal emulators. This seems more an excuse than a cause. When the "mouse mode" of tmux is off, the copy-paste mechanism works perfectly. There is no reason why this couldn't still be the case when the mouse mode is on. For example, tmux could enable the mouse only for scrolling and resizing the panes, while keeping the correct copy paste behavior intact. But it chooses not to.
- tomphoolery 7y agoit works pretty well if you're in vi mode, because the same key commands are used in vim for visual mode. so you end up just getting used to scrolling that way.
- diffeomorphism 7y agoIt works just like that if you press shift?
- enriquto 7y ago> It works just like that if you press shift? My point exactly. I want to do that without pressing shift.
- tpei 7y agoThis also bothers me. As a keyboard guy it mostly bothered me that I could not jump to the thing that I wanted to copy. I found https://github.com/schasse/tmux-jump https://github.com/schasse/tmux-jump, which works really well with https://github.com/tmux-plugins/tmux-yank https://github.com/tmux-plugins/tmux-yank
- opan 7y agoWith my config a normal highlight interacts with tmux and if I hold shift it interacts with my terminal emulator. I'm using Termite, but I swear it worked the same in others like terminator and urxvt as well. I have both a local and remote tmux session and am basically exclusively using shells in tmux, so I've long since gotten used to in. This must be fairly standard, because a friend of mine uses Hexchat on Windows where a normal highlight can grab a line from IRC, but without the timestamp. Holding shift lets you grab all the actual text, timestamp included.
- echelon 7y ago> realizing it was never going to work how I liked. > You can't have it all with the mouse no matter your settings > so I went back to just using the cursor to move things around. These tools (vim, tmux, etc.) work great for mouseless setups. If you can get comfortable with a 100% keyboard control paradigm, it might work for you. I realize this might not be what you want, but if the statement "spend less time moving your hand between keyboard and mouse" resonates, it's worth revisiting.
- cozos 7y agoMy biggest problem with "mouseless tmux" was copy-paste. How do you deal with that?
- lpilot 7y agoI haven't got my config to hand, but essentially I've binded leader-y and leader-p to copy and paste respectively both using the system clipboard. Since doing that tmux has been so much more useful to me.
- kondu 7y agoI've always wanted something like that, can you please share your config?
- jonfw 7y agoThis is the section of my config that sets up using the clipboard for tmux buffers. It won't work as is unless you're using both fish shell and Mac, but this should at least give you some good keywords to google and find documentation on how to do it for your system #makes clipboard work set-option -g default-command "reattach-to-user-namespace -l fish" bind-key -T copy-mode-vi 'v' send -X begin-selection bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
- Tsiklon 7y ago
- vbezhenar 7y agoI'm using tmux on server and putty to connect and it works for me. I don't really configure anything, just `set-option -g mouse on`. Mouse scroll works (emulated by tmux, but good enough for me). To copy, I'm using shift+left click drag (standard Putty hotkey), to paste I'm using shift+insert.
- wincent 7y ago> You can't have it all with the mouse no matter your settings I don't think this is correct; it's just that it's not trivial to get things working well. As you say, it depends on using an up-to-date version of tmux (and sadly, you often can't run a config made for a new version with an older version of tmux). And you'll need your terminal to be up to the task (eg. iTerm2 on macOS; not sure what the best thing on Linux would be). This config shows some useful mouse settings, along with transparent integration with system clipboard via Clipper (even when running tmux on a remote host): https://github.com/wincent/wincent/blob/81e4b5dc180dd22d8b4764439a08d050e4d02e61/aspects/dotfiles/files/.tmux.conf https://github.com/wincent/wincent/blob/81e4b5dc180dd22d8b47... But like I said, getting it all working nicely requires a bit of work, especially if you want things to work uniformly across Vim, tmux and the shell. Once you've got it all working though, it's great. I can scroll with trackpad or mouse wheel inside and outside of Vim, click or drag to select text (and double-click to select words, triple-click to select lines) both inside and outside of Vim, I can drag tmux or Vim splits etc. Having sad that, I rarely need or want to take my hands off the keyboard when in the terminal nowadays.
- tambourine_man 7y agoI can really recommend the parent's YouTube channel for all sorts of Vim/Tmux nerdery: https://youtube.com/channel/UCXPHFM88IlFn68OmLwtPmZA https://youtube.com/channel/UCXPHFM88IlFn68OmLwtPmZA
- wasdfff 7y agoI couldnt figure out how to get the mouse behavior I liked working in the shell as well as in editors like less or nano. Id get the shell able to scroll and work well with selecting text, then Id have some archaic mouse behavior in my editors. Or I could have the editors working like they do outside of tmux, but then I lose the ability to scroll in the shell and whole tmux multipane window scrolls off screen instead. I could get into the keybinds, but I dont use vim so they are pretty ancient and foreign to me. The effort for me to learn these binds doesn't seem there compared to just moving my windows with the mouse once or twice a day.
- Skunkleton 7y ago> not sure what the best thing on Linux would be Recently I have been a big fan of tmux+Alacritty on linux.
- Aeolun 7y agoTmux on my local machine was useless. Tmux on my server has been a godsent. Just connect and re-attach to the tmux session and you are right where you left off. I did modify the key binds a little bit to make splitting windows and enable the mouse, but otherwise I just don’t need any more advanced behavior.
- ghshephard 7y agoI guess different work patterns work differently for different people. I've been using tmux exclusively on my local machine (much less often on remote machines) for the last 2+ years, and it really works well for me. On a daily basis I tend to work in a lot of different contexts, so having scroll-back buffer and bash history nicely organized so I can switch from task to task, with clean restoration of the scrollback/bash history for each environment when I reboot my computer to update it is a godsend. I also like having the various parallel running tasks for a particular environment (like an ssh, log tail, commands) - all running in different panes in a single window - so I never have to go looking for them. One change I made was forcing myself to always name a window when it gets created - that way I can usually hotkey back into an environment by its name, rather than having to go searching for windows. I particularly like that I can use exactly the same toolset on my Mac, Windows, and Linux clients.
- julienchastang 7y ago"Tmux on my server has been a godsent." Exactly. I let my cloud VM tmux sessions run for months. I manage other VMs and Docker containers from my tmux "command center".
- dllthomas 7y agoI use a terminal multiplexer (happens to be screen, but could as easily be tmux) to manage local contexts. A fresh terminal in the same context is then just three keys away. The contexts drive a number of things, but most importantly I set BASH_HISTFILE so each has its own history. I love it, but of course ymmv.
- michaelcampbell 7y agoFor me tmux isn't about new windows, it's about keeping a session open when my ssh connection dies, or my vpn resets which causes a connection to die, or any of 100 other things that can happen. Tmux keeps my stuff going while I'm not there, and I can come back to it.