News for hackers. Stuff that matters.
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @09:26AM (#24998486)
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
Re:Switching from Vim to Intellij by sullyj3 on Thursday November 05, 2020 @09:43AM (#24998651)
I'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.
Re:Switching from Vim to Intellij by maple3142 on Thursday November 05, 2020 @11:46PM (#25004997)
I used this(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.
Re:Switching from Vim to Intellij by nickjj on Thursday November 05, 2020 @06:15PM (#25003164)
If 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...

Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @01:39PM (#25000702)
That's not vim specific though, right? If you ran e.g. vscode inside WSL you would have the exact same problem?
Re:Switching from Vim to Intellij by sullyj3 on Friday November 06, 2020 @12:35AM (#25005207)
I'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.

Re:Switching from Vim to Intellij by Congeec on Thursday November 05, 2020 @05:15PM (#25002668)
I used a tool called lamonade that let you access the clipboard of Windows via a socket server.

https://github.com/lemonade-command/lemonade

Re:Switching from Vim to Intellij by markdog12 on Thursday November 05, 2020 @09:27AM (#24998504)
They prob mean copies outside of Vim.
Re:Switching from Vim to Intellij by cpow85 on Thursday November 05, 2020 @09:35AM (#24998585)
Yes, 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
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @10:19AM (#24998959)
gvim 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).
Re:Switching from Vim to Intellij by city41 on Thursday November 05, 2020 @12:42PM (#25000199)
This 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.
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @01:31PM (#25000633)
I 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.

Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @10:08AM (#24998862)
"+y yanks to the system clipboard.

"+p pastes from the system clipboard.

Re:Switching from Vim to Intellij by criddell on Thursday November 05, 2020 @09:45AM (#24998662)
Do you have "+y and "+p configured to use the system clipboard? Does that work for you even when running vim over ssh?
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @02:24PM (#25001095)
As 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.
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @10:09AM (#24998866)
1. 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?

Re:Switching from Vim to Intellij by criddell on Thursday November 05, 2020 @11:11AM (#24999408)
I'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.
Re:Switching from Vim to Intellij by aidenn0 on Thursday November 05, 2020 @04:06PM (#25001981)
I 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.