5 ms·
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
by vxxzy 10y ago
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?
- coldpie 10y agoBecause 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.
- yorwba 10y agoExpecting 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?
- deanstag 10y agohttps://github.com/wincent/clipper https://github.com/wincent/clipper is what i have been using for clipboard integration. It is useful for remote server clipboard syncing too.
- palunon 10y agoYou could use "y (and/or "+y, depending on your X clipboard setup) to yank to your clipboard. Similarly, "p paste from it.
- braveo 10y agoSame, I don't use tmux with vim for exactly the reasons you gave. Instead I use i3 to split screens, etc. much better imo.
- kalmari 10y agoexactly a tiling window manager. though i do use a multiplexer in tty if i need to work in that environment.
- hultner 10y agoProblem 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.
- braveo 10y agoI just maintain multiple SSH connections.
- twooster 10y agoI 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.
- jstimpfle 10y agoBecause 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.
- JeremyNT 10y agoYou can also just yank directly to the system clipboard: "+y
- leephillips 10y agoI 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).
- jasonlotito 10y agoI 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.
- erikb 10y agoThe 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/ 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.