ChatGPT解决这个技术问题 Extra ChatGPT

Does IntelliJ have a `Ctrl` + `K`,`Ctrl` + `D` Sublime equivalent? How do I skip a match when using Alt+J for multiple selections in Android Studio?

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.


A
Aldo Canepa

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)


I think this should be the accepted answer, as it actually exactly answers my question! thanks @Aldo Canepa
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 ?
it's confusing, too many commands in one line, it's hard to find out the proper one.
To select: ^(Control) + G
If you are using Visual Studio keymaps - the shortcut is ALT+SHIFT+.. See this for all the other shortcuts jetbrains.com/help/rider/…
m
maba

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.


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.
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.
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
z
zayquan

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


CTRL+G works fine on macOS Big Sur (11.2) in Android Studio IDE
k
krozaine

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.


H
Hessvacio

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

The F3 key worked for me.