63

I want to have the 'Ctrl'+'K','Ctrl'+'D' functionality of Sublime in Android Studio, how do I do it?

Perfectly similar to this question, but with respect to Android Studio. How do I skip a match when using Ctrl+D for multiple selections in Sublime Text 2?

I use Ctrl+D to add to selection (discrete multiple select) the next occurrence of the string (or substring) highlighted. And to skip adding next immediate selection to selection but the one after it, I use Ctrl+K, Ctrl+D. How do I do the same in Android Studio.

I just know Alt+J is similar to Ctrl+D (found from Keymappings in Android Studio).

And to deselect the last selected it's Alt+Shift+D.

But how do I skip next occurrence?

My question is in no way related to: Does IntelliJ IDEA have a `Ctrl` + `K`, `Ctrl` + `D` equivalent?. That's Visual Studio equivalent. I want the SublimeText equivalent.

Community
  • 1
  • 1
Saravanabalagi Ramachandran
  • 8,551
  • 11
  • 53
  • 102

5 Answers5

104

Check http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-rc-introduces-sublime-text-style-multiple-selections/

Select next occurrence: Alt + J (Ctrl + G for Mac OS X)

Unselect next occurrence: Shift + Alt + J (Shift + Ctrl + G for Mac OS X)

Select all occurrences: Shift + Ctrl + Alt + J (Ctrl + Cmd + G for Mac OS X)

Remove all selections: Esc

Add/remove a selection: Alt + Shift + Mouse Click

Aldo Canepa
  • 1,791
  • 2
  • 16
  • 16
  • 2
    I think this should be the accepted answer, as it actually exactly answers my question! thanks @Aldo Canepa – Garrett Simpson Oct 02 '15 at 00:36
  • 4
    this behaviour is similar but not identical (inferior IMO) to the sublime implementation. From my experience so far, if I press Shift + Ctrl + G it will unselect the most recently selected piece of text, but it will not allow me to "skip" it and continue hilighting subsequence matching strings. Does anyone know of a full solution ? – zayquan May 17 '16 at 04:00
  • it's confusing, too many commands in one line, it's hard to find out the proper one. – quotesBro Oct 09 '17 at 17:13
  • To select: ^(Control) + G – Abhishek Kanthed Jan 10 '21 at 07:40
  • If you are using Visual Studio keymaps - the shortcut is `ALT+SHIFT+.`. See this for all the other shortcuts https://www.jetbrains.com/help/rider/Reference_Keyboard_Shortcuts_Index.html#multicaret – Newteq Developer Dec 14 '21 at 18:02
  • part 2 of question is missing, how to skip an alt j? F3? ok – Alireza Jamali Oct 12 '22 at 12:16
23

It is described in this Issue that was initially created because this skip-next was missing.

Anyhow you just press F3 to skip next possible selection.

maba
  • 47,113
  • 10
  • 108
  • 118
  • 1
    I just bound Ctrl+K combination to Find Next (F3), so I can use Ctrl+K in Android Studio like Ctrl+K, Ctrl+D in Sublime. It just worked exactly the way I wanted. – Saravanabalagi Ramachandran May 05 '15 at 17:46
  • 1
    And I tried the same F3 trick in Sublime, it didn't work. It removed all previous selections in addition to the currently selected string while selecting only the next occurrence. In Android Studio, current occurrence selection alone was removed and the next occurrence got selected and added to the already selected items. – Saravanabalagi Ramachandran May 05 '15 at 17:48
  • If you are using the "Mac OS X 10.5+" keymap then the answer above will not work. See my answer below (and vote for it!). Hint: skip is CMD+G – zayquan May 17 '16 at 23:42
18

If you are using OSX, there are two answers, depending on what keymap you have selected in Preferences:

Keymap : Mac OS X 10.5+

  • To start / add to your discrete multiple selection : CTRL+G
  • To skip the current selection and move to the next : CMD+G

Keymap : Mac OS X

  • To start / add to your discrete multiple selection : CTRL+G
  • To skip the current selection and move to the next : F3
  • (this mode is really awkward IMO - no flow)

If you have more follow up questions I had success asking support via this thread : https://youtrack.jetbrains.com/issue/IDEA-121956

zayquan
  • 7,544
  • 2
  • 30
  • 39
3

Go To Settings -> Keymap -> Main Menu -> Edit -> Find

OR Search for the following options in Settings -> Keymap

Set the shortcuts for the following (Linux/Mac) :

Add Selection for Next Occurrence : Ctrl + D/Cmd + D

Find Next/ Move to Next Occurrence : Ctrl + K/Cmd + K

You might also want to setup Unselect occurrence:

Unselect Occurrence : Ctrl + U/Cmd + U

Carefully remove/replace/override any other existing bindings with these shortcuts according to your needs. You should have Sublime Text Ctrl+D, K behaviour working.

Note: Test these shortcuts for functionality with the default key bindings first. This will ensure, you get working shortcuts with your favourite shortcut keys.

krozaine
  • 1,481
  • 15
  • 22
-1

I needed to use sublime's Ctrl+D (switch between multiple selected).

The F3 key worked for me.