Related
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:
What's the keyboard shortcut for joining two lines in VS Code?
If the cursor is anywhere in the first line of
f(foo,
bar)
then when I hit the shortcut, I want to get
f(foo, bar)
Visual Studio Code now comes with a default key binding for joining lines, Ctrl + J.
You can find all keyboard shortcuts under Preferences > Open Keyboard Shortcuts.
You can overwrite it using the UI or by providing a different key combination for the command editor.action.joinLines in keybindings.json.
Press F1, and type Join Lines. By default there is no key bindings to it yet, but you can easily set it under 'Preferences > Keyboard Shortcuts', then search for Join Lines and set a shortcut.
You can simply:
Select the lines to be joined.
Hit Ctrl+Shift+P or F1.
Type join lines.
Since the best way is already answered I'm just adding an alternative.
If you want to work with defaults you can hit Ctrl+Del while caret is at the end of the first line.
Works with multi-select too if you want to join multiple lines.
Depending on how much clutter you have in your , try the following "keypress sequence" (you must have focus in an open editor tab for this to work1, and make sure to have your cursor/lines selected before doing this):
Ctrl+Shift+P JL 2
If your Command Palette ends up showing a clash of non-Join Lines entries when you finish typing, you may have to end up typing instead3:
Ctrl+Shift+P JOINSpace L
Ctrl+Shift+P JOINSpace LI
...
Ctrl+Shift+P JOINSpace LINES
...Manually select from the Palette using down arrow or mouse 4
In case you're thinking about setting your own keybind (since it is unset by default in Windows), here are the other Commands that have a keybind associated with them containing a J 5:
Command
Keybinding
When
workbench.action.search.toggleQueryDetails
Ctrl+Shift+J
inSearchEditor || searchViewletFocus
View: Toggle Panel
Ctrl+J
---
Unfold All
Ctrl+K Ctrl+J
editorTextFocus && foldingEnabled
Notebook: Join With Previous Cell
Shift+Alt+Win+J
notebookEditorFocused
Notebook: Join With Next Cell
Alt+Win+J
editorTextFocus && foldingEnabled
I suggest using Ctrl+Alt+J or Ctrl+Shift+Alt+Jif you end up going this route, since it doesn't seem to clash with existing defaults and is similar to what people are already used to.
Alternatively, if you tend to use a different text editor or IDE,
[File > Preferences > Keymaps] (Ctrl+K Ctrl+M) offers a selection of alternative keymaps (these are extensions, which must be installed), including (as of now, sorted by current rating):
IntelliJ IDEA (by Keisuke Kato)
Sublime Text (by Microsoft)
Atom (by Microsoft)
Eclipse (by Alphabot Security)
Visual Studio (by Microsoft)
Delphi (by Alessandro Fragnani)
Notepad++ (by Microsoft)
Vim (by vscodevim)
Emacs (by hirosun)
1 In other words, don't be in a "non-editor" window like Settings or Keyboard Shortcuts
2 Alternatively, Command Palette can also be opened by selecting [View > Command Palette...] instead of Ctrl+Shift+P
3 This could occur due to having 3rd-party Commands containing the letters j and l. Command Palette can also be found alternatively by selecting [View > Command Palette...]
4 Hopefully you don't end up with this case.
5 These are all listed under [File > Preferences > Keyboard Shortcuts] (Ctrl+K Ctrl+S)
How do I discover Elm's REPL in VS Code?
Specifically, I have no clue how to get up and running with Elm and VS Code.
My past experience involves using F# and Visual Studio.
How do I send instructions to Elm's REPL?
Where is Elm's REPL located within VS Code's IDE?
Any suggestions?
Once you've installed the Elm package, you can use the Elm: REPL - Start command to start a REPL session.
(You access this command the same way as you access other commands in VS Code: by opening the Command Palette. This can be done through the View menu (View -> Command Palette) or with a keyboard shortcut (Ctrl + Shift + P or Cmd + Shift + P, depending on whether you use Windows or Mac).
Once the session has started, you can send lines or selections to the REPL. Type a line into your editor, then run the Elm: REPL - Send Line command to send it to the REPL. There is a default keyboard shortcut for this (Alt + /) as well.
If you want to send more than a line, highlight the thing you'd like to send (probably a function or value definition), and run the Elm: REPL - Send Selection command. Again, there's a keyboard shortcut: Alt + Enter.
Note that the REPL does not support type annotations; sending type annotations to the REPL will result in an error. You can still annotate your function and value definitions in your code, but when you highlight the definitions to send to the REPL, just make sure not to highlight the type annotations.
If you're just looking to play around in the Elm repl, just do this:
1) install Elm globally (using npm, or using an installer from elm-lang.org)
2) open VS Code, then press CTRL + ` (or Cmd + ` on a Mac); this opens VS Code's built-in terminal
3) type elm-repl -- this starts elm's repl, and you can try out snippets, etc
However since your real question is about getting up and running w/ Elm in VS Code, here's a start:
1) download/install elm-format from https://github.com/avh4/elm-format
2) install VS Code
3) install VS Code extension "elm" (it's by a Sascha Brink); add "elm.formatOnSave": true to your VS Code settings
Now when you create/edit a .elm file you'll get code coloring, etc.
If your Elm code is for an app (as opposed to repl snippets), you'll want to see results in elm-reactor. So start a VS Code terminal (see above), type elm-reactor, and your app should be served at http://localhost:8000
In short; You don't want to use vscode (yet) for Elm development. Either go with Atom (Elmjutsu) or IntelliJ (CE works fine with the elm-plugin).
You get support for refactoring and fast navigation. The reason I don't recommend using vscode is because the elm-plugin is underdeveloped.
Unfortunately, the elm-plugin with IntelliJ also is a little underdeveloped, since it does not underline-highlight errors in your sourcecode – so tracking errors does have a cognitive tax.
I know that this question is related to the elm-repl and the possibility to send your selection to the repl is a nice one. But it only saves you two shortcuts (copy selection, send to repl vs copy selection, alt-tab to repl, paste and enter). The way lines are formatted (in elm-format) renders send-single-line as mostly a not-properly-thougth-through feature.
What I do is open a terminal and open elm-repl there, and I split my screen so I always have the output available.
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:
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