Visual Studio Code: Select each occurrence of find - keyboard-shortcuts

I'm looking for a "select each occurrence of" something I'm trying to find. For example a file has a bunch of text that includes "abc", I type ctrl+f and type abc. I can either find the first one or the next one, but I would like to "multi-cursor" each one in the file.
I've already found the feature that lets me highlight text and ctrl+d to get the next that matches the selection, but if there's a hundred of these things - well that gets quite tiresome.

Ctrl+Shift+L Select all occurrences of current selection
editor.action.selectHighlights
Ctrl+F2 Select all occurrences of current word
editor.action.changeAll
Please refer for more information here.

Alt+Enter Select all occurrences of find match
editor.action.selectAllMatches
This has the added benefit of working with Regular Expression searches, since selecting occurrences of a word of a selection cannot leverage the Regex functionality.

I know this thread is here for a while now, but I think this will be helpful:
This thread on Github talks exactly about it:
https://github.com/microsoft/vscode/pull/5715
Summary:
Ctrl+F --> Open find widegt.
Alt+R --> Turn on regex mode.
Input search text --> Regex text or normal text.
Alt+Enter --> Select all matches.
Left arrow --> Ajust cursors.(Ignore this step if you don't want to edit the ---selected text.)
Edit text --> Do what you want.(Ignore this step if you don't want to edit the -selected text.)
Shift+Home --> Select modified text.(Ignore this step if you don't want to edit the selected text.)
Ctrl+C --> Copy selected text.
Ctrl+N --> Open a new tab.
Ctrl+V --> Paste.

well , basically the Ctrl+Shift+L will select all occurrences of word in the document BUT
there is some coool way to selecting them growingly:
if you hit Ctrl+d it will selects the second match , it you hit Ctrl+d again it will match the third one and so on ....

For Mach User:
COMMAND + Shift+ L Select all occurrences of the current selection
COMMAND + F2 Select all occurrences of the current word

For mac users::
Control + Command + G
^ + ⌘ + G

Ctrl+F2 is what worked for me for VSCode on Windows 10.
While Ctrl+Shift+L just opened some Language selector.

If you are searching in a single file, use simple search using Ctrl+F, then even if you close the search box, simply keep pressing F3 to go to next match and so on. F3 just repeats previous search and selects your next match.

On Mac:
Ctrl+F to open the find menu in top right:
Select the third option within the input and add the regex you want to match.
Ctrl+Shift+L to select all items that match.
Hope that helps!

Related

How select text wrapped in quotation marks in NetBeans

For example, I have a string wrapped in quotation marks, and I need select it all string wrapped. I usually select one by one each word using "Shift+Ctrl+Right Row" to the end. But it's not cool.
You can select the entire word by using the shortcut Alt+Shift+PERIOD.
if you are in a line with several words you can use this shortcut several times and the selection will move to the next words.
If by any chance you don't like the shortcut you can change it.
In Netbeans just go to menu Tools -> Options and choose Keymap. The shortcut that you will be looking is "Select Next Element".

Select current line in intellij

Is there any way to select the whole line at caret in IntelliJ 15? I know you can select the current word (ctl + w), go to beginning/end of line but I can't find a current line selection feature.
Simply hit
ctrl+c
Note that for this to select the whole line, you need to ensure that nothing is already selected; otherwise it'll work as an usual "copy" command.
move caret to line
on Windows, press ctrl+shift+a .
This popup appears, where you find Select Line at Caret
for quick access, you can specify a shortcut in Settings
I would like to also add the following from JetBrains website. Because, that what i was looking for here, but no one mentioned it.
1- To select text from the current caret position to the beginning/end of
the current word:
Ctrl+Shift+Left, Ctrl+Shift+Right.
2- To select text from the caret
position to the beginning/end of the current line:
Double-click Ctrl and press Home/End
3- To select text from the current
caret position to the top/bottom of the screen:
Ctrl+Shift+Page Up, Ctrl+Shift+Page Down.
If none of the above are working, I suggest using end and home keys in combination with shift allowing you to select lines quickly.
Go to the end of the line and hit Ctrl+W. If you'll hit Ctrl+W at the beginning of the line it will select only one word.
Not a keyboard feature, but nice to use:
to select the whole row just click on row number on the left of the code.
In addition to that you can click and drag selection.
Moreover, you can doubleclick on the number of the first line of method which results selection of the whole method.

What is the shortcut to find next occurrence of a word in IntelliJ IDEA?

In Eclipse the keyboard shortcut to find next occurrence of a word in a file was Ctrl + k . It finds the occurrence of the selected word in a file one by one in a loop. What is the equivalent keyboard shortcut for IntelliJ IDEA? If not can we configure it some how?
First you'll have to highlight a symbol by pressing Ctrl+Shift+F7.
Then you just press F3 or Shift+F3 no navigate between the highlighted symbols.
When done you press Esc to exit the highlight searching.
It is all described on Highlightning Usages in IntelliJ Web Help.
Add selection for the next occurrence on Linux Alt+J
Finding Word at Caret: Ctrl+F3.
On Mac it's Command + G, but you can check what works for your OS by looking at Edit -> Find -> Find Next....
AFAIK you have to select the word in the search bar first.. So, Command + F and then Command + G to go to the next occurrence.
In Android Studio 1.4, apparently Mac OS default keyboard shortcuts for element next occurrence (vars, methods, etc) are
NEXT/FWD: Command+G
PREVIOUS: Shift+Command+G
I did try all the answers w/out success, and finally I looked it up in Prefs->Key Bindings
There are also hotkeys for navigating next/previous highlighted usages.
Several years ago they were Alt+Wheel down and Alt+Wheel up. Today they are not set by default.
You can find them in Keymap preferences with highlighted element usage search phrase.
Please consider using the Multiple Selections for this:
Select the term you want to lookup;
Use Alt+J / Shift+Alt+J (or Ctrl+G / Shift+Ctrl+G for Mac OS X) to select other occurrences.
It will work the same as Shift+F3, but it will select every next occurrences. I found this way much more conveniant, as you can choose to edit all the matching string or just move the cursor to edit the last selected one (←/→).
The Multiple Selections feature is available since IntelliJ IDEA 13.1 RC, and compete with Atom or Sublime Text similar feature.
I could not get any of IntelliJ's native options for Find Next/Previous to behave like in Eclipse. Find Word at Caret comes close, but it only allows you to slurp and find the next word, not previous.
I wrote an IntelliJ plugin to reproduce the exact behavior as in Eclipse. You can find it here: https://plugins.jetbrains.com/plugin/10635-quick-find-plugin
you can set shortcuts same as in eclipse by setting keymap value as eclipse.
Steps in intellij:
Go to setting in file
search for keymap
In the dropdown section set Eclipse
Now all your shortcuts are same as in eclipse.
For MAC:
First you'll have to highlight a symbol by pressing Command+Shift+F7.
Then for next occurrence Command+G or Command+Shift+G
On my Mac it is:
ctrl-l to find next occurrence
ctrl-shift-l to find previous occurrence
IntelliJ Keyboard Shortcuts
On Ubuntu:
Next occurrence of selected word: F3
To expand the question slightly, the method to display the next occurrence of a search term in the Find In Path pane, is to steer to it using the up/down arrows and then hit Enter.
Start by looking for all occurrence of the key (control + g)
Then use ( shift + command + g ) to find previous occurrence and ( command + g ) to find next occurrence.
For those who use IdeaVim plugin, there is another option.
Add these entries into .ideavimrc:
map <C-j> <Action>(GotoNextElementUnderCaretUsage)
map <C-k> <Action>(GotoPrevElementUnderCaretUsage)
This maps the navigation to the next/previous element under caret using ctrl+j/ctrl+k. Of course you can map it to something else, but this suggestion follows the standard navigation keys in vim.

How to select all instances of a variable and edit variable name in Sublime

If I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them:
Is there a keyboard shortcut that will let me select all of those instances of the variable and edit them all at once?
Things I've Tried:
⌘D, ⌘K, and ⌘U lets me select them one-by-one, but I have to manually exclude the non-variable string matches:
And using Ctrl⌘G simply selects all the string matches:
Clearly, Sublime is able to differentiate between variable and string matches. Is there no way to select just the variable matches?
Put the cursor in the variable.
Note: the key is to start with an empty selection. Don't highlight; just put your cursor there.
Press ⌘D as needed. Not on a Mac? Use CtrlD.
Didn't work? Try again, making sure to start with nothing selected.
More commands:
Find All: Ctrl⌘G selects all occurences at once. Not on a Mac? AltF3
Undo Selection: ⌘U steps backwards. Not on a Mac? CtrlU
Quick Skip Next: ⌘K⌘D skips the next occurence. Not on a Mac? CtrlKCtrlD
Sublime Docs
I know the question is about Macs, but I got here searching the answer for Ubuntu, so I guess my answer could be useful to someone.
Easy way to do it: AltF3.
Despite much effort, I have not found a built-in or plugin-assisted way to do what you're trying to do. I completely agree that it should be possible, as the program can distinguish foo from buffoon when you first highlight it, but no one seems to know a way of doing it.
However, here are some useful key combos for selecting words in Sublime Text 2:
Ctrl⌘G - selects all occurrences of the current word (AltF3 on Windows/Linux)
⌘D - selects the next instance of the current word (CtrlD)
⌘K,⌘D - skips the current instance and goes on to select the next one (CtrlK,CtrlD)
⌘U - "soft undo", moves back to the previous selection (CtrlU)
⌘E, ⌘H - uses the current selection as the "Find" field in Find and Replace (CtrlE,CtrlH)
This worked for me. Put your cursor at the beginning of the word you want to replace, then
CtrlK, CtrlD, CtrlD ...
That should select as many instances of the word as you like, then you can just type the replacement.
The Magic is, you have to start with an empty selection, so put your cursor in front of the word/character you want to multi-select and press Ctrl+D .
To me, this is the biggest mistake in Sublime. Alt+F3 is hard to reach/remember, and Ctrl+Shift+G makes no sense considering Ctrl+D is "add next instance to selection".
Add this to your User Key Bindings (Preferences > Key Bindings):
{ "keys": ["ctrl+shift+d"], "command": "find_all_under" },
Now you can highlight something, press Ctrl+Shift+D, and it will add every other instance in the file to the selection.
As user1767754 said, the key here is to not make any selection initially.
Just place the cursor inside the variable name, don't double click to select it. For single character variables, place the cursor at the front or end of the variable to not make any selection initially.
Now keep hitting Cmd+D for next variable selection or Ctrl+Cmd+G for selecting all variables at once. It will magically select only the variables.
It's mentioned by #watsonic that in Sublime Text 3 on macOS, starting with an empty selection, simply ⌃⌘G (AltF3 on Windows) does the trick, instead of ⌘D + ⌃⌘G in Sublime Text 2.
At this moment, 2020-10-17, if you select a text element and hit CTRL+SHIFT+ALT+M it will highlight every instance within the code chunk.
Just in case anyone else stumbled on this question while looking for a way to replace a string across multiple files, it is Command+Shift+F

IntelliJ navigate to next and previous highlighted variable

In IntelliJ 10.5 I have "Highlight usages of element at caret" enabled. When a variable/method/etc is selected, is there a way to move to the next and previous occurrence? I'm looking for the equivalent of Control-K in Eclipse.
Edit: Shortcut to navigate between highlighted usages simply moves to the next text occurrence, which is different than moving to the next occurrence of the variable/method/etc. If I have the variable foo selected, I want to navigate to the next occurrence of foo and not any piece of text called "foo" (including "foo" in comments, method names, etc).
Also, pressing F3 seems to be buggy. When I press F3, it sometimes searches using the previous searched text and not the currently highlighted text.
F3 or shift+F3
ctrl+c, ctrl+f, enter or up and down arrows
ctrl+alt+F7
Added this in case people don't look at your edit.
It's not currently possible, see my question: Shortcut to navigate between highlighted usages.
I even created an issue IDEA-70523 addressing this feature, please vote for it if you can't live without it like me :-).
Install Identifier Highlighter Reloaded and use Alt + Shift + Up/Down (can be redefined in Keymap settings) :)
After you give it a shot and notice the 'hey, the highlight stays there after I move my cursor out of it' annoyance, consider upvoting this issue :)
In the Mac OS, you can navigate to next highlighted usage by press control + option + up/down arrow.
Vote this request up for make them implement the feature.
http://youtrack.jetbrains.com/issue/IDEA-59638
I found something thay may more suite your needs : alt + mouse-wheel up/down.
It goes to previous / next occurrence of identifier under caret.
Shortcut name is "Go to next highlighted element usage".
I usually do the following:
Highlight the word
Cmd + F (it will highlight all the matches in file)
Cmd + G (next match)
Cmd + Shift + G (previous match)
I could not get any of IntelliJ's native options for Find Next/Previous to behave like in Eclipse. Find Word at Caret comes close, but it only allows you to slurp and find the next word, not previous.
Identifier Highlighter Reloaded also does not behave like Eclipse.
I wrote an IntelliJ plugin to reproduce the exact behavior as in Eclipse. You can find it here: https://plugins.jetbrains.com/plugin/10635-quick-find-plugin
Look for next occurrence # Keymap
^G = "select" the variable that you want to search for
[shift]⌘G = [previous]next occurrence of selected variable
All credits to #Igor Wojda for his comment in the accepted answer.
(AFAIK, limiting search scope to only variable/method is not possible)
For text based match and quick jump:
Simply place the cursor over the desired word to be searched
Press Ctrl+F3
For further down/up search, simply use
F3/Shift+F3 respectively
in Intellij shortcut for this action, it's not defined.
but you can define it like this:
Ctrl+ Alt + S
search " highlighted usage"
then you can set a shortcut for that.
Ctrl+Alt+Up and Ctrl+Alt+Down navigates to the next and previous usages of a highlighted variable in IntelliJ.
I use this functionality of navigating to the next usage of a variable in a file by hot in Visual Studio all the time (Ctrl+Shift+Up and Ctrl+Shift+Down) and was looking for the equivalent in IntelliJ