Quickfix for creating field variable - how to get back - intellij-idea

Is it possible to get back to my previous caret position after i do a quick fix for create Field on a variable?
test = new String();
My caret is on "test" and i press ALT+ENTER -> create field 'test'
caret goes up to the top of the class and i can edit the Type then i press TAB to get to the name of the variable but after that i only can press ENTER and i don't go back to my line in the code.
I tried ENTER, TAB, ESCAPE.
Refactoring to Field works fine.

Use Intellij shortcut for navigating to last cursor location.
Mac: Alt + Command + Left Arrow
Win: Alt + Control + Left Arrow
Similarly, you can also cycle forward to the last cursor location using
Mac: Alt + Command + Right Arrow
Win: Alt + Control + Right Arrow

Related

Toggle Comments Keyboard Shortcut (CTRL + /) Does Not Work

I use SAS Enterprise Guide and Teradata Studio Express to code for my day job. WindowsOS.
I use CTRL + / shortcut to comment lines of code out in both apps. Suddenly, this shortcut has stopped working. I've checked all my keyboard and Code Shortcut Key settings in both apps and nothing seems out of place!
All other shortcuts seem to work in both apps, common ones I use like CTRL+C (copy), CTRL+X (cut), CTRL+V (paste) etc
I've got no idea why the 'comment out' shortcut is unable to register. Anyone else encounter this same annoying issue?
CTRL + : will pack your line in /* and */
If you have selected a range, Enterprise Guide will do that with every line from which you selected any character.
CTRL + Shift + : will unpack them
You just have to define it again.
Go to Tools-->options-->Enhanced Editor Keys
Select the Command "Comment the selection...." and press Assign keys
within "Press new shortcut key:" enter the ctrl + : key and press assign

IntelliJ shortcut to comment line

There is a way in webstorm to comment or uncomment a specific line or selected block of source code with shortcut?
I try to use CTRL + / but doesn't work for me
References
https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html
Try to use Ctrl+Slash or Ctrl+Shift+Slash for block comment
If this doesn't work show in your Setting -> Keymap -> Search comment
Use CTRL+/, but with the / located on the numpad.
The question remains why commenting with / (the one besides .) does not work (it does not for me, either).
Ctrl + / ==> To comment/uncomment a line .
Ctrl + Shift + / ==> To comment/uncomment block of code.
Ctrl + Y ==> To delete a line.
On a Mac with an extra keyboard it is CMD + Numpad's /.
The one on the native Macbook keyboard I did not get to work.
Check this post as well: Intellij comment shortcut opens help tab on the Mac menu bar
On Windows with a German keyboard layoout the default keyboard shortcut for the comment lines action Ctrl+/ conflicts with the bookmark shortcut Ctrl+7. You need to remove the keyboard shortcut for bookmarks in order to get this to work.
#Note Shortcut IntelliJ IDEA
Ctrl + / => comment or uncomment a line -> //
Ctrl + shift + / => comment or uncomment block of code -> /**/
Ctrl + y => delete a line
Ctrl + d => duplicate a line
If Ctrl + Shift + / doesn't work , try Ctrl + Shift + Num Pad /.
You can check the exact configuration in settings->keymap.
Commenting out each line of selected code for Mac users without numpad would have to add a keyboard shortcut:
Navigate to settings: Preferences > Keymap > Main menu > Code
Double click on Comment with Line Comment
Insert your shortcut, for example: cmd + shift + 7 would be interpreted as shift + cmd + 7 but works the same.
I have an AZERTY keypad in French, so this was the answer for me :
Ctrl + Shift + / on the numpad
Because / out of the numpad was detected as :, even with Caps Lock on.
You can check how the keystrokes are actually detected by IntelliJ in :
On Windows :
Settings > Keymap > click on the icon of Magnifying glass with cubes (tooltip is "Find Actions By Shortcut"). In the little tooltip that opens, you stroke the keys and observe the registered results.
On Ubuntu :
Settings > Keymap > click on the icon of Keyboard, right next to the search input (tooltip is "Find Actions By Shortcut"). In the little tooltip that opens, you stroke the keys and observe the registered results.
You need to activate this option:
'Settings' > 'Keymap' > 'Use national layouts for shortcuts (requires restart)'
As said before on Mac Montery 12
on Idea 2020.3
CMD + NumPad /
or from Action dialog:
It is necessary to switch to the English layout
its possible to use inellij IDEA by the way you customized before with an IDE like VisualStudio
Settings -> KeyMap -> Choose your old IDE its a grate! feature life saver :)
try ctrl + shift + 7 or num lock and then ctrl + /
control + / (this is the mathematical one which is located on the numbad)

Intellij Idea alt + click to evaluate debugger code not working in Mint

On Windows, and I think Mac, holding alt + left click on a section of code when paused in the debugger will evaluate the expression and show the value in a tooltip. It's much more convenient than alt + f8 and ctrl + alt + 8.
In Linux Mint, holding alt and clicking doesn't do anything (I've disabled Mint's "Special key to move and resize windows").
Is there a way to map it to alt + left click, or a different key combination to evaluate an expression by clicking on it?
Found it mapped to ctrl + alt + shift + left click under Quick Evaluate Expression as a Mouse Shortcut.
Settings -> keymap, change from "Default for XWin" to "Default"

IntelliJ IDEA find matching parenthesis / bracket

Is there any keyboard shortcut to navigate from one parenthesis ( to the matching one ) in IntelliJ?
Or even to "jump to the next opening/closing parenthesis (/) from wherever my cursor is"?
And, if there's no way to do it 'natively', are there any plugins that could add this functionality quickly and easily?
EDIT: the best solution I've found is added as a comment in liango's answer below, namely to put the cursor on the first or last brace and then press CTRL-W twice. Not ideal, but it does the job!
You can use Ctrl + [ and Ctrl + ] to navigate to a code block's start and end.
You can also use Ctrl + Shift + M to navigate between the start and end of a code block.
On Mac, you can use Option + Cmd +[ and Option + Cmd + ], and Ctrl + M
Source: https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html
use CTRL-W to expand the selection within a bracket, use repeatedly if needed to select further out, then use the arrows.
CTRLSHIFTM is the Windows/Linux default shortcut for action "Move caret to matched brace". (For other environments see here and use the Shortcuts dropdown in the top right of the page.)
Or if desired, the shortcut keys can be changed as follows:
Go to Settings -> Keymap -> Editor Actions, or just type the name in the search box.
Here's the latest and greatest as of version 2020.1
To move caret between matching code block braces, press Ctrl+Shift+M.
To navigate between code blocks, press Ctrl+Shift+[ or Ctrl+Shift+].
From the documentation
Navigate with the caret
To navigate backwards, press Ctrl+Alt+← Left. To navigate forward, press
Ctrl+Alt+→→ Right.
To navigate to the last edited location, press Ctrl+Shift+Backspace.
To find the current caret location in the editor, press Ctrl+M. This
action might be helpful if you do not want to scroll through a large
file.
However, you can press the Up and Down arrow keys to achieve the same
result.
To highlight a word at the caret you are trying to locate, select Edit
| Find | Next Occurrence of the Word at Caret from the main menu.
To see on what element the caret is currently positioned, press Alt+Q.
To move caret between matching code block braces, press Ctrl+Shift+M.
To navigate between code blocks, press Ctrl+Shift+[ or Ctrl+Shift+].
To move the caret forward to the next paragraph or backward to the previous one, press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph or Move Caret Backward a Paragraph action.
You can also select a text and then move the caret forward or backward to a paragraph. Press Ctrl+Shift+[ and search for the Move Caret Forward a Paragraph with Selection or Move Caret Backward a Paragraph with Selection action.
You can use Ctrl-[ and Ctrl-].

IntelliJ IDEA shortcut for switching to tab by number

In FireFox, I'm constantly using the Ctrl + 1-9 shortcut to switch tabs. Basically Ctrl + 1 will take me to the first tab, Ctrl + 2 will take me to the second one and so on.
Is there an equivalent for this shortcut in IntelliJ IDEA?
UPDATE:
You can now assign keyboard shortcuts to navigate to the specific tab number:
Original obsolete response:
There is no such feature in IDEA, however you can use Alt + Arrows and Ctrl + E (Recent Files) to navigate between tabs.
Other handy actions from the Go To menu:
Back / Forward (Ctrl + Alt + ←/→)
Last Edit Location (Ctrl + Shift + Backspace)
Another option is to use the GoToTabs third-party plug-in:
The plugin adds menu actions allowing you to go to a specific tab. You
can of course assign keyboard shortcuts the individual actions and for
example achieve the behavior known from other editors/IDEs where you
can switch between tabs with alt+num.
The IDE itself still doesn't support it but I've created a plugin (GoToTabs) that will add "Go to tab #" actions you can assign keyboard shortcuts to (e.g. ctrl+1).
you also can use ctrl + tab to active switcher
after ctrl + tab and keep holding ctrl for other operations
ctrl + number is for bookmarks feature.
Since this is one of the first hits when Googling this, note that as of IntelliJ IDEA 2018.3 EAP this is now possible. From the feature request tracker:
In upcoming 2018.3 EAPs you're welcome to assign shortcuts you need for new actions in the group 'Other', see a screenshot. With these actions you can select tab1..tab9 and also the last tab.
To accomplish this:
Go to Keymap in Preferences
Search for "select tab"
Individually assign Command+<number> to each of the tab numbers mappings
You can use this short cut on mac
Shift + Command + { or }
Not sure what you asking is possible but Navigate as below in intellij idea (13) to switch tabs in one level,
File
└────Settings
└─────────Keymap
└────── Editor Tabs
Where yo can map for actions "Select Next Tab" and "Select Previous Tab", under "Editor tabs" in keymaps. Following is an example for emacs keymap.
cmd+shift+[ - go to previous tab
cmd+shift+] - go to next tab
Actually, there is an option, pressing Alt + Tab a switcher will pop up.
Like this:
[
If you are using IntelliJ's IdeaVim plugin, the vim style shortcut works as well:
gt, go to next tab
gT, go to the previous tab
1gt, go to the first tab
2gt, go to the second tab
3gt, ....
If a tab has a number with an underline like this example, you can use Alt + 9 to switch to it. But not all tabs have a underlined number.
MacOS:
Next tab: ⇧ + ⌘ + ]
Previous tab: ⇧ + ⌘ + [
if you use ideavim, you can use num+gt to go to the specific tab. for example, 2gt lead you to the second tab.
Keymap -> Other -> Tabs.
Then setup what you want