Intellij outputs wierd characters for keys that are should not output anything - intellij-idea

Intellij keeps making my life difficult. I decided to go to the bottom with it today and create a new keyboard mapping for mac using the program ukulele.
By default, Mac will output all kinds of weird characters when you hold down the option key. Now, since I never use any of those, I prefer to use them for shortcuts and using ukelele you can create a new keyboard layout. The program works fine. It is good.
Now, shortcuts are not filled on the keyboard, and in the learning phase, you will try some that are not working, or assigned.
When this happens, Intellij outputs weird characters instead. Characters such as for instance for the combo option + r. Same for e, t and so on.
This does not occur in chrome, the terminal, TextEdit or any other program.
Intellij seems to realize the combo does not result in anything and decides to put out the same character for all those keys.
As you see in the picture below from the macOS build-in keyboard viewer, the keys are not mapped (option being held down) at all.
Note, that only Intellij so far outputs these characters.

Related

Why can't I type "#" in InttelliJ IDEA?

In the editor window in IntelliJ IDEA, I can't type #, which should be done by pressing AltGr + Q with my keyboard. If I press that sequence of buttons, nothing happens at all. It doesn't open any menu option nor window nor runs any operation.
This is true for every project I work with this IDE.
I don't have this problem in any other text field of any other program. I don't have any plug-in installed. I don't see this problem in any other IntelliJ IDEA from any other user, whether I know in person or by Internet. I'm not using any shortcut that uses Ctrl + AltGr + Q (it doesn't even accept shortcuts that start with AltGr or even AltGr for that matter), so that can't be the problem.
I can type Chinese characters so I don't think it's a character encoding thing nor a problem with the keyboard. I can paste the character, though.
What can be the reason for this, and how can I type #?

Idea shortcut 'Go To Implementation(s)' doesn't work

I faced a very strange problem: in someday(I don't really know when) the shortcut
Ctrl+Alt+B stoped working. This shortcut is just Go To Implementation(s). I still can do it by Ctrl+Alt+Mouse1.
I opened settings, to check how is this shortcut configured - all looks fine for me. So I tried to remove Ctrl+Alt+B and add the same combination again.
In Enter Keyboard Shortcut window I have to press key's so the IDEA would be able to set this shortcut. But I cannot record these combination, I still can record Ctrl+B, Ctrl+Alt+Shift+B, Alt+B, but not the right combination.
I looked at idea log file, but there was nothing criminal.
I wonder if some other application catches this combination, but I doesn't know how to find this application.
PS. I run my Idea on win7
By the way you're describing it, I strongly believe that the problem is not related to the IDE itself but probably some other program listening for that same key combo in a global level.
Its common to lose some keybinding after installing new applications or drivers. For example, I've lost some key bindings in my IDE after installing drivers for Intel Integrated Graphics. The driver was "stealing" hotkeys like Ctrl + Alt + < arrow > used to rotate the screen.
Double check for newly installed or updated programs/drivers, and make sure that they don't have any shortcut that may be conflicting with your IDE.
Also, you might use Hotkey Commander to verify which program is handling your Ctrl+Alt+B.

IdeaVIM: How do I conveniently rename a variable I extract?

In IdeaVIM, if I extract a variable and want to name it, it seems like I'm in visual mode (the name of the variable is highlighted), yet I can't figure out a way to change what's highlighted. Here's an image:
If I type c, it doesn't do anything. If I type cc, it changes the whole line. Basically, it acts like I'm in command mode yet the name is highlighted as if it's in visual mode. What I want to do 99% of the time is change this word. Yet, the cursor is annoyingly one character after the word so ciw doesn't change it.
What's a convenient way to rename this variable? I've normally done hciw. I'd prefer that "extract variable" put me directly into insert mode, though.
It's a little counterintuitive, but the easiest thing to do is just immediately hit i to enter insert mode, then start typing the new name, and it will replace the highlighted text.
The problem, as I see it, is that vim is modal and vanilla IntelliJ is also modal, and what you have here is the interaction of two sets of modes. To understand the IntelliJ modes, try turning off IdeaVIM with ^Z and use the extract variable refactoring. Notice how if you start typing right away, what you type replaces the selected text, but if you move the cursor first and then start typing, what you type is inserted at the cursor. Now add IdeaVIM to the mix: once you are in insert mode, IntelliJ's behavior kicks in.
See VIM-274 for a request to change this behavior and some discussion of alternatives.
For "Extract Variable" once you've got to the point where it's suggesting names:
What always works is pressing Escape, b, cw and then typing the new name.
Sometimes you can press b right away, but often that puts me into visual mode for some reason, so pressing Escape is guaranteed.

TextMate map key for next complete to command + spacebar

I found a lot of tutorials and forum questions around remapping key bindings in Textmate and for the most part I know what needs to be done as far as copy the KeyBindings file and then make the changes needed. More on what I am talking about here http://blog.macromates.com/2005/key-bindings-for-switchers/
I am interested in re-mapping the esc key for nextComplete to control + spacebar. The problem is I am having a hard time finding what the code is for the spacebar or if this is even supported.
I mainly do actionscript development in eclipes and code hinting dialogue is triggered by this key combo and I would like to have the same in Textmate. Hitting the esc key kind of sux. I thought I would get used to it but the fact is that it just kills the flow of typing the rest of your code.
I could use some help figuring out what he code is for the space bar. I know control key is the ^ symbol. I tested this by changing the keybinding to ^s and it remapped just fine.
I think this one can be done with the OS X gui:
System Preferences, Keyboard, Click Keyboard Shortcuts Tab
Click the little Plus, and choose Application: Textmate.app, Menu Title: Next Completion, Type Command Space (or Control Space) and click Add and that should work. You might want to remove conflicting shortcuts - possibly spotlight?
For future reference, I used Key Codes to find the key for space is: \UF20

Keyboard shortcut to Un/Comment out code in Mathematica 7?

A keyboard shortcut to comment/uncomment out a piece of code is common in other programming IDE's for languages like Java, .Net. I find it a very useful technique when experimenting through trial and error to temporarily comment out and uncomment lines, words and parts of the code to find out what is and isn't working.
I cannot find any such keyboard shortcut on the Mathematica front end in version 7. I know that it is possible to comment out code by selecting the code, right mouse click and select Un/Comment from the menu that appears but this is too slow while coding.
I tried to access this using the menu key Menu on the keyboard but Mathematica frontend doesn't respond to or recognise this key unlike other applications, this could have allowed a key combination for commenting. Can someone else verify that this isn't unique to my machine and that the key isn't recognised by mathematica. I looked at this question and looked in the KeyEventTranslations.tr file but I don't think there is any way to create a shortcut to do this(?). Should I just live with it?
Any other suggestions?
(I have seen there is an Emacs version of mathematica, I have never tried Emacs or this Mma version and imagine that it would have this ability but would prefer not to go to the trouble and uncertainty of installing it. Also I would guess that the Wolfram Workbench could do this, but that may not be worth the investment just for this.)
You can install the shortcut in Mathematica 7.0.x if you are willing to edit the Mathematica system file MenuSetup.tr. You can find it in the same location as the KeyEventTranslations.tr file (i.e. in the installation under "SystemFiles/FrontEnd/TextResources/platform"). In MenuSetup.tr, locate the following line under the definition of the Edit menu:
MenuItem["Check &Balance", "Balance", MenuKey["B", Modifiers->{"Control", "Shift"}]],
Immediately below that line, insert the following:
MenuItem["Un/C&omment Selection", KernelExecute[FE`toggleComment[]], MenuKey["/", Modifiers->{"Command"}], MenuEvaluator -> Automatic, Method -> "Queued"],
The Un/Comment Selection command is now available under the Edit menu, with the keyboard shortcut Cmd-/ or Alt-/ depending on your platform -- just like in Mathematica 8 where this command comes pre-installed.
Please take as read the usual disclaimers about hacking the Mathematica installation files -- no warranty is offered :)
I do not know of any way to map this function to some shortcut involving the Menu key.
Shortcut Key, No Menu
The preceding steps mimic what Mathematica 8 does by installing a new menu item. If you prefer to leave the menus unchanged, then you can install the shortcut in KeyEventTranslations.tr instead. Add the following line:
Item[KeyEvent["/", Modifiers->{Command}], KernelExecute[ToExpression["FE`toggleComment[]"]], MenuEvaluator -> Automatic, Method -> "Queued"]
You'll need a comma on the end of that line if it is not the last item in the list.
Select the code and press one of the following:
Alt+/
Alt-E-O
Alt+E+O
Notes:
Tested only on Windows, using Mathematica 8.
On my non-US keyboard (ABNT Brazil), the shortcut Alt+/ doesn't work, instead I use Alt+E+O.
Here is code for your KeyEventTranslations.tr file that will comment out code. I am still working on the other half.
Item[KeyEvent["/", Modifiers -> {Command}],
FrontEndExecute[{
NotebookApply[FrontEnd`InputNotebook[],
"(*\[SelectionPlaceholder]*)"
]
}]
],
This binds it to Alt+/ as it is in Mathematica 8.