65

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.

5 Answers 5

107

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

6
  • 2
    I think this should be the accepted answer, as it actually exactly answers my question! thanks @Aldo Canepa Oct 2, 2015 at 0: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, 2016 at 4:00
  • it's confusing, too many commands in one line, it's hard to find out the proper one.
    – quotesBro
    Oct 9, 2017 at 17:13
  • To select: ^(Control) + G Jan 10, 2021 at 7:40
  • If you are using Visual Studio keymaps - the shortcut is ALT+SHIFT+.. See this for all the other shortcuts jetbrains.com/help/rider/… Dec 14, 2021 at 18:02
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.

3
  • 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. May 5, 2015 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. May 5, 2015 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, 2016 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

1
  • CTRL+G works fine on macOS Big Sur (11.2) in Android Studio IDE Feb 5, 2021 at 10:14
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.

-1

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

The F3 key worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.