How can I enable IdeaVim on only the main editor window? - intellij-idea

IdeaVim current replaces essentially all multi-line text inputs. For example, Git commit messages and the Clojure REPL both accept Vim commands. However, in those situations, I'd prefer to have a simple text input, without Vim's features.
Is there any way to enable IdeaVim only on the main editor window, and disable it on all other text inputs? If not, is there any way to disable it or configure it differently for different text inputs?
Thanks!

The following line will disable IdeaVim from dialogs
set ideavimsupport=

As of November 2020 (and IdeaVIM 0.61), this is fully possible by setting the following in your .ideavimrc file:
set dialogescape=off (disables IdeaVIM in all dialogs | defaults to legacy - the old behaviour)
set oneline=off (disables IdeaVIM only in single line boxes | defaults to on)

Currently it's not possible. Feel free to vote for VIM-765 and VIM-740.

Related

Disable vim mode in PhpStorm in debug

Is it possible to disable vim in certain windows/modes? For instance in debugger it's a bit annoying, also when editing cell values in Database mode it's not perfect.
Another question if a tab can switch to command mode when I'm about to navigate to another tab.
Thanks
It's currently not possible in IdeaVim 0.50. There is a feature request that partially covers what you're describing: VIM-765 Option to disable plugin in dialog boxes. Feel free to vote for this feature and/or file new requests at https://youtrack.jetbrains.com/issues/VIM.
You can remap <Tab> to gt using standard Vim mapping commands. Put them into your ~/.ideavimrc.

Disable copying entire line when nothing is selected in Intellij

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

Navigating between splits

I wanted to settup vim-tmux-navigation like navigation on intellij IDE and only way to settup this is from IdeaVim so my configuration in settings -> keymap looks like this:
VimWindowDown_____ alt J
VimWindowLeft______ alt L
VimWindowRight_____alt H
VimWindowUp_______ alt K
But when I split the windows it's not working.... Is this a bug or I'm missing some stuff?
Oh and don't suggest me switcher for my problem...
The best place for setting up custom keys for Vim actions is the ~/.ideavimrc file. You can use the standard Vim map/nmap/noremap/imap/... commands there. For example:
nmap <A-J> <C-W>j
For potential keymap conflicts between the Vim emulation and the IDE see Settings | Vim Emulation.
Chaning Vim actions via Settings | Keymap is not recommended.
OK, got a partial answer.
There is a "Go To Next Splitter" and "Go To Previous Splitter" commands in IntelliJ. So in the keymap settings, change or add keystrokes for those commands to C-h and C-l (or whatever you want). If you are using ideavim, don't forget to override those keymap settings so that C-h and C-l are set to use the IDE. C-h and C-l will probably already be used so be sure you don't need the existing hotkey before you make the change.
This solution will at least allow you to move left/right quickly. Not sure it's going to be possible to move between up/down splits without doing some scripting or if that's even possible to do with scripting.

Intellij ignores the selected keyboard layout

This seems like a bug in IntelliJ 12: Every couple of times when I switch between keyboard layouts (English and Hebrew) IntelliJ get stuck on one of them and ignore the windows selected keyboard layout. This happens only for intelliJ, all other programs respond as usual to the windows selected keyboard layout.
Is there at least a workaround, or a way to reset IntelliJ's keyboard layout? The only thing that seems to work for me so far is restarting my machine...
(My OS is Windows 7 Enterprise 64bit)
This is 100% reproduced when you switch keyboard layout in quick class search (Ctrl+N). Also in intellij idea 13.
Something like:
Open quick search menu when keyboard is not in English layout (Russian e.g.)
Type anything
Switch to English
Congratulations! you stuck in russian layout :) restart your intellij idea!
When I ceased to switch layout in search, I forgot about this problem.
UPD: it's suitable for most part of text inputs (even for search and file creation)
I've just had this problem on PyCharm 2020.2.3
Here's how I've solved it:
Go to Settings -> Keymap
At the bottom of the window, check the option Use national layouts for shortcuts (require restart)
That did the trick
restarting IntelliJ also works.
I wonder how they managed to get such a stupid bug, this is not an easy bug to write, especially in Java.
That was found to be more like a global Microsoft/Oracle bug. Simple workaround from IntelliJ's issue tracker: use Windows' language parameters to assign a hotkey (Ctrl + number) for changing the layout directly to a desired language. This suddenly will affect both Windows And IDEA. It's said that bug was fixed in Win8. A bit more info: here
In 2020 bug is still relevant in the most IDEs based on IntelliJ. For example I observe this in PyCharm now.
There is workaround for Windows:
Go to Language Bar - Settings... - Advanced Key Settings
Set key sequence of To English action to Ctrl + 1
Set key sequence of to other your language to Ctrl + 2
Apply
Go to IntelliJ/PyCharm and switch language by new sequences
After that bug disappears and you can switch language by traditional method
For me the following actions seem to resolve the issue:
Go to Control Panel
Select Clock, Language & Region
Press Region
In the opened window choose English for Format.
Also all my settings except the location are set to English (locale, default keyboard etc.)
This fix worked on my mac, access Preferences -> Editor -> Typing Corrector from the intellij IDEA menu. If you are able to navigate to the same window on your OS, you can try this.
Uncheck Enable keyboard layout correction in the Typing Corrector window
I got the same issue in Ubuntu 16.04. Restarting IDEA doesn't change anything. But Changing the default layout to be the one I want by default ensured ubuntu work well with it.
Go to the search textfield above file editor.
Switch layout.
Type smth.
Click somwhere in the file editor.
Write smth with swithed layout.

Intellij IdeaVim change keys

I would really like to be able to use IdeaVIM but I am unable to figure out where I can set my custom vim key mappings. For example instead of using Esc I would like to use Ctrl-C and instead of using hjkl I like to use wasd.
I have all these already set in my .vimrc but IdeaVIM failed to load them. I can copy them over manually to whatever file is needed but there is no documentation on how to do this.
As of IdeaVim 0.35 (released 2014-05-15), key mappings in ~/.ideavimrc are supported. You can put source ~/.vimrc in that file if you want to include mappings from ~/.vimrc.
Release announcement
VIM-288
(Note: This question could probably be considered a duplicate of this other StackOverflow question.)
I've done this myself, and its pretty easy in IntelliJ 11. I know that in previous versions (9, maybe?) setting up keymap values is significantly different.
In IntelliJ 11 you can do the following:
Go to Settings
Select Keymap from the left menu
Search for Exit Insert Mode on the right side and associate whatever key you want to use, such as CTRL-C
If you like to have Vim plugin installed (I find it very handy for typing) and at the same time have Ctrl+C and Ctrl+V working for copy and paste actions, do the following:
In the IntelliJ Idea, click on File > Setting. On the left pane, expand Editor and click on Vim Emulation.
Here, under the Shortcut column, find Ctrl+C and change it's Handler (under Handler column) to IDE instead of Vim.
Repeat it for Ctrl+V as well and hit Apply and Ok.
Now, you should be able to use the keyboard shortcuts for copy and paste while keeping the Vim Emulator enabled.
IntelliJ 12.1:
Go to Settings
Select Keymap from the left menu
Find Escape under the Editor Actions section and add the Ctrl-C shortcut there. ("Escape" under the "IdeaVim" section didn't work for me)
Following the same steps, but replacing "Escape" with "Exit Insert Mode" only partially worked for me. It exited insert mode correctly but ignored the following keystroke. So typing Ctrl-C,j,j would exit insert but only go up one line instead of two.