News for hackers. Stuff that matters.
Re:Tmux and Vim – better together by vxxzy on Thursday April 20, 2017 @08:25AM (#14155996)
I've shyed away from using tmux and Vim. For some reason, when I use tmux and Vim, if I 'copy' a snippet of text (using my mouse/cursor higlight -> right-click -> copy) it treats all of the empty space a actual "space" characters when I 'paste'. Why does it do this?
Re:Tmux and Vim – better together by jstimpfle on Thursday April 20, 2017 @08:56AM (#14156209)
Because when you are selecting, that usually means that you let the terminal select from the contents of the terminal buffer. And vim is out of the game. It may for example be that your vim draws actual spaces to fill each line for rendering on the terminal. What you describe doesn't happen for me on xterm+vim and neither on xterm+tmux+vim, but it may well happen on a another terminal or with different vim settings.

You can let vim catch the mouse clicks / drags and have it manage you X11 clipboard (start looking at vim help for :set mouse=...). Personally I prefer to not have vim mess with my mouse and X11.

I think it's better to just use vim's horizontal selection ("visual line", Shift+v) and use yank (y key) or filter it into an extern command like "xlip -i -selection clipboard" to copy the highlighted text into the clipboard.

Re:Tmux and Vim – better together by JeremyNT on Tuesday April 25, 2017 @09:46PM (#14199873)
You can also just yank directly to the system clipboard: "+y
Re:Tmux and Vim – better together by twooster on Thursday April 20, 2017 @08:52AM (#14156180)
I believe this is because vim manages drawing the entire screen, rather than depending on its terminal emulator to wrap lines, etc. This may be dependent upon configuration, and the setting `t_ut` (which is the background clearing color).

Anyway, using tmux for selection in vim is a bad idea. You can give vim mouse support by `set mouse=a`, which will prevent tmux from capturing selection and scrollback control if you like. Achieving parity between vim, system, and tmux clipboard (and for bonus points, across a network) is left as a "fun" exercise.

Re:Tmux and Vim – better together by erikb on Thursday April 20, 2017 @10:37AM (#14156994)
The outmost program must do the copy&paste. So if the outmost program is tmux, then use tmux copy&paste.

https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/

I'm just learning all of this, but since it's a suggestion from some smart people I bet, just like in vim, that you can do a lot more once you've overcome the first pain of using it correctly.

Re:Tmux and Vim – better together by yorwba on Thursday April 20, 2017 @08:43AM (#14156104)
Expecting terminal programs to interact sanely with mouse gestures is somewhat futile. If I need to paste something from a vim buffer into a graphical application, I use :'<,'>!xsel -bi to copy the text. If I were doing it more often, I would probably add a keybinding to streamline the process, and solve minor annoyances like having to undo to get the copied lines back. Maybe there is a good plugin for clipboard integration?
Re:Tmux and Vim – better together by palunon on Thursday April 20, 2017 @08:56AM (#14156206)
You could use "y (and/or "+y, depending on your X clipboard setup) to yank to your clipboard. Similarly, "p paste from it.
Re:Tmux and Vim – better together by sullyj3 on Thursday April 20, 2017 @12:27PM (#14158155)
I always forgot which of + and * works and end up having to try both. I think I looked up the difference once, but I didn't retain the information.
Re:Tmux and Vim – better together by yorwba on Thursday April 20, 2017 @09:03AM (#14156255)
HN garbled your "* y, but I understood anyway. Thanks!
Re:Tmux and Vim – better together by deanstag on Thursday April 20, 2017 @08:49AM (#14156157)
https://github.com/wincent/clipper is what i have been using for clipboard integration. It is useful for remote server clipboard syncing too.
Re:Tmux and Vim – better together by leephillips on Thursday April 20, 2017 @09:02AM (#14156245)
I don't know if this will solve your problem, but you can try

  set clipboard=unnamedplus
Then all yanking and deleting will put the yanked or deleted text in the X11 clipboard, from whence you can paste it in other applications, including terminals. For more information try

   help registers
I use this all the time, and find it essential (no mouse required).
Re:Tmux and Vim – better together by coldpie on Thursday April 20, 2017 @08:32AM (#14156045)
Because that's how you create a vertical split. Maybe it could choose not to do that when there is no pane to the right of the current pane. But maybe the heuristics on that are hard.
Re:Tmux and Vim – better together by jasonlotito on Thursday April 20, 2017 @09:18AM (#14156335)
I just tried this on my Mac with tmux, vim, and textedit (with a normal text file) and didn't run into this problem. This is with vim 7.4 and tmux 2.1.
Re:Tmux and Vim – better together by braveo on Thursday April 20, 2017 @08:45AM (#14156122)
Same, I don't use tmux with vim for exactly the reasons you gave.

Instead I use i3 to split screens, etc. much better imo.

Re:Tmux and Vim – better together by hultner on Thursday April 20, 2017 @09:34AM (#14156446)
Problem is attaching the session on a remote machine, this is the main reason I've gone back to mainly using tmux in fullscreen workspaces instead of relying on a tiling window manager.

Still often use tiling though to tile a browser with a terminal or two browsers.

Re:Tmux and Vim – better together by braveo on Thursday April 20, 2017 @12:35PM (#14158226)
I just maintain multiple SSH connections.
Re:Tmux and Vim – better together by kalmari on Thursday April 20, 2017 @09:02AM (#14156247)
exactly a tiling window manager. though i do use a multiplexer in tty if i need to work in that environment.