Couldn't find the simple solution on SO, so thought I would add this here for anyone looking in the future.
My symptom was that I could copy and paste within the IJ editor, but not from the editor to another application or from another app to the editor.
This was on Windows 10 with IntelliJ IDEA 14.1.6.
I have found the best solution yet (for me in any case). I have tried everything! Including adding and removing Keymap options. And this is actually where the problem lies...sort of.
When you have the Vim plugin installed, Ctrl + c and Ctrl + v is allocated to Vim.
To change that, go to Setting>>Other Settings>>Vim Emulation and set the Handler to IDE. Apply and OK, and Voila!
My solution (thanks to a similar issue reported with Android Studio) was to run IntelliJ as an admin.
Steps to always run IntelliJ in admin mode:
Right-click on IntelliJ icon in start menu search (or wherever you started it) -> Open file location
Right-click IntelliJ shortcut -> Open file location (yes, again to get to the .exe, not the shortcut.)
Right-click idea.exe -> Properties
Compatibility tab -> check Run this program as an Administrator
Right-click idea64.exe -> Properties (if you run IntelliJ in 64 bit mode)
Compatibility tab -> check Run this program as an Administrator
Same problem drove me completely insane but this
https://www.quora.com/Why-doesnt-Ctrl+V-and-Ctrl+C-work-in-IntelliJ-IDEA-14-0-2-on-Linux
worked for me:
You might try Ctrl+INS for copy and Shift+INS for paste and see if they work. They are the traditional cut and paste and have been around a lot longer than Ctrl+c/Ctrl+v.
i don't know why, but this worked!
To make copy/paste through shortcut keys working with Vim Plugin you need to change some settings of Intellij IDE's editor regarding vim emulation, you need to follow these steps for it:
Click Menu File > Settings... (or use shortcut Ctrl + Alt + S)
Select Editor -> Vim Emulation and find the shortcuts and change their Handler column value to IDE as shown in the screenshot below.
The Shortcuts will start working, happy coding :)
Another solution i've found
https://code.google.com/p/android/issues/detail?id=173201
was:
Try to minimize Idea window and move it on the same monitor where is the code that you want to copy and paste it. After this small minimize and move exercise the clipboard starts working.
Ctrl-Shft-V starts working after this for me!!!!!
Try to enable "Use national layouts". Settings- Keymap.
For some reason it worked for me.
PyCharm - Setting>>Vim Emulation Set - Control + V/P/A to IDE
Related
I'm using IntelliJ IDEA on my Mac to work on a project, and I keep on coming across an issue where I can't type. Occasionally when I switch to another application and then switch back to IntelliJ I can't type anything, and the cursor doesn't appear on text when I click on things. Does anyone know what causes this? After 1-2 minutes it goes back to normal, but it's started happening more frequently and it's pretty frustrating to not be able to type and have no way to fix it.
This is the version of IntelliJ I'm using:
IntelliJ IDEA 2016.1.3
Build #IC-145.1617, built on June 3, 2016
JRE: 1.8.0_76-release-b198 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Turn off Vim Emulator from Tools in the IntelliJ, like this picture:
I am encountering this issue aswell, ...
MAC os Mojave 10.14.2, Inteliij Community 2018.3.5
Aside from restarting / clearing caches, I found that cmd + leftShift + F still opens the search window, and all my keystrokes appeared in the searchbox!
After the searchshortcut, I was able to close the searchbox and work again!
The answer here helped me https://intellij-support.jetbrains.com/hc/en-us/community/posts/206152119-Can-t-type-in-editor-window
Quoting the author of the answer:
I had the same problem. It goes away after I click the icon at top of
the scroll bar. it happens frequently on windows 7/10, and
occasionally on mac. my colleagues said they have experienced it too
Have the same issue occasionally, can't type in any Intellij windows. My temporary/quick fix, is to:
Close any terminal windows in intellij
Use cmd+shift+f to pull up the search window.
Seems to fix it, for a while.
Closed IDEA, all IDEA projects! Even though in other IDEA windows I could type.
Removed .idea folder in the project I could not edit.
Restarted IDEA.
Then I was able to type!
Maybe you entered Vim emulator as said. Maybe only by mistake :).
Control-V is a frequently used shortcut. And Control-Alt_V is the shortcut to enable Vim mode so you can see the problem...
How to know in five seconds: type a ":" (colon) and if the cursor jump to end of the screen, that is vim. If so enter q to quit and then Control-Alt-V (on windows) to go back to IDEA standard mode.
vi is a powerful text editor since ever. But only if you pretend and know how to use it... There is even a warning on the IDEA install saying like "do not install unless you are familiar with Vim" in yellow bold text, iirc.
[Follows historic data, that you may find boring off-topic or interesting]
Today's editors opens the code in edit mode right away so you can start typing over existing code. Vim by the other hand opens the code in, let us say, browsing mode: there is a set of navigation keys to browse the code. Everything you type is supposed to be a command. When you want to edit you enter INSERT mode and then you can type new text. Only then.
Just for more historic data: vi navigation mode is great for studying code you do not know, using IDEA, since it does not change the text unless you tell it to, and some vi commands are clever.
One example:
"/" (forward slash) is one search command, and "z" is a smart scroll command so that:
/setCellFactory will search for the next match of "setCellFactory" and put the cursor there
Then if you type "z" the code will be positioned so that line is the first on screen. And if you type "." the line will be at the middle. And if you type "-" that line will be at the last position at the screen. And you can use these commands again and again. And new slash will go for the next match, like F3
This "z" thing is a feature I miss in Visual Studio, IDEA, Eclipse, Word, WordPad: these commands to scroll text AROUND a pattern... /pattern, z, z., z-. The alternative is the mouse wheel...
I am used to vi since the 80's and is the editor I still use today on Linux terminals so when this happened to me on IDEA I was lucky to remember and suspect of that on the first time.
Sorry if these details are boring
Ensure you haven't unintentionally enabled vim emulation. Go to IntelliJ Idea -> Preferences and select Plugins. Scroll down and look for the vim emulation plugin and if it's checked, then either uncheck it or uninstall it completely.
Ran into same issue with intelliJ 2017.1.2, but no VIM Plugin. However, I had just created an empty project with some .groovy files. I could edit the files in the groovy project, but not java projects.
Only way I could fix java projects, was blow-away workspace.xml files in each, then I could edit again. However, had to re-create tomcat configs, breakpoints, other IDE settings. etc.
I had a problem with entering characters when working with .story files. When I tried to type in any character, it appeared for a short while and immediately disappeared. The cause of the problem was jbehave plugin I was using. After uninstalling it and restarting IntelliJ everything was fine.
It seems to be because another window has the cursor and is not giving it back.
Check any open floated windows, click on them & then click back to your intellij instance
alternatively, if you have multiple intellij instances open the cursor could be there...
Go to the most recently opened IntelliJ instance
Check if the cursor has become stuck in that project's terminal window, or another window
no? check all other open IntelliJ instances
For me it happened because of vim
Om Mac, I solved it by navigating to File → Reload All from Disk.
Keyboard shortcut: ⌥ ⌘ Y
IntelliJ IDEA 2020.1.4
Try disabling plugins one at a time. It was the "BashSupport Pro" plugin that caused it for me. Disabled it and I could type again right away.
I read other comments saying some other plugins caused the issue as well.
I have recently started using Intellij and I noticed that by default, when you do ctrl+c for copying something when you have nothing selected, it copies the entire line into the clipboard overriding what I had in there before.
This is really annoying yet I cannot seem to figure out how to disable it. I am aware that there is a paste history you can use however this is not what I am after, I just want to disable it like you can do with sublime text.
Is there a way to disable this behaviour so that when I press ctrl+c and nothing is selected it just leaves the clipboard alone?
Since version 2021.2 there is a dedicated Don't copy/cut the current line when invoking the Copy or Cut action with no selection setting for this in Preferences | Advanced Settings on the Mac, Settings | Advanced Settings on other platforms.
For older IntelliJ Platform based IDE's the setting is more hidden:
Invoke Help | Find Action... (Ctrl (Cmd on Mac)+Shift+A), type Registry and select the Registry... item that appears. Enable the editor.skip.copy.and.cut.for.empty.selection option there. Be careful with the other configuration options, because it is possible to break your IntelliJ IDEA installation with an incorrect setting.
In Mac OS X:
Press cmd+shift+a.
Type registry and press return to
open the Registry.
Enable the editor.skip.copy.and.cut.for.empty.selection option.
Click Close.
I suppose it should be same as in WebStorm, or someone might be searching WebStorm solution as I did:
Open the settings: File > Settings > Advanced Settings (bottom of the list).
Start typing "editor".
Check the editor.skip.copy.and.cut.for.empty.selection
Click "OK" or "Apply"
On: WebStorm 2022.3.1
in PHPStorm -> From the Help menu, select Edit Custom Properties.
and paste
editor.skip.copy.and.cut.for.empty.selection = true
Up until version 10, intellij enabled searching text in the console window. From version 11 this option is not available anymore.
Is there any configuration to enable that? A plugin maybe? This is very useful for me and I miss this function...
-- EDIT --
I'm using the community edition of Intellij
Override the keymap for Ctrl+F to "Find" which was mapped to some other find.
To be more specific, in Settings - Keymap go to Main Menu - Edit - Find - Find... and make sure that a Shortcut is assigned here.
Press Ctrl+F in the console:
Check you key map settings. Like in my case - I have eclipse key mapping and there is CTRL+F set to "edit\Replace" not to "edit\Find", and the "edit\Find" has no key binding at all, that's why it is not working in console.
Go to File -> Settings -> Keymap -> Main menu -> Edit -> Find -> Find... (right click on it) -> add keyboard shortcut.
It's not set by default so you have to set it manually.
CTRL+F is by default for Replace that is not supported in console for IntelliJ.
Click on console and Use CTRL+K it is used for find in intelliJ
I was encountering the same issue while I was using vim in IntelliJ 2018.3.4.
After I disabled the Tools -> Vim Emulator, I could then search in Console using Ctrl+F.
Updated
In macOS, I just could use Command+F without disabling the emulator.
Perhaps that's why developers are using macOS more.
For those who have vim plug-in enabled.
Go to Editor->Vim Emulation and check keymaps. Make sure Ctrl + F is handled by IDE and not by Vim.
After setting that, I am able to search the console by Ctrl + F and keep vim enabled.
I'm using Eclipse key mapping in IntelliJ. The shortcut to search the console is Ctrl + Shift + G. By default it would search the word where the cursor is pointing.
My first day using this IDE...
is there a way to configure the IDE to open files in the project by double click? It is rather painful having to drag files from the project overview into the editor window.
You can change the KeyMap.
Go to File->Settings and find the keymap section.
You will have to create a new KeyMap by clicking copy, and then look in the View section for "Jump to Source" and change/add the keymap you want.
However, as Bozhidar Batsov noted, double clicking may not always work so well. Whether it works may vary by OS and/or windowing system. I have no trouble with it in Mac OS X, but it doesn't seem to work well in openSUSE.
There are also other predefined keymaps that you can select from this settings screen. They're set up to resemble other IDEs, so you might find them helpful if you're transitioning from something else.
It is easy way to do in windows.
I found a great solution to this problem by Jelmer Kuperus over at Orange11.
Create an .Xresources file in your home directory. Add the following line:
*multiClickTime: 400
Jelmer explains that this setting changes the default double-click speed from 200ms to 400ms, effectively slowing it down. Save the file and then run:
xrdb ~/.Xresources
The effect is immediate, no need to logout or reboot. Double-click in Intellij works as expected. I did try changing the mouse double-click speed in System Settings first before trying this out to see if that made a difference but it did not.
I am using Ubuntu 11.04, Intellij 10.5.2, and Sun JDK 1.6.0_26. YMMV
Use F4 to open quickly the selected files. Btw double clicking on files should work as well(at least in theory). Swing's buggy handling of such events, however, causes the double click to not always work in IDEA, so I eventually stopped double clicking and switched to using F4. You can also use "Autoscroll to source" from the projects menu - this will open the source files as soon as you select them in the project browser.
I remember seeing in either IntelliJ or Eclipse the setting to reformat (cleanup) files whenever they are saved. How do I find it (didn't find it in the settings)
This solution worked better for me:
Make a macro (I used Organize Imports, Format Code, Save All)
Assign it a keystroke (I overrode Ctrl+S)
Note: You will have to check the box "Do not show this message again" the first time for the organized imports, but it works as expected after that.
Step-by-step for IntelliJ 10.0:
Code -> "Optimize Imports...", if a dialogue box appears, check the box that says "Do not show this message again.", then click "Run".
Tools -> "Start Macro Recording"
Code -> "Optimize Imports..."
Code -> "Reformat Code..."
File -> "Save all"
Tools -> "Stop Macro Recording"
Name the macro (something like "formatted save")
In File -> Settings -> Keymap, select your macro located at "Main Menu -> Tools -> "formatted save"
Click "Add Keyboard Shortcut", then perform the keystroke you want. If you choose Ctrl+S like me, it will ask you what to do with the previous Ctrl+S shortcut. Remove it. You can always reassign it later if you want.
Enjoy!
For IntelliJ 11, replace
step 2. with: Edit -> Macros -> "Start Macro Recording"
step 6. with: Edit -> Macros -> "Stop Macro Recording"
Everything else remains the same.
IntelliJ 12
8. The Preferences contain the Keymap settings. Use the input field to filter the content, as shown in the screenshot.
I suggest the save actions plugin. It also supports optimize imports and rearrange code.
Works well in combination with the eclipse formatter plugin.
Search and activate the plugin:
Configure it:
Edit: it seems like it the recent version of Intellij the save action plugin is triggered by the automatic Intellij save. This can be quite annoying when it hits while still editing.
This github issue of the plugin gives a hint to some possible solutions:
https://github.com/dubreuia/intellij-plugin-save-actions/issues/63
I actually tried to assign reformat to Ctrl+S and it worked fine - saving is done automatically now.
Below is Neil's answer updated.
IntelliJ 13 Steps:
Code -> Reformat Code
Edit -> Macros -> Start Macro Recording
Code -> Reformat Code
File -> Save all
Edit -> Macros -> Stop Macro Recording
Name the macro (something like "formatted save")
File -> Settings -> Keymap
Right click on the macro. Add Keyboard Shortcut. Set the keyboard shortcut to Control + S.
IntelliJ will inform you of a hotkey conflict. Select "remove" to remove other assignments.
I set it to automatically clean up on check-in, which is usually good enough for me. If something is too ugly, I'll just hit the shortcut (Ctrl-Alt-L, Return). And I see they have an option for auto-formatting pasted code, although I've never used that.
If you have InteliJ Idea Community 2018.2 and above the steps are as fallows:
In the top menu you click: Edit > Macros > Start Macro Recordings
(you'll see a window lower right corner of your screen confirming
that macros are being recorded)
In the top menu you click: Code >
Reformat Code (you'll see the option being selected in the lower
right corner)
In the top menu you click: Code > Optimize Imports
(you'll see the option being selected in the lower right corner)
In the top menu you click: File > Save All
In the top menu you click: Edit > Macros > Stop Macro Recording
You name the macro: "Format Code, Organize Imports, Save"
In the top menu you clock: File > Settings. In the settings windows you click Keymap
In the search box on the right you search "save". You'll find Save All (Ctrl+S). Right click on it and select "Remove Ctrl+S"
Remove your search text from the box, press on the Collapse All button (Second button from the top left)
Go to macros, press on the arrow to expand your macros, find your saved macro and right click on it. Select Add Keyboard Shortcut, and press Ctrl+S and okay.
Restart your IDE and try it.
I know what you're going to say, the guys before me wrote the same thing. But I got confused using the steps above this post, and I wanted to write a dumb down version for people who have the latest version of the IDE.
Ctrl + Alt + L is format file (includes the two below)
Ctrl + Alt + O is optimize imports
Ctrl + Alt + I will fix indentation on a particular line
I usually run Ctrl + Alt + L a few times before committing my work. I'd rather it do the cleanup/reformatting at my command instead of automatically.
Rejoice! In IDEA 2021.2 there is finally "File->Settings->Tools->Actions on Save" where you can select "Reformat code", "Optimize imports", "Rearrange code", "Run code cleanup", "Run eslint --fix" etc.
If you're developing in Flutter, there's a new experimental option as of 5/1/2018 that allows you to format code on save.
I wound up rebinding the Reformat code... action to Ctrl-S, replacing the default binding for Save All.
It may sound crazy at first, but IntelliJ seems to save on virtually every action: running tests, building the project, even when closing an editor tab. I have a habit of hitting Ctrl-S pretty often, so this actually works quite well for me. It's certainly easier to type than the default bind for reformatting.
IntellIJ 14 && 15: When you are checking in code in Commit changes dialog, tick the Reformat code checkbox, then IntelliJ will reformatting all the code that you are checking in.
Source: www.udemy.com/intellij-idea-secrets-double-your-coding-speed-in-2-hours
For PyCharm/IntelliJ IDEA:
Install black.
$ pip install black
Locate your black installation folder.
On macOS / Linux / BSD:
$ which black
/usr/local/bin/black # possible location
On Windows:
$ where black
%LocalAppData%\Programs\Python\Python36-32\Scripts\black.exe # possible location
Note that if you are using a virtual environment detected by PyCharm, this is an unneeded step. In this case the path to black is $PyInterpreterDirectory$/black.
Open External tools in PyCharm/IntelliJ IDEA
On macOS: PyCharm -> Preferences -> Tools -> External Tools
On Windows / Linux / BSD: File -> Settings -> Tools -> External Tools
Click the + icon to add a new external tool with the following values:
Name: Black
Description: Black is the uncompromising Python code formatter.
Program: <install_location_from_step_2>
Arguments: "$FilePath$"
Format the currently opened file by selecting Tools -> External Tools -> black.
Alternatively, you can set a keyboard shortcut by navigating to Preferences or Settings -> Keymap -> External Tools -> External Tools - Black.
Optionally, run Black on every file save:
Make sure you have the File Watchers plugin installed.
Go to Preferences or Settings -> Tools -> File Watchers and click + to add a new watcher:
Name: Black
File type: Python
Scope: Project Files
Program: <install_location_from_step_2>
Arguments: $FilePath$
Output paths to refresh: $FilePath$
Working directory: $ProjectFileDir$
Uncheck “Auto-save edited files to trigger the watcher” in Advanced Options
To format Python files with Black, I followed this guide, which also uses File Watcher:
https://black.readthedocs.io/en/stable/editor_integration.html
Since version 2020.1, you can activate Run on save for files directly in the Preferences of the Prettier plugin:
I thought there was something like that in IntelliJ, but I can't find it. The only clean-up that happens at save is that white space at the ends of lines is removed. I thought I had to specify that behavior at one point, but I don't see anything related at this point.
If it's about Prettier, just use a File Watcher :
references => Tools => File Watchers => click + to add a new watcher => Prettier
https://prettier.io/docs/en/webstorm.html#running-prettier-on-save-using-file-watcher