5 ms·
What does the author mean by "setting up copy/paste? I've been using vim for about 20 years and just do "+y and "+p
by aidenn0 6y ago
What does the author mean by "setting up copy/paste? I've been using vim for about 20 years and just do "+y and "+p
- markdog12 6y agoThey prob mean copies outside of Vim.
- cpow85 6y agoYes, I was specifically talking about copying things to and from vim, with/without tmux. Maybe its not a huge issue to all, but I always forget when I set things up on a linux machine vs. Mac OSX
- aidenn0 6y agogvim on mac/linux/windows will use the + register for the system clipboard. I'm pretty sure that a terminal vim with gui support compiled in will do the same (I know it does on Linux/X but haven't tested on mac or windows in a while).
- city41 6y agoThis is true, but often terminal vims don't have clipboard support. For example the vim that is bundled with Ubuntu does not. This can be especially confusing for people new to vim, or sometimes you jump onto a random machine and find that "+y does not work.
- aidenn0 6y agoI guess that's another thing to add to my list of "reasons Ubuntu is terrible" it's a minor complaint, but good to know. [edit] FWIW, "gvim -v" will probably give you clipboard support in a terminal on ubuntu, and ubuntu might have an "alternatives" tool to make the "vim" in your path have X support. "The Ubuntu packager compiled vim with the feature I want disabled" is a poor argument against vim; it would be like someone saying "I switched away from vim because I wanted to write plugins in Python" just because the packaged version of vim they use has python integration disabled.
- aidenn0 6y ago"+y yanks to the system clipboard. "+p pastes from the system clipboard.
- sullyj3 6y agoI've found it to be a colossal pain in the ass in WSL, since the emulated linux clipboard isn't synced with the windows clipboard. I have to :wq, cat the file, and ctrl-ins to copy.
- aidenn0 6y agoThat's not vim specific though, right? If you ran e.g. vscode inside WSL you would have the exact same problem?
- sullyj3 6y agoI'm not sure about the specific instance of vscode. Since it's a gui app, I don't think you can run it inside of wsl. You can use a plugin to connect to wsl, but I don't think that's quite the same thing, and I wouldn't expect it would allow clipboard sharing. The general point is right though. This is an issue with any terminal program that either doesn't allow selection of text, or has a system for selection of text that's separate to that of the terminal emulator.
- Congeec 6y agoI used a tool called lamonade that let you access the clipboard of Windows via a socket server. https://github.com/lemonade-command/lemonade https://github.com/lemonade-command/lemonade
- nickjj 6y agoIf you set up VcXsrv (an X-server) then your clipboard will be shared between WSL and Windows and Vim will work as long as you have +clipboard support in your copy of Vim without doing anything extra. I made a video tutorial around setting it up at: https://nickjanetakis.com/blog/getting-copy-paste-to-work-in-wsl-with-tmux-and-terminal-vim https://nickjanetakis.com/blog/getting-copy-paste-to-work-in...
- maple3142 6y agoI used this(https://www.github.com/maple3142/dotfiles/tree/master/.vimrc https://www.github.com/maple3142/dotfiles/tree/master/.vimrc) to let you yank directly into Windows's clipboard. It was copied from a stackoverflow answer, but I don't remember where is it.
- criddell 6y agoDo you have "+y and "+p configured to use the system clipboard? Does that work for you even when running vim over ssh?
- aidenn0 6y ago1. I don't have them "configured" that's how it works out of the box. 2. Why would I run vim over ssh when I can use netrw with a local vim?
- criddell 6y agoI've never been able to get netrw to work when mixing Windows and Linux machines and that's the environment I work in. Plus, I usually need to do more than just edit some file and so I rely on screen.
- aidenn0 6y agoI just fired up a windows VM; using the msys distribution that comes with Git for windows, the scp protocol "Worked for Me" but sftp did not.
- aidenn0 6y agoAs an aside, I just tested it and "+y and "+p work fine with vim over ssh if you enable X11 forwarding. Apparently you may need to use "gvim -v" rather than "vim" on Ubuntu though.