I want to set shortcuts for "navigateBack" and "navigateForward" in Android studio on mac - android-studio

workbench.action.navigateBack
workbench.action.navigateForward
My personal computer is a macbook.
I want to set the shortcut setting of the above command id in android studio, but I can't find it in key map.
It would be helpful if you could tell me the names of these commands, how to search them, or how to set them.

Go to Preferences -> Keymap, here you can use search or manually open Main menu / Navigate folder. Back and Forward elements show default key shortcuts, also you can double click on the element and set your own shortcut, modify existed ones etc.

Related

What is a tick sign in front of .xml file in android studio

What is the tick symbol and how to remove it ?
Did I accidentally set something ?
Probably you pressed F11 or Ctr+F11. It is a simple book mark, like those in other browsers, used for later view, usage, etc.
Check this for other shortcuts link.
It's a bookmark feature in Android Studio. Useful, When you are working on most frequent files. Try pressing F3 to remove the bookmark or creating the bookmark. If F3, F11 or Ctrl+F11 is not working for you, go to the Android Studio Preference Settings -> Keymap and now search for the "bookmark". You will find the Toggle Bookmark option there and so is your respective hot key.

Android Studio | Navigate to file in the project explorer from the editor

I find myself with many files open in the editor (in separated tabs), and sometimes I want to find specific file in the project explorer.
Does there is any shortcut to reveal the file in the project window ?
EDIT to do the question more clear I add a picture:
There isn't a single key combo that can do this, as far as I know, but you can go with
On Windows
Alt + F1 followed by either 1 or enter
On Linux (using Gnome)
Alt + Shift + 1 followed by either 1 or enter
On Mac OS
Option + F1 followed by either 1 or enter
Android Studio is based on intelliJ, which has a function to open the current file or symbol in various views. The default key combo (in Windows) is ALT + F1.
This offers to open the current file or symbol in a bunch of different views, but the first option (with shortcut key 1) is the project view.
It's the same as choosing the Navigate > Select in... menu option, followed by option 1.
Note that you can customise the key mappings, or select other defaults instead of the default intelliJ configuration, so this might not be the case with your set up.
You can check the key mapping in settings > Key map and search for Select In... or, more simply, click the navigate menu and look at the Select In... option to see the shortcut key displayed in the drop down.
You can go to Navigate -> Select In, which has default shortcut Option+F1 on macOS.
For Xcode, the shortcut is Cmd+Shift+J. If you want the same, follow these steps
Go to Android Studio -> Preferences -> Keymap
Search for Select In in Navigate
Right click and select Add Keyboard Shortcut
Press Cmd+Shift+J

Cmnd F to Search on Page In Android Studio

What I REALLY miss in Android Studio is the ability to search within a page without accessing the menu item "Edit/Find/Find" I simply want to use keys cmnd and f like I do in all other programs. I was able to add it through my Mac preferences and now the key sequence shows next to the find, but it still does not work.
Anyone know how to "Find" within a single page with a keystroke combination in Android Studio.

How to configure IntelliJ (also Android Studio) redo shortcut to CTRL+Y instead of CTRL+SHIFT+Z?

The default IntelliJ / Android Studio "Redo" action shortcut is CTRL+Shift+Z and this is a common problem for Windows users.
A bigger problem is CTRL+Y is mapped to the "Delete line" action - and this causes the undo stack to be lost.
To solve this issue, how can the "Redo" shortcut be changed to CTRL+Y in IntelliJ?
Open Settings (press CTRL+ALT+S)
Click Keymap on the left list.
There is a combobox that contains keymaps. Select one of them (default means IntelliJ of course. We can't change any of pre-defined keymap however we can copy, edit and then use the edited one. So) we should copy "default" to change only redo mapping.
Give a new name to your copied keymap.
Right click on:
Main Menu -> Edit -> Redo to click "Add Keyboard Shortcut"
Press CTRL+Y
Click OK
Click "Remove" to "the shortcut is already assigned to other actions. Do you want to remove other assignments?"
If you want to use any "remove line" shortcut also, then go to delete line shortcut and give to it any other shortcut (like 5th step)
Click OK to close settings window.
Change the keymap setting to the Visual Studio, Eclipse, or NetBeans preset.
The settings window can be found under File > Settings. CTRL+ALT+S should work if the shortcut hasn't been changed. In the settings window you should find Keymap under the Appearance & Behavior settings list.
You can configure each editor command to a key combo that you like (as #ismail yavuz mentioned) such as for Redo to CTRL+Y or you can just change the Keymap setting to an editor that you are used to. This might be best if you are in the process of switching to IntelliJ as it is probably the path of least resistance. The default settings for the Visual Studio, Eclipse, and NetBeans keymaps all map Redo to CTRL+Y.
The Principle of least astonishment is strangely violated for Windows users but at least shortcuts is customizable. Because of this command being so contrary to the Windows experience I decided it wasn't worth learning the IntelliJ keyboard when anywhere you're working at you need to, you can quickly change. There are almost no drawbacks to not learning the IntelliJ. Remember that in the keymap menu you can search for a command in the search box or click on the magnifying glass on the right to search by key combo.
Of course neither answer is wrong. Chose your preference.

shortcut in Android Studio to locate the current editing src file

Do you know how to check the location of current editing file in the project tree panel (the very left panel of the Android Studio), except manually. (The worst case is that all the folders there are collapsed)
The Navigate->Class shortcut can show me the src file in edit panel (central panel) quickly. Then I want to know the src file's logic location in project tree (left panel), so that I can add some new files in the same package quickly. (e.g. right-click the package and add new Class).
Currently, I have to expand the project tree and find it folder by folder.
Actually, in Xcode there is such a shortcut named "Reveal in Project Navigate"
What a convenient way it is.
I wonder whether this is also supported in Android studio.
Thanks
You can use the Scroll from Source button in the Project Toolbar in the left of Android Studio.
Another solution is Alt+F1+1. You can also read Locate current file in IntelliJ for more answers.
Just enable the following option!
In Android Studio 4 it is now Always Select Opened File under the Settings menu in the project view.
For automatic scrolling, you can do following:
You need to ensure Autoscroll to Source and Autoscroll from source is enabled.
Whenever you change the file the Project tree will be highlighted according.
I have observed some slowness and lag if project size is big(several modules or huge code base) and you use short cut Ctrl + N to navigate to a class.
So the alternative would be to either to click following icon:
OR
Use keyboard shortcut:
Alt + F1 + 1 or Alt + F1 + Enter
You can add shortcut (keymap) to "reveal current editing file in project explorer" command.
Press Ctrl + Alt + S, for Windows user, to open Settings
Select Keymap on the sidebar
Find the command using search box, type this into it: select in project view
Right click the result then select Add Keyboard Shortcut
Type any keyboard combination you want, for example, me prefer shortcut Ctrl + K to reveal current editing file on project explorer
Click OK button. It will prompt you to remove keyboard shortcut you typed from existing command, so just click Remove button.
I'm new to android development. I used to code in Sublime Text 3. One of first thing I do to make android development feels more enjoyable is binding all shortcut I used in Sublime Text 3 to Android Studio. Now, it feels like home :)
For Mac users: Option+fn+F1, then Enter.
Android Studio 3.6.3 (April 2020)
Go to Preferences > Keymap & search for "Select in Project View" and assign your keyboard shortcut.
Under options menu, select Auto scroll from Source
Navigate -> Select In.. -> Project View -> Project
open pref -> Keymap, then search 'select file in project view', not 'select opened file'.

Resources