Cannot paste into Intellij Idea from Vim - clipboard

After yanking a text from Vim I cannot paste the clipboard content into Idea's editor window. I can, however, paste it in every other window (browser, terminal etc.).
The text becomes "pastable" (strangely) after I run command in a terminal:
xclip -sel c -o | xclip -sel c
or paste a line somewhere and copy it manually (Ctrl-C or mouse).
I have set options
set clipboard+=unnamed, unnamedplus
in both Idea (ideavim) and vim.
My system is Fedora 25. This problem manifested itself after I changed distribution, so maybe Wayland has something to do with it.

Just want to share my situation. I've installed both xclip and xsel for neovim. It turns out that the contents piped to xsel was not recognized by intellij.
I uninstalled xsel and it works fine.

Related

Copy from Ubuntu 20.04 Vim and paste to another application

Problem definition
My goal is copy code from vim and paste to browser.
It doesn't work as expected "+y and "*y command.
I have tried each two commands and tried ctrl + v to another application, but nothing happened.
I don't know what's problem.
What I tried
I've already seen these.
How to make vim paste from (and copy to) system's clipboard?
How can I copy text to the system clipboard from Vim?
Not only these but also lots of another Q&As.
I have tried these but still doesn't work.
My environment
I'm using Windows 10.
And on windows, I installed Ubuntu 20.04 and using VIM.
Result of vim --version | grep 'clip' is here.
+clipboard
As you see, clipboard and xterm_clipboard option is enabled.
And as said another Q&A of links, I append set clipboard=unnamedplus into my vimrc file.
But the result did not change.
As I understand you want to copy from vim in WSL to Windows. Unfortunately WSL and Windows have different clipboards, but this is solvable. For example in order to copy file contents from WSL to Windows clipboard, you need to pipe file contents to clip.exe:
cat myfile | clip.exe
So in vim we can:
yank your selection
Drop to command line and type :! echo
Paste the selection with Ctrl + r "
Continue typing in the command line: | clip.exe
hit Enter and profit!
Probably it would be useful to write some autocmd for this in vimrc.

Can't figure out how to copy between VIM terminals on OS X

I know I need to copy into the " or * registers or something like that
Let's say I have one c program in one terminal running vim and another program in another terminal...
How do I copy a line between them?
Visually select the line you want to copy with V.
Hit "*y to yank the line into the * (clipboard) register.
Open the other terminal and vim inside it.
Hit "*p to paste or press i and then paste the info in there (like you would normally copy paste).
If this does not work then you may need to run vim --version and see if your copy of vim is compiled with a +clipboard. If it says -clipboard then you will need to install a version of vim that was compiled with clipboard. Results may vary when ssh-ing into a server.

Copying all lines to clipboard from VIM in cygwin

Has anyone found a good way to copy all lines from VIM in cygwin?
I've tried yanking the lines but it doesn't go to windows clipboard. Any ideas?
This seems to be a solution but it is a lot of work for copy/paste:
http://vim.wikia.com/wiki/Using_the_Windows_clipboard_in_Cygwin_Vim
UPDATE:
this works:
echo 'put this on my windows clipboard' > /dev/clipboard
BUT doesn't work for me because I want to copy to clipboard while SSH'd into another machine. So echo'ing/cat'ing to /dev/clipboard will put it on the other machine's clipboard, not mine
There may be better ways, but here's how I do it:
Use visual mode to highlight lines to be copied to clipboard (From command mode, v, then navigate normally to highlight).
"+y
to copy to clipboard.
Since the question asks how to copy everything:
ggVG"+y
This is maybe not as easy as you wanted it to be, but here is how I usually do it myself:
:w
:!cat %
This will display your file, and you can copy it from there.

Cygwin terminal prompt missing

Previously, when launching the Cygwin terminal, a console will popup and the line will say:
username#PCName ~ then a blinking cursor after $.
Now a blank console appears and nothing is on the console screen but a blinking cursor...
The shortcut seem to be directing to the right path "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -" so I don't know what's going on.
How do I go about fixing this issue? Do I have to look into the Environment variables? If so what do I have to look for?
I'm running Windows XP Professional x86.
Try changing the shorcut to this:
C:\cygwin\bin\mintty /bin/env CHERE_INVOKING=1 /bin/bash -l
Since you say it starts up successfully using cmd, it could a problem starting up you mintty environment. Try going into your home directory and deleting (back it up somewhere else if you want to be able to bring it back) the .minttyrc file and then try to start up again.
If that doesn't do the trick, try to go a little bigger and do the same with the bash environment files. Back up .bashrc, .bash_profile, .bash_aliases (if you have it) and .inputrc and replace them with the default sample files that are in the /etc/skel folder, then try to restart again.

How do I copy and paste from bash to vim and vice-versa using only the keyboard?

Using this command:
http://www.hypexr.org/bash_tutorial.php#vi
I'm able to use vim commands in the bash. But, what I'd like to do is copy and paste from that (bash) into vim and vice-versa.
I know there are other posts on here using the middle mouse button, but I use putty to connect to linux boxes, and the middle mouse performs a selection, just like the left click drag.
I'm not looking for something that will modify my windows clipboard. Selecting in vim is useful for transfering stuff to and from windows, but I'd like a solution that will work both through putty and using a direct terminal.
Thanks in advance...
I use the copy&paste feature in screen. ctrl-[ to enter copy mode and ctrl-] to paste. There are different buffers and the ability to dump to a file. It's pretty powerful. The default is to copy lines, but you can curtail by columns join display lines into a single copied line (and other options). And since you would likely already be in screen when you run vim, you would have the paste buffer available. I also have hooks to copy the buffer to/from the X clipboard.
I don't know if that can help you, but I have installed a utility called xclip, which shares the X11 clipboard with VIM. I mainly use it to copy and paste between instances of VIM running in different terminal windows.
I typically use xclip with the following mappings, which keep a very similar behaviour to the usual yank and paste commands, but using the clipboard:
nmap `yy :.w !xclip<CR><CR>
vmap `y :w !xclip<CR><CR>
nmap `p :.r!xclip -o<CR>
nmap `P :.-r!xclip -o<CR>
Use the * (or + in X Windows) registers to reference the system clipboard. Anything yanked-to or pasted-from those registers can be used to cooperate with other applications:
Cut/Copy examples
"*yy : copy current line to the system clipbard
gg"*yG : copy current file to the system clipbard
"*dd : cut current line to the system clipbard
etc, etc
Paste examples
"*p : paste the system clipbard
Or in insert mode:
i Ctrl+r *
Or
i Ctrl+r Ctrl+p *
(the last one pastes withouth formatting, useful to avoid those ugly pastes from the OS clipboard where each indented line appears more and more shifted)
You can copy from/to the clipboard in both vim and bash using ctrl + ins for copy, and shift + ins for paste.

Resources