Navigate to the changed line of code in a file in Intellij Idea - intellij-idea

I have a huge class in which I changed couple of lines in different places. Is there a way(shortcut) to navigate through changed lines of code in the file and not to scroll all the way up/down?

If you edit a file that is under version control, IntelliJ IDEA provides several ways to move back and forth with the updates. In particular, you can use the navigation commands (Navigate | Next / Previous Change.), keyboard shortcuts (⌃⌥⇧↓/ ⌃⌥⇧↑), and the change markers.
To navigate to the place of your last edit, press ⌃⇧⌫ or select Navigate | Last Edit Location from the main menu.
https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#20c948f4

I'm using Control + Alt + Left|Right Arrow for current KeyMap
Refer this screen-shot for your reference in case you are having different mapping.

Related

Keyboard shortcut for small git diff popup as seen when clicked on the gutter marker?

I sometimes want to see the diff of what has changed only per line, but I find it uncomfortable to always move your hand to the mouse and click on the gutter marker. Is there a way to assign a shortcut to open that little diff window (as seen in the image)? I couldn't find an IntelliJ action that opens it.
That action is called Change Under Caret.
By default, no shortcut is assigned to it. You can find it with Find Action (Ctrl+Shift+A | ⇧⌘A).
You can also assign a shortcut to it right in this popup with Alt+Enter | ⌥⏎.
Other useful shortcuts:
Next Change: Ctrl+Alt+Shift+Down | ⌃⌥⇧↓
Previous Change: Ctrl+Alt+Shift+Up | ⌃⌥⇧↑
Rollback Lines: Ctrl+Alt+Z | ⌥⌘Z
Help documentation:
Review changes - Track changes to a file in the editor
Source code navigation - Navigate between changes
Undo changes in Git repository - Revert uncommitted changes
Use the keyboard shortcuts for Navigate:Navigate in File:Next Change/Previous Change
To make it even easier, modify the shortcut for that command to your liking in Preferences:Keymap.

Keyboard shortcut to navigate between IntelliJ views

In IntelliJ, there are some underlined numbers on the side menus :
1: Project
7: Structure
Like below :
So there is probably a keyboard shortcut which allows to navigate from one view to another by just entering the view number.
I tried the different digits with Ctrl, Ctrl+Shift, Ctrl+Alt etc but could not find the right shortcut.
How can I easily navigate between those views?
The shortcut is Alt + [number]
ps. There's a plugin force-shortcuts if you wanna replace your mouse click actions with shortcuts (https://github.com/treytrahin/force-shortcuts-intellij-plugin). It's super annoying but you learn really fast. And by the way here are such plugins to most editors and IDEs.
ALT+F1 opens a window where you can choose one of the views by pressing the corresponding number.
Info: It actually opens the selected file in the selected view - which is not that bad maybe - but not 100% what you want?
Also there are cool things like pressing C to open a file chosen in Project Explorer directly in Explorer for example.

Intellij navigating between editor tabs/splitters does not work?

I am editing with two vertical tabs. The
Window | Editor Tabs | Goto next splitter
has no effect - the editing cursor remains in the present Editor Tab. For curiosity's sake I also tried "Goto previous splitter" - that also has no effect.
Is there something I am missing here? Any other shortcut / method to use keystrokes (not Mouse!) to navigate between Editor Tabs?
Note: Ctrl-E is not reliable for this - it sometimes goes to different documents in the same Editor Tab.
UPDATE
Apparently the editor "sort of" changes splitters: the titlebar and the Navigation panel change to the file in the other splitter. But the cursor does not move! The cursor stays in the original place - in the original splitter/editor tab! So then what the heck use is it to change splitters - I can not edit or navigate in the new splitter!
There are at least two other ways to do similar things as "Goto next/previous splitter".
You could try the "switcher" (Ctrl-Tab, OS X & Win) to switch between specific files.
Similarly, you can try the "Recent Files" (Ctrl+E, Win; ⌘E, OS X)
But whatever is causing the cursor to not follow the "Goto next/previous splitter" might make it not follow these options, either...

Intellij Idea 13 configuration. Navigating between methods

Where do I find the checkbox to navigate between methods?
Example: inside one tab going into one method pressing then Alt+Navigation Key I want return back or up. Currently Alt+Navigation Key get me to previous opened Tab.
I faced the same Problem. By default 13 will open without the Toolbar.
Go to View --> Toolbar and enable Toolbar. It will enable the tool bar you need.
Or you can use ctrl+Alt+Left to go to previous method
You want to use Navigate->Back/Forward. You can get the keystroke from the menu items.
Seems long time ago I have changed Idea keymap for this at work.
Open Settings->Keymap, find there in tree Main menu-> Navigate -> and change Back / Forward to Alt + Navigation Key.
P.S. I was searching for combination Alt+Left/Alt+Right, but Idea doesn't search this way (

How do I create a new class in IntelliJ without using the mouse?

Is there a way to create a new class in a desired location without using the mouse in IntelliJ?
I understand there is no keyboard binding in the default keymap.
If you are already in the Project View, press Alt+Insert (New) | Class. Project View can be activated via Alt+1.
To create a new class in the same directory as the current one use Ctrl+Alt+Insert (New...).
You can also do it from the Navigation Bar, press Alt+Home, then choose package with arrow keys, then press Alt+Insert.
Another useful shortcut is View | Select In (Alt+F1), Project (1), then Alt+Insert to create a class near the existing one or use arrow keys to navigate through the packages.
And yet another way is to just type the class name in the existing code where you want to use it, IDEA will highlight it in red as it doesn't exist yet, then press Alt+Enter for the Intention Actions pop-up, choose Create Class.
You can also use: ctrl+alt+insert
With Esc and Command + 1 you can navigate between project view and editor area - back and forward, in this way you can select the folder/location you need
With Control +Option + N you can trigger New file menu and select whatever you need, class, interface, file, etc. This works in editor as well in project view and it relates to the current selected location
// please consider that this is working with standard key mapping
For Mac Os, command + 1 , then press control + return
On Mac OS 10.14.5, Idea Intellij 2019.1.3 - Press command + 1 to navigate to project files then press control + n
On Mac you can navigate to the location in Project view where you want to create your class and then use ⌘N followed by Enter.
I do this a lot, and I don't have an insert key on my laptop, so I made my own keybinding for it. You can do this by opening Settings > IDE Settings > Keymap and navigating to Main menu > File > New... (I would recommend typing "new" into the search box - that will narrow it down considerably).
Then you can add a new keyboard shortcut for it by double clicking on that item and selecting Add Keyboard Shortcut.
Alt-Home until you're in Packages view
Down-arrow until package is highlighted
Alt-insert
Enter X 2
Type name
$PROFIT$
If you use Mac, you are in luck. One can change the keymap for Intellij as Mac OS X, then you can use option+C.
In my (linux mint) system I can not get working combination alt+insert so I do the next steps:
alt+1 (navigate to "tree") --> "context button - analog right mouse click" (between right alt and ctrl) -- then with arrows (up or down) desired choice (create new class or package or ...)
Hope it helps some "mint" owners )).
I also searched this answer. Equivalent of command+N on Mac OS for Windows is ctr + alt + insert which #manyways already answered. If you searching this in settings it is in Settings > IDE Settings > Keymap, Other > New ...
If the difficulty is in finding the option that makes .java or .class files (Like me), then simply,
click on the folder you want to create file on. select new, and type file's name along with extension.
For example, instead of, helloWorld type helloworld.java or any file extension you desire.