37

I can't copy and paste code in Intellij. I've been googling for a couple hours now. Every forum where there is a solution does not work.

Ctrl+X works. Ctrl+Z works. Ctrl+V does not work. Ctrl+C does not work.

I'm using the latest version of Intellij Idea (14.0.2), I'm running Linux lite - posted here because Linux lite is based off Ubuntu and it will be similar.

Here is what happens when I right click (I don't have enough rep to post images apparently): enter image description here

I looked in setting and found keymap then typed copy in the search bar and this is what came up: enter image description here

2
  • Click on the 'Edit' option and see if there come options like 'copy' and 'paste' or not.If there are 'copy' and 'paste' options,use them.See and report if they work or not. Jan 4, 2015 at 7:50
  • I had this problem when working in a different language. All I had to do was revert back to English. Sep 14, 2016 at 5:33

10 Answers 10

53

I had this problem and it was driving me absolutely insane.

If you want to keep using the vim plugin, and have ^c and ^v work for copy / paste like it does in other applications, then you need to go to your settings, and select Other Settings / Vim Emulation (as shown below).... Then make sure that both ^c and ^v are set to be handled by the IDE (not Vim!) and everything should work fine.

how-to-enable-ctl-v-and-ctv-c-for-copy-paste-in-idea

4
  • This was it for me, although was having trouble with Ctrl+B, I still prefer to keep Ctrl+V for visual mode. Feel silly now as the first time you use a shortcut it notifies you that the vim plugin is handling it. Jan 11, 2018 at 11:13
  • someone please make this the default behavior. almost switched to vs code because of this.
    – rouble
    Jan 20, 2019 at 23:43
  • CTRL-v still doesn't work when searching. ie. press / to search and then press CTRL-V. You get just a caret (^). Any ideas? Aug 20, 2019 at 15:51
  • In IntelliJ 2019.2.1 it is under Settings -> Editor
    – IcyBrk
    Sep 2, 2019 at 17:45
7
  1. You can disable vim from the tools menu (instead of uninstalling it)
  2. For those who actually use vim (which is awesome) - there is an issue with copying from the run console and other outputs (this is how I stumbled onto this question), ctrl-c doesn't work there. The issue is that vim is wrapping those panels too, so you can just highlight and press 'y' :)
1
  • 1
    vim is awesome, spread the word ;^) good tip on console.. that always puzzled me. Sep 14, 2015 at 20:32
6

From File -> Settings -> Plugins search for ideavim plugin. When found click on it. On the right panel you will see an Uninstall button. If you click it, you can uninstall the plugin without uninstalling all of IntelliJ IDEA.

1
  • saved my day. works perfect in windows environment too. When I installed IntilliJ I installed with all plugins. I got installed with the ideavim too. If we uninstall this plugin it works perfect. Aug 12, 2016 at 12:36
2

Either disable the ideavim plugin, or use the Vim shortcuts.

The Vim shortcuts are d, y, P/p in command mode to cut, copy and paste before/after the cursor. This clipboard is different than the clipboard in your OS. If you use Shift+Delete, Ctrl+Insert and Shift+Insert, the cut, copied or pasted content will be placed to the system's clipboard.

See http://vim.wikia.com/wiki/Copy,_cut_and_paste. (You can use movement command (like w) or the mouse to move the cursor around while selecting.)

1
  • Thanks! Why did I have so much trouble finding this very straight forward information?? Most answers seem to involve remapping the traditional keys or deleting the vim plugin.
    – mal
    Mar 6, 2019 at 8:25
2

You may try Ctrl+Insert as Ctrl+C could be in conflict with the Vim editor plugin

1

Go to Files>Settings>Keymap and change the keymap options(Upper Left hand corner) to Default for GENOME.. And Done.. Mine is working..

1

I tried many fixes online but the only thing that fixed my issues w/ copying and pasting(Especially in IntelliJ) was to install xdotool https://www.howtoinstall.co/en/ubuntu/xenial/xdotool

Especially if you have Keepass installed.

2
  • 2
    Please post instructions instead of links to instructions. Links can stop working in the future.
    – Delorean
    Mar 28, 2017 at 17:53
  • Wow, this really works
    – luboskrnac
    Apr 7, 2017 at 12:15
0

This helped me:

sudo add-apt-repository ppa:attente/java-non-latin-shortcuts
sudo apt-get update
sudo apt-get dist-upgrade
restart unity-settings-daemon

UPD: more info here https://gist.github.com/d3zorg/3f71ee24b1a0a288ce27

1
  • 1
    Welcome to Ask Ubuntu! ;-) Could you please edit your answer and explain why OP should install a PPA, what it does, how it works, ... ;-)
    – Fabby
    Oct 3, 2018 at 19:34
0

Go to Tools and unclick Vim Emulator and your problems should go away. It worked for me - community version 2018.3

0

If your settings Ctrl-c and Ctrl-v in the Vim emulator are handle by Vim you can simply custom your .ideavimrc to use these shortcuts. Here is a simple way to do it, paste this line in your .ideavimrc:

set clipboard+=unnamed

you can refresh the new settings in your IDE without the need to restart the IDE by using the command vim and the path of your .ideavimrc file :

:source ~/.ideavimrc 

This method is great, simple and will allow you to use all the editing shortcuts like y, Y, p, P, x to put your code in the clipboard and use it elsewhere on the computer

..

PS : Instead you can also create crazy customized macros for Ctrl-c, Crtl-v in insert, normal or visual mode using the clipboard register by using the quote key " associated with + or * depends and some key editing shortcuts like c,p,y like this :

inoremap <C-v> <Esc>"+Pa

So the behavior is fully customizable (but this is also crazyness)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .