Visual Studio Code Ctrl + comma does not work [duplicate] - visual-studio-code

I am used to Resharper where I can search for files, not the content, but the filename, which makes it quick to open new files.
Is this feature implemented in Visual Studio Code and is there a shortcut for it?

Using Go to File... which is under the Go menu or using keyboard shortcut:
On Windows Ctrl+p or Ctrl+e
On macOS Cmd ⌘+p
On Linux Ctrl+p or Ctrl+e
Then type the file name.
Also be sure to checkout that you can set your own keybindings and that there are cheatsheets available for Windows, macOS and Linux.

Since the 1.70.0 release in July 2022, you can find and filter in tree views such as the Find Explorer. You can press Ctrl+F inside trees to pop up the Find control.
Before the 1.70.0 release
when you click anywhere in the explorer tree, and start typing something on the keyboard, the search keyword appears in the top right corner of the screen : ("module.ts")
And when you hover over the keyword with the mouse cursor, you can click on "Enable Filter on Type" to filter tree with your search !

On OSX, for me it's cmd ⌘ + p. cmd ⌘ + e just searches within the currently opened file.

Method1
Go->Go to File OR cntrl+p
Search your file
Method2
view->command palette OR cntrl+shift+p
type "Go to file"
Search your file

Win: CTRL+P or CTRL+E
Mac: CMD+P or CMD+E
Don't want to remember another shortcut?
Open the Command Palette:
Menu: View -> Command Palette
Windows Shortcut: Ctrl+Shift+P
and hit backspace to delete ">" character and then begin typing to search for files via filename. :)

Other answers don't mention this command is named workbench.action.quickOpen.
You can use this to search the Keyboard Shortcuts menu located in Preferences.
On MacOS the default keybinding is cmd ⌘ + P.
(Coming from Sublime Text, I always change this to cmd ⌘ + T)

Also works in ubuntu with Ctrl+E

You can also press F1 to open the Command Palette and then remove the > via Backspace. Now you can search for files, too.

consider you have thousand of files in vs code and you want to search for a file with particular name then
Right click VS code editor.
Select Command Palete
In the text box type the file name

The problem with Ctrl+P (or Cmd+P) is that it searches your workspace while ignoring files and folders set in the .gitignore file. To change this behavior, add "search.useIgnoreFiles": false in your settings.json file under .vscode directory.
NOTE that search.exclude and files.exclude settings will override this. So, in your settings.json file, you should comment them out or set these two settings to false as well if you want to search all the files and directories in your VS Code project. An example for settings.json where search.exclude and files.exclude are commented out for searching all the files:
{
"search.exclude": {
//"**/Lib": true,
//"**/Scripts": true
},
"files.exclude": {
//"**/Lib": true,
//"**/Scripts": true
},
"search.useIgnoreFiles": false
}
Look here for more info.

I'm using VSCode 1.12.1
OSX press : Cmd + p

If you just want to search a single file name
Just Ctrl+P, then type and choose your one
If you want to open all files whose name contains a particular string
Open search panel
Put any common words inside those files
in 'files to include', put the search string with *, e.g. *Signaller*

For filtering in the tree on keyboard typing. The feature is deprecated. No more work.
No more of this old red inflexible box:
The replacement is way better and more interesting:
Actually not really. It could have been. The new way only filters on expanded folders only. And that's a shame. Check the last session for where the development is at. And for the options we are left with.
https://code.visualstudio.com/updates/v1_70#_tree-find-control
CMD + F (mac) or CTRL + F (else) [while focused]
No settings are needed. It just works. And more elegantly (except for the problem of only filtering searching through the visible expanded directories).
And for the default mode. highlight or filter. You can change that with:
"workbench.list.defaultFindMode": "highlight"
"workbench.list.defaultFindMode": "filter"
Only the open folders and visible elements Problem and what are we at?
It's great to know about this feature. But then you'll soon encounter the limitation it has at the moment.
Filtering only through open directories. It can help great. But then we want to filter through all. And when the project is big. That becomes totally unusable.
Issues: 1, 2, 3
We can see it's added to the backlog here:
https://github.com/microsoft/vscode/issues/116286
duplicates: 1
You may think:
Expand all
Ok what about expanding all. Then using this.
===> That would work great => But => There is no such a feature of expanding all now.
Issues: 1, 2, duplicates: 1
Some configuration
At the moment no configuration does help!
"workbench.list.keyboardNavigation": "filter"
doesn't and many others. I tried them all. For the moment!
Extension that do that probably using web view
None exists. And to be implemented one needs to figure out the indexation used by vscode. Or implement its own indexation and then fuzzy search through using indexes. Otherwise something more simple that works for no big directories. Can be built fast. [I don't have time to do it myself. Especially that this would be resolved sometime in the future and we still can work with CTRL|CMD + P]
So that to clear for you the thoughts that you may get. And save you time.
Resume
So shortly we may see the feature of filtering all in a future version of vscode as it was added to the backlog. Right now we will be waiting. And maybe long enough.
Expand all seems not to be coming at any time or any time soon.
So what now. Left with nothing? Here a WORKAROUND
The now is => use CTRL|CMD + F on visible things. or on folders. By manually expanding them.
Or use CTRL|CMD + P without closing it. By following the next rules:
To open multiple files in the same editor. Navigate up and down and for each file use Right Arrow.
When they open they will be opened beside each other. You can use CMD|CTRL + ALT + LEFT | RIGHT to navigate between tabs left and right. Faster and better with the keyboard. The last open is the one you'll be at when you close the pallet.
To open a file in a new split editor use ALT + RIGHT ARROW.
Ref: 1

For windows.
if Ctrl+p doesn't always work
use Ctrl+shift+n instead.

To search for specifil file types in visual studio code.
Type ctrl+p and then search for something like *.py.
Simple and easy

If using vscodevim extension, ctrl + p won't work so I saw another answer using:
ctrl + shift + p
which opens the command palette. Hit backspace to remove the '>' and then start typing your filename.

Check your settings for 'Use Ignore Files' and 'Use Global Ignore Files'.
If these are checked, VSCode won't search any folders listed in .gitignore or .ignore

With VSCode 1.75 (Jan 2023), you will have a new file filter option: a 'Fuzzy Match' toggle.
That comes from issue 116286: Tree: Support continuous find
In a list of files I can filter them by start typing the name of the file. It is a super useful feature when you have hundreds+ files.
My issue is that the filter is trying to find the letters in the whole file name.
Here is an example search for word "file":
this-is-**file**-i-looked-for.jpeg (I expect this to be returned)
**f**or-th**i**s-**l**.jp**e**g (This should not be returned, it is only a random match)
Would it be possible to add there extra settings to only returns full strings matches? Or is there some setting already buried somewhere?
Solution: adding a 'Fuzzy Match' toggle button to the tree find widget.
New options:
defaultFindMatchTypeSettingKey.fuzzy: Use fuzzy matching when searching.
defaultFindMatchTypeSettingKey.contiguous': Use contiguous matching when searching.

I ended up installing the extension File Name Search. It displays in the side navigation bar all files that match a name part, so I can open them one by one to check them or process them.
Ctrl + p: we have to repeat the search for each file
Ctrl + f in the
explorer: it does not search, it just filters files in epanded
folders
Here is a demo of a search in explorer followed by a search in the Filename search extension:

Related

How to search for text in all files in a directory?

Is there a way to search for text in all files in a directory using VS Code?
I.e., if I type find this in my search, it will search through all the files in the current directory and return the files that matched.
You can do Edit, Find in Files (or Ctrl+Shift+F - default key binding, Cmd+Shift+F on MacOS) to search the Currently open Folder.
There is an ellipsis on the dialog where you can include/exclude files, and options in the search box for matching case/word and using Regex.
In VS Code...
Go to Explorer (Ctrl + Shift + E)
Right click on your favorite folder
Select "Find in folder" (Alt + Shift + F)
The search query will be prefilled with the path under "files to include".
Press Ctrl + Shift + F
Click on 3 dots under search box.
Type your query in search box
Type ./FOLDERNAME in files to include box and click Enter
Alternative way to this is, Right click on folder and select Find in Folder
What is NOT so obvious is that you can use the following pattern to recursively search
./src/**/*.html
so perhaps leave the following as the default for most of your typical searches to remind that there is such a thing
./src/**/
For example I was after an attribute for left-right justify/docking content, I could not remember except "start" so I did the following search which reveals to me "item-start"
This fixed my layout to
Instead of
Here is where "item-sart" goes in the template.
Ctrl + P (Win, Linux), Cmd + P (Mac) – Quick open, Go to file
I think these official guide should work for your case.
VS Code allows you to quickly search over all files in the
currently-opened folder. Press Ctrl+Shift+F and enter in your search
term. Search results are grouped into files containing the search
term, with an indication of the hits in each file and its location.
Expand a file to see a preview of all of the hits within that file.
Then single-click on one of the hits to view it in the editor.
A simple answer is to click the magnifying glass on the left side bar
This action is not bound to a key by default, to bind it do this:
File > Preferences > Keyboard Shortcuts (Ctrl+K, Ctrl+S)
Search for "find folder"
Press the + icon on the left of "filesExplorer.findInFolder" search result
Enter your desired key combination
To add to the above, if you want to search within the selected folder, right click on the folder and click "Find in Folder" or default key binding:
Alt+Shift+F
As already mentioned, to search all folders in your project, click Edit > "Find in Files" or:
Ctrl+Shift+F
VS Code Default Actions
#
Command
Shortcut
Command ID
1.
View: Show Explorer
CTRL+SHIFT+E
workbench.view.explorer
2.
Focus current directory
← (Left arrow)
3.
Right-click / Find in Folder...
ALT+SHIFT+F
filesExplorer.findInFolder
Suggestion
The default commands are too slow, even when using keyboard shortcuts (it takes seven key presses).
First, let's get rid of the left arrow press. By default, the filesExplorer.findInFolder command requires a folder to be focused. However, it works perfectly with a file - by searching its parent folder.
Preferences: Open Keyboard Shortcuts (CTRL+K, CTRL+S)
Search for the filesExplorer.findInFolder command.
Right-click / Change When Expression (CTRL+K, CTRL+E)
Remove the explorerResourceIsFolder requirement from When Expression. The result should be: explorerViewletVisible && filesExplorerFocus && !inputFocus
Now, the Find in Folder command works on files too, so the shortcut combo is down by one key. The next is ALT+SHIFT+F, which is annoying for two reasons:
You have to remember when to press CTRL but when ALT, and it is easy to mess up.
Some extensions use ALT+SHIFT+F for code auto-formatting - and I doubt that this a side effect you wish.
That's why I suggest changing the shortcut to CTRL+SHIFT+F with some When Expression magic:
Preferences: Open Keyboard Shortcuts (CTRL+K, CTRL+S)
Search for workbench.action.findInFiles and set its When Expression to !filesExplorerFocus
Search again for filesExplorer.findInFolder and change its keybinding to CTRL+SHIFT+F
Result
CTRL+SHIFT+F triggers "Find in Folder" when File Explorer is focused, and the default "Find in Files" elsewhere.
You have to press either CTRL+SHIFT+F to "Find in Files", or CTRL+SHIFT+E, CTRL+SHIFT+F to "Find in Folder". Easy to remember. Moreover, the latter can be optimized by keeping CTRL+SHIFT pressed while pressing E, then F
User Config
{
"key": "ctrl+shift+f",
"command": "workbench.action.findInFiles",
"when": "!filesExplorerFocus"
},
{
"key": "ctrl+shift+f",
"command": "filesExplorer.findInFolder",
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
}
Warning
The filesExplorer.findInFolder command overwrites the "files to include" field. For example, you could have a file search pattern *.c,*.cpp,*.h,*.hpp, which is now overwritten by the folder path. But you can always press ↑ (UpArrow) in the field to cycle through the history and restore the previous pattern.
And by the way for you fellow googlers for selecting multiple folders in the search input you separate your directories with a comma. Works both for exclude and include
Example: ./src/public/,src/components/
If you have a directory open in VSCode, and want to search a subdirectory, then either:
ctrl-shift-F then in the files to include field enter the path with a leading ./,
or
ctrl-shift-E to open the Explorer, right click the directory you want to search, and select the Find in Folder... option.
Enter Search Keyword in search (CTRL + SHIFT + F)
Exclude unwanted folder's/files by using exclude option (!)
ex: !Folder/File*
Hit Enter
Search results gives you desired result
There is another option starting with VSCode version 1.73 (Oct. 2022)
Add "Find in Folder" to context menu in Search Tree
Implemented by PR 163597
In order to search only in one folder, you have to click on it and press Alt + Shift + F.
When you use Ctrl, VS Code looks in all project.
Be very aware that if you click on the 'book' icon to the right of the 'files to include' field, that it will toggle between searching all files in the 'files to include' field and searching only files in opened editors (matching the 'files to include' field).
This may only be obvious if you know to read the text at the bottom of the search dialog, which will change between something like the following, as you toggle the book icon:
No results found in './project_dir/sub_dir' - Search again in all files - Learn More
and this:
No results found in open editors matching './project_dir/sub_dir' - Search again in all files - Learn More
This can really mess you up if you think that you have found all occurrences of something, but you are only looking at all occurrences in the opened files.
Select your folder,
Press ⌥ + ⇧ + F
Don't know about windows but this works for mac :)
Search across files - Press Ctrl+Shift+F
Find - Press Ctrl+F
Find and Replace - Ctrl+H
For basic editing options follow this link - https://code.visualstudio.com/docs/editor/codebasics
Note : For mac the Ctrl represents the command button
Just in case you wanted to use PowerShell to search for and then open all text files in your current directory:
foreach($file in $(dir -recurse -include *.txt))
{
code $file
}
You could also be a little more specific or even change the file type:
foreach($file in $(dir <specificDir> -recurse -include *.<anyExtension>))
{
code $file
}
If you want to search your current directory/project directory, but not a single directory, just type * in the "files to include" on the search tab. (* meaning all files)
Also it's worth to note when you have the "search.exclude" config having some directories this config is more prioritized than the search. Thus if I have node_modules in the "search.exclude", even * does not show files inside ./node_modules, so if you want to explicitly include search-excluded dirs create a local settings.json in ./vscode and overwrite the config.

How do I search for files in Visual Studio Code?

I am used to Resharper where I can search for files, not the content, but the filename, which makes it quick to open new files.
Is this feature implemented in Visual Studio Code and is there a shortcut for it?
Using Go to File... which is under the Go menu or using keyboard shortcut:
On Windows Ctrl+p or Ctrl+e
On macOS Cmd ⌘+p
On Linux Ctrl+p or Ctrl+e
Then type the file name.
Also be sure to checkout that you can set your own keybindings and that there are cheatsheets available for Windows, macOS and Linux.
Since the 1.70.0 release in July 2022, you can find and filter in tree views such as the Find Explorer. You can press Ctrl+F inside trees to pop up the Find control.
Before the 1.70.0 release
when you click anywhere in the explorer tree, and start typing something on the keyboard, the search keyword appears in the top right corner of the screen : ("module.ts")
And when you hover over the keyword with the mouse cursor, you can click on "Enable Filter on Type" to filter tree with your search !
On OSX, for me it's cmd ⌘ + p. cmd ⌘ + e just searches within the currently opened file.
Method1
Go->Go to File OR cntrl+p
Search your file
Method2
view->command palette OR cntrl+shift+p
type "Go to file"
Search your file
Win: CTRL+P or CTRL+E
Mac: CMD+P or CMD+E
Don't want to remember another shortcut?
Open the Command Palette:
Menu: View -> Command Palette
Windows Shortcut: Ctrl+Shift+P
and hit backspace to delete ">" character and then begin typing to search for files via filename. :)
Other answers don't mention this command is named workbench.action.quickOpen.
You can use this to search the Keyboard Shortcuts menu located in Preferences.
On MacOS the default keybinding is cmd ⌘ + P.
(Coming from Sublime Text, I always change this to cmd ⌘ + T)
Also works in ubuntu with Ctrl+E
You can also press F1 to open the Command Palette and then remove the > via Backspace. Now you can search for files, too.
consider you have thousand of files in vs code and you want to search for a file with particular name then
Right click VS code editor.
Select Command Palete
In the text box type the file name
The problem with Ctrl+P (or Cmd+P) is that it searches your workspace while ignoring files and folders set in the .gitignore file. To change this behavior, add "search.useIgnoreFiles": false in your settings.json file under .vscode directory.
NOTE that search.exclude and files.exclude settings will override this. So, in your settings.json file, you should comment them out or set these two settings to false as well if you want to search all the files and directories in your VS Code project. An example for settings.json where search.exclude and files.exclude are commented out for searching all the files:
{
"search.exclude": {
//"**/Lib": true,
//"**/Scripts": true
},
"files.exclude": {
//"**/Lib": true,
//"**/Scripts": true
},
"search.useIgnoreFiles": false
}
Look here for more info.
I'm using VSCode 1.12.1
OSX press : Cmd + p
If you just want to search a single file name
Just Ctrl+P, then type and choose your one
If you want to open all files whose name contains a particular string
Open search panel
Put any common words inside those files
in 'files to include', put the search string with *, e.g. *Signaller*
For filtering in the tree on keyboard typing. The feature is deprecated. No more work.
No more of this old red inflexible box:
The replacement is way better and more interesting:
Actually not really. It could have been. The new way only filters on expanded folders only. And that's a shame. Check the last session for where the development is at. And for the options we are left with.
https://code.visualstudio.com/updates/v1_70#_tree-find-control
CMD + F (mac) or CTRL + F (else) [while focused]
No settings are needed. It just works. And more elegantly (except for the problem of only filtering searching through the visible expanded directories).
And for the default mode. highlight or filter. You can change that with:
"workbench.list.defaultFindMode": "highlight"
"workbench.list.defaultFindMode": "filter"
Only the open folders and visible elements Problem and what are we at?
It's great to know about this feature. But then you'll soon encounter the limitation it has at the moment.
Filtering only through open directories. It can help great. But then we want to filter through all. And when the project is big. That becomes totally unusable.
Issues: 1, 2, 3
We can see it's added to the backlog here:
https://github.com/microsoft/vscode/issues/116286
duplicates: 1
You may think:
Expand all
Ok what about expanding all. Then using this.
===> That would work great => But => There is no such a feature of expanding all now.
Issues: 1, 2, duplicates: 1
Some configuration
At the moment no configuration does help!
"workbench.list.keyboardNavigation": "filter"
doesn't and many others. I tried them all. For the moment!
Extension that do that probably using web view
None exists. And to be implemented one needs to figure out the indexation used by vscode. Or implement its own indexation and then fuzzy search through using indexes. Otherwise something more simple that works for no big directories. Can be built fast. [I don't have time to do it myself. Especially that this would be resolved sometime in the future and we still can work with CTRL|CMD + P]
So that to clear for you the thoughts that you may get. And save you time.
Resume
So shortly we may see the feature of filtering all in a future version of vscode as it was added to the backlog. Right now we will be waiting. And maybe long enough.
Expand all seems not to be coming at any time or any time soon.
So what now. Left with nothing? Here a WORKAROUND
The now is => use CTRL|CMD + F on visible things. or on folders. By manually expanding them.
Or use CTRL|CMD + P without closing it. By following the next rules:
To open multiple files in the same editor. Navigate up and down and for each file use Right Arrow.
When they open they will be opened beside each other. You can use CMD|CTRL + ALT + LEFT | RIGHT to navigate between tabs left and right. Faster and better with the keyboard. The last open is the one you'll be at when you close the pallet.
To open a file in a new split editor use ALT + RIGHT ARROW.
Ref: 1
For windows.
if Ctrl+p doesn't always work
use Ctrl+shift+n instead.
To search for specifil file types in visual studio code.
Type ctrl+p and then search for something like *.py.
Simple and easy
If using vscodevim extension, ctrl + p won't work so I saw another answer using:
ctrl + shift + p
which opens the command palette. Hit backspace to remove the '>' and then start typing your filename.
Check your settings for 'Use Ignore Files' and 'Use Global Ignore Files'.
If these are checked, VSCode won't search any folders listed in .gitignore or .ignore
With VSCode 1.75 (Jan 2023), you will have a new file filter option: a 'Fuzzy Match' toggle.
That comes from issue 116286: Tree: Support continuous find
In a list of files I can filter them by start typing the name of the file. It is a super useful feature when you have hundreds+ files.
My issue is that the filter is trying to find the letters in the whole file name.
Here is an example search for word "file":
this-is-**file**-i-looked-for.jpeg (I expect this to be returned)
**f**or-th**i**s-**l**.jp**e**g (This should not be returned, it is only a random match)
Would it be possible to add there extra settings to only returns full strings matches? Or is there some setting already buried somewhere?
Solution: adding a 'Fuzzy Match' toggle button to the tree find widget.
New options:
defaultFindMatchTypeSettingKey.fuzzy: Use fuzzy matching when searching.
defaultFindMatchTypeSettingKey.contiguous': Use contiguous matching when searching.
I ended up installing the extension File Name Search. It displays in the side navigation bar all files that match a name part, so I can open them one by one to check them or process them.
Ctrl + p: we have to repeat the search for each file
Ctrl + f in the
explorer: it does not search, it just filters files in epanded
folders
Here is a demo of a search in explorer followed by a search in the Filename search extension:

How can you create multiple cursors in Visual Studio Code

What are the keyboard shortcuts for creating multiple cursors in VS Code?
Press Alt and click. This works on Windows and Linux*, and it should work on Mac, too.
More multi-cursor features are now available in Visual Studio Code 0.2:
Multi cursor improvements
Ctrl+D (Cmd+D on Mac) selects next occurrence of word under cursor or of the current selection
Ctrl+K Ctrl+D moves last added cursor to next occurrence of word under cursor or of the current selection
The commands use matchCase by default. If the find widget is open, then the find widget settings (matchCase / matchWholeWord) will be used for determining the next occurrence
Ctrl+U (Cmd+U on Mac) undoes the last cursor action, so if you added a cursor too many or made a mistake, you can press Ctrl+U (Cmd+U on Mac) to go back to the previous cursor state.
Adding cursor up or down (Ctrl+Alt+Up / Ctrl+Alt+Down) (Cmd+Alt+Up / Cmd+Alt+Down on Mac) now reveals the last added cursor to make it easier to work with multiple cursors on more than 1 viewport height at a time (i.e. select 300 lines and only 80 fit in the viewport).
This makes it a lot easier to introduce multiple cursors
* Linux drag-window conflict:
Some distros (e.g. Ubuntu) assign window dragging to Alt+LeftMouse, which will conflict with VSCode.
So, recent versions of VSCode let you toggle between Alt+LeftMouse and Ctrl+LeftMouse under the Selection menu, as detailed in another answer.
Alternately, you could change your OS key bindings using gsettings as mentioned in another answer.
Multi-word (and multi-line) cursors/selection in VS Code
Multi-word:
Windows / OS X:
Ctrl+Shift+L / ⌘+Shift+L selects all instances of the current highlighted word
Ctrl+D / ⌘+D selects the next instance... and the one after that... etc.
Multi-line:
For multi-line selection, Ctrl+Alt+Down / ⌘+Alt+Shift+Down will extend your selection or cursor position to the next line. Ctrl+Right / ⌘+Right will move to the end of each line, no matter how long. To escape the multi-line selection, hit Esc.
See the VS Code keybindings (OS sensitive)
May 2017
As of version 1.13
Add multiple cursors with Ctrl / Cmd + Click
VSCode developers have introduced a new setting, editor.multiCursorModifier, to change the modifier key for applying multiple cursors to Cmd + Click on macOS and Ctrl + Click on Windows and Linux. This lets users coming from other editors such as Sublime Text or Atom continue to use the keyboard modifier they are familiar with.
The setting can be set to:
ctrl/Cmd - Maps to Ctrl on Windows and Cmd on macOS.
alt - The existing default Alt.
There's also a new menu item Use Ctrl + Click for Multi-Cursor in the Selection menu to quickly toggle this setting.
The Go To Definition and Open Link gestures will also respect this setting and adapt such that they do not conflict. For example, when the setting is ctrl/Cmd, multiple cursors can be added with Ctrl / Cmd + Click, and opening links or going to definition can be invoked with Alt +Click.
With fixing Issue #2106, it is now possible to also remove a cursor by using the same gesture on top of an existing selection.
I had problem with ALT key, fix is to change alt+click as a Gnome hotkey which clobbers multi-cursor select in VSCode, to super+click by running:
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
Source: http://2buntu.com/articles/1529/visual-studio-code-comes-to-linux/
Try Ctrl+Alt+Shift+⬇ / ⬆, without mouse, or hold "alt" and click on all the lines you want.
Note: Tested on Windows.
Cmd+Option+Shift⬇ / ⬆ works for me on newest VSCode 1.29.1 and newest OSX High Sierra 10.13.6, Macbook Pro.
This adds a vertical line up/down on screen, like Option+Click/Vertical Drag does in Sublime Text.
To add multiple cursors at any points in your file, including multiple ones on the same line, do Cmd (or Option)+Click anywhere you want, shown in this video. You may also search for text (Cmd+F) that repeats multiple times, then press Option+Return to add cursors at end of EACH word.
On XFCE, go to Applications -> Settings -> Settings editor - > xfwm4 -> easy_click(disable value)
Now you can Insert Cursor with Alt + Click
I've also disabled L/R Workspace (ctrl + alt + L/R) settings in Settings -> Window manager -> Keyboard
As of Visual Studio Code version 0.10.9, you can now do a Create Multiple Cursors from Selected Lines by selecting multiple lines, and pressing Shift+Alt+I
Note: This is similar to Sublime Text's Ctrl+Shift+L functionality.
Source: https://code.visualstudio.com/updates/vJanuary#_thank-you
Relevant PR: https://github.com/Microsoft/vscode/pull/1479
On Ubuntu, in order to enable multi-cursor clicking you will need to re-assign Alt+click first, by running the command below. This is because by default Ubuntu uses the shortcut itself and has it takes precedence.
> gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
There is no binding for exactly what you want.
The only thing that comes close is Ctrl+F2 which will select all of them at once.
You can bind it to Ctrl+D doing the following:
Click on File > Preferences > Keyboard Shortcuts
You should see a pane full of the current bindings and on the right a list of custom bindings
In the current bindings, search for Ctrl+F2 and copy that whole line and paste it into the right pane.
You might have to remove the comma at the end and then change Ctrl+F2 to Ctrl+D and then save the file.
It should look something like this:
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+d", "command": "editor.action.changeAll",
"when": "editorTextFocus" }
]
Ctrl+Alt+⬇ / ⬆ add cursors above and below the current line. Still nowhere near as good as sublime or brackets though. I can't see anything equivalent to Ctrl+D in sublime in the keyboard shortcuts file.
https://code.visualstudio.com/Updates
New version (Visual Studio 0.3.0) support more multi cursor feature.
Multi-cursor
Here's multi-cursor improvements that we've made.
⌘D selects the word at the cursor, or the next occurrence of the current selection.
⌘K ⌘D moves the last added cursor to next occurrence of the current selection.
The two actions pick up the matchCase and matchWholeWord settings of the find widget.
⌘U undoes the last cursor action, so if you added one cursor too many or made a mistake, press ⌘U to return to the previous cursor state.
Insert cursor above (⌥⌘↑) and insert cursor below (⌥⌘↓) now reveals the last added cursor, making it easier to work with multi-cursors spanning more than one screen height (i.e., working with 300 lines while only 80 fit in the screen).
And short cut of select multi cursor change into cmd + d(it's same as Sublime Text. lol)
We can expect that next version supports more convenient feature about multi cursor ;)
Alt+Click. It works in Windows.
Details: Visual Studio Code Documentation
In my XFCE (version 4.12), it's in Settings -> Window Manager Tweaks -> Accessibility.
There's a dropdown field Key used to grab and move windows:, set this to None.
Alt + Click works now in VS Code to add more cursor.
In Visual Studio without mouse: Alt+Shift+{ Arrow }.
You can do the following per the Selection menu:
Press/hold Alt+Ctrl+Up Arrow/Alt+Ctrl+Down Arrow as required to create sufficient cursors, then Ctrl+D can be used to expand the selections.
Same issue on Ubuntu-MATE, but here you resolve it by:
gsettings set org.mate.Marco.general mouse-button-modifier "<Super>"
Alt + Command + Shift will add a cursor to the next instance of what you've selected. E.g. a variable or function name
For xfce users, just go to settings>window manager tweaks>accessibility there change the key used to grab and move windows: to super as demonstrated in the image below.
Now you can use super instead of alt. Wallah!! Go make multiple cursors by alt + click.
First go to "Keyboard Shortcuts", you can get there by hitting Cmd+k then Cmd+s, or for Windows Ctrl+k then Ctrl+s.
Once you're there, search for "Add Cursor Above" and "Add Cursor Below". You can even assign them your own key-bindings.
On windows:
CTRL+Click if you are using vscode
CTRL+Alt+Click if you are using visual studio
For Ubuntu Users
ALT + SHIFT + ⬇ / ⬆
Alt + Click works in OSX. Code Version 1.14.2

Eclipse jump to next/previous marked occurrence

As was asked previously, Eclipse has the nice "mark occurences" feature, which shows all occurences of the selected variable or method.
But I don't know any shortcut for jumping to the next/previous occurence in the editor.
The shortcut ctrl+k is not working, it solely works in conjunction with "incremental find" (ctrl+j).
I'm using Eclipse Indigo. Is there any shortcut or other solution?
Edit:
The answers and comments in the question linked above are now pretty exhaustive, I think.
It seems there is no all-in-one solution (at least for Java code editing):
I cant get Ctrl + (period) to work, at least in Java code where it finds the next problem. Even rebinding this to a different shortcut does not work.
Ctrl + K does text-based search only. If you want to find all occurrences of the variable i, it finds any letter i within any identifier and comment.
Renaming mode using Alt+Shift+R and then navigating through the occurrences using Tab and Shift+Tab comes close, but only works for identifiers you can actually rename for that source file. It does not work for library code (esp. JDK) for which no editable source is available.
Try Ctrl + , and Ctrl + .
Before that make sure you have checked Occurences in the small navigation dropdown:
You can change the key from Window -> Preferences -> keys:
It works for me.
You can find if your key bindings have changed by looking under Window -> Preferences -> General -> Keys and look for the command Find Next. You will see the binding in the column Binding and can also check if it's conflicting with something else in the list titled Conflicts: at bottom right corner of the dialog.

Does a "Find in project..." feature exist in Eclipse IDE?

Does Eclipse have a way to search a whole project for some text like Xcode's "find in project" feature?
1. Ctrl + H
2. Choose File Search for plain text search in workspace/selected projects
For specific expression searches, choose the relevant tab (such as Java Search which allows you to search for specific identifiers)
For whole project search:
3. Scope (in the form section) > Enclosing project (Radio button selection).
Ctrl + Alt + G can be used to find selected text across a workspace in eclipse.
OSX: ⌥ Option + ⌘ Command + G
Press Ctrl + H to bring up the search that includes options to search via project, directory, etc.
Ctrl+H.
Also,
Open any file quickly without browsing for it in the Package
Explorer: Ctrl + Shift + R.
Open a type (e.g.: a class, an interface) without clicking through
interminable list of packages: Ctrl + Shift + T.
Go directly to a member (method, variable) of a huge class file,
especially when a lot of methods are named similarly: Ctrl + O
Go to line number N in the source file: Ctrl + L, enter line number.
Ctrl + H is the best way!
Remember to copy the string before you start searching!
You should check out the new Eclipse 2019-09 4.13 Quick Search feature
The new Quick Search dialog provides a convenient, simple and fast way to run a textual search across your workspace and jump to matches in your code.
The dialog provides a quick overview showing matching lines of text at a glance.
It updates as quickly as you can type and allows for quick navigation using only the keyboard.
A typical workflow starts by pressing the keyboard shortcut Ctrl+Alt+Shift+L
(or Cmd+Alt+Shift+L on Mac).
Typing a few letters updates the search result as you type.
Use Up-Down arrow keys to select a match, then hit Enter to open it in an editor.
CTRL + H is actually the right answer, but the scope in which it was pressed is actually pretty important.
When you have last clicked on file you're working on, you'll get a different search window - Java Search:
Whereas when you select directory on Package Explorer and then press Ctrl + H (or choose Search -> File.. from main menu), you get the desired window - File Search:
yes, but you need to open the global search panel. to do so, press the binoculars icon on the top right corner of the IDE.
you can even filter searches by function identifiers, method scopes an etc...
Choose File Search for plain text search in workspace/selected projects
For specific expression searches, choose the relevant tab (such as Java Search which allows to search for specific identifiers)
First customize your search dialog. Ctrl+H. Click on the Customize button and select inly File Search while deselecting all the others. Close the dialog.
Now you can search by selecting the word and hitting the Ctrl+H and then Enter.
yes, but you need to open the global search panel.
to do so, press the binoculars icon on the top right corner of the IDE.
you can even filter searches by function identifiers, method scopes an etc...
There is no way to do pure text search in whole work workspace/project via a shortcut that I know of (and it is a PITA), but this will find references in the workspace:
Put your cursor on what you want to lookup
Press Ctrl + Shift + g
There is very nice tool "Eclipse Quicksearch" available. Checkout SpringSource Update Site for Eclipse i.e: http://dist.springsource.com/release/TOOLS/update/e4.6/ (you can try other versions replacing last part of URL with i.e. e4.4 or e4.5)
It works well with Neon Release (4.6.0). It gives you nice incremental text search with source file preview. I had no issues with it so far.
Usage:
Alt + s "Quick Search Command" opens "Quick Text Search" dialog. You can select whether search should be case sensitive or not. Really good tool.
Ctrl+H is very handy here. I mostly search in the current project, not the whole workspace. To find all occurences in the whole project of a string that is in your current buffer, just select the string press Ctrl+H and hit enter. Easy as that!
Use Resource Filters!
Eclipse will restrict the search result using the Resource Filters defined for your project (eg. right click on you project name and select Properties -> Resource -> Resource Filters). So if you keep getting search hits from parts of your project that your not interested in you could make Eclipse skip those by adding a Resource Filter for them. This is especially useful if you have build files or logs or other temporary files that are part of your projects directory structure, but you only want to search amongst the source code. You should also be aware of that files/directories matched for exclusion in the Resource Filters will not show up in the Package Explorer either, so you might not always want this.
Search and Replace'
Ctrl + F Open find and replace dialog
Ctrl + F / Ctrl + Shift + K Find previous / find next occurrence of search term (close find window first).
Ctrl + H Search Workspace (Java Search, Task Search, and File Search).
Ctrl + J / Ctrl+Shift +J Incremental search forward / backwards.
Type search term after pressing Ctrl+J, there is now search window
Ctrl+shift+O Open a resource search dialog to find any class
What others have forgotten is Ctrl+Shift+L for easy text search. It searches everywhere and it is fast and efficient. This might be a Sprint tool suit which is an extension of eclipse (and it might be available in newer versions)