Cut line shortcut in Visual Studio Code (Ctrl+L in VS) (not delete line!) - visual-studio-code

Visual Studio has by default the shortcut Ctrl+l (cut line). It copies the line where the cursor is to the clipboard and deletes it.
I cannot find it in Visual Studio Code. Is there a way to add it as end user?
(I know there is Ctrl+Shift+K for delete line, which is not the same)

What you are looking for is the Cut command:
editor.action.clipboardCutAction
It cuts (copies to the clipboard then deletes the line) either a selection or the entire line if nothing is selected.
I tested it with vscode 1.23.1
On windows this command is bound to Ctrl + X as well as to Shift + Delete by default.
Command works this way when Editor: Empty Selection Clipboard preference is enabled. It is enabled by default:
"editor.emptySelectionClipboard": true

I was a able to get the same functionality (i.e., mimicking Sublime Text's 'cut selection' functionality) by doing the following:
Added the 'macros' extension by geddski:
Added the following entries to my settings.json file (ctrl+shift+p, "Preferences: Open Settings (JSON)")
"macros": {
"cutLines": [
"expandLineSelection",
"editor.action.clipboardCutAction"
]
}
Added the following to my settings json file (ctrl+shift+p, "Preferences: Open Keyboard Shortcuts"):
{
"key": "ctrl+x",
"command": "macros.cutLines",
"when": "!editorHasSelection"
},
To get VS Code to recognize the command I had to add uninstall and reinstall the "macros" extension. I presume adding the entries and then installing it for the first time would produce the same result.
For debugging purposes, here is a screenshot of my keybindings for "Ctrl+x" when I had everything working the way I wanted. Compare yours by typing "Open Keyboard Shortcuts" into the command prompt and searching for "Ctrl+x".

Shift + Delete on VS Code cuts the line i.e. copies the line to the clipboard and deletes it.
I am running VS Code on Ubuntu 18.
Edit:
Ctrl + X also works the same way.

Related

Visual Studio Code command for "repeat last command"

Is there a command which does "repeat last command"? If not, how can I set up such a thing?
Basically what I want is to press some shortcut, and for it to repeat whatever the last command was, so I don't have to find it again in the menu or the ctrl-shift-p box.
You can press Ctrl + Shift + P, then Enter it also repeat the lastest command.
Take a look:
If you are specifically looking to rerun the last shell command, see Make a keybinding to run previous or last shell commands
Older answer (see above)
So this is a little funky because for the workbench.action.acceptSelectedQuickOpenItem command to work, the command palette must be open. So it will flash open briefly whenever you use the macro keybinding.
Using the macrosRe extension:
"macros": {
"rerunCommand": [
"workbench.action.showCommands",
"workbench.action.acceptSelectedQuickOpenItem"
]
}
I assume you have "workbench.commandPalette.history": 50, set to at least one so that the most recently used command is at the top of the command palette. [I think that setting always puts the last command at the top and selects it.]
And then some keybinding:
{
"key": "ctrl+;",
"command": "macros.rerunCommand"
},
On Mac simple Ctrl-P repeats the last command on the terminal. Looks like they updated it!
If you are specifically looking to rerun the last shell command, see Ctrl-R, with Make a keybinding to run previous or last shell commands
Actually, with VSCode 1.70 (July 2022), Ctrl-R is no longer limited to running the last command.
See issue 154306 "Add context key for run recent command open"
The views picker (Ctrl-q) lets you hit Ctrl-q again to go down the list:
{ "key": "ctrl+q",
"command": >"workbench.action.quickOpenNavigateNextInViewPicker",
"when": "inQuickOpen && inViewsPicker"
},
This is behavior we could copy in the run recent command to make it act even more like Ctrl-R in the shell
This is implemented in PR 154552 and released in VSCode Insiders.
You now have the possibility to associate to your key shortcut a
"when": "InTerminalRunCommandPicker"
And with VSCode 1.71 (Aug. 2022):
allow recent commands to be pinned
From issue 154388: Allow pinning of commands in Run recent command quickpick
From
To:
This is released in VSCode Insiders today.
VSCode 1.75 (Jan. 2023) implements "Commonly Used" list in the first-time-opened Command Palette (issue 169091), with PR 171293
It adds the setting:
workbench.commandPalette.experimental.suggestCommands
Controls whether the command palette should have a list of commonly used commands.
You can press Shift + Alt + Down arrow key it will repeat the latest command on windows VS code.

How can I clear the terminal in Visual Studio Code?

I need to clean the contents of the terminal in Visual Studio Code.
Every time I use Maven, the output of the terminal is attached to the previous build, which is confusing me.
How do I clear the terminal window with some command or keyboard shortcut?
cls doesn't work; it only hides the text.
Use Ctrl+K. This goes clean your console in Visual Studio Code.
Per comments, in later versions of VSCode (1.29 and above) this shortcut is missing / needs to be created manually.
Navigate: File > Preferences > Keyboard Shortcuts
search for workbench.action.terminal.clear
If it has no mapping or you wish to change the mapping, continue; otherwise note & use the existing mapping
Double click on this entry & you'll be prompted for a key binding. Hold CTRL and tap K. Ctrl + K should now be listed. Press enter to save this mapping
Right click the entry and select Change when expression. Type terminalFocus then press enter.
That's it. Now, when the terminal is in focus and you press Ctrl+K you'll get the behaviour you'd have expected to get from running clear/cls.
Ctrl + Shift + P and select Terminal:clear
FOR VERSIONS AT AND ABOVE v1.32 SEE BELOW
Bindings for this command still need to be setup manually, even at v1.33.1, which I am at. The command is there under Terminal: Clear but the binding is blank. Here is how you can setup bindings in v1.32 and up.
Open up the Keyboard Shortcuts with Ctrl+K, Ctrl+S. Then click on the {} next to the Keyboard Shortcuts tab to open up the keybindings.json file.
After doing so, find some open space anywhere in the file, and type in the key bind below.
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
FOR VERSIONS UP TO v1.32 SEE BELOW
This is for Visual Studio Code v1.18 up to v1.32, I believe; I am on v1.29.1. Since apparently there are a whole lot of assumptions about the default bindings, here is how you set up a binding, then use it. Keep in mind this binding will completely delete all of the history in your terminal too.
Open up the Keyboard Shortcuts with Ctrl+K, Ctrl+S. Once you are in Keyboard Shortcuts, click on keybindings.json in the text that says ....open and edit keybindings.json. Then on the RIGHT side, in the keybindings.json, add this (make sure you put a comma before the first { if there are one or more bindings already):
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
FOR ALL VERSIONS
Remember, the "key": can be whatever binding you want. It doesn't HAVE to be Ctrl + K.
To use the keybinding, you must have focus in your terminal, and then do the binding.
To clear Terminal in VS Code simply press Ctrl + Shift + P key together this will open a command palette and type command Terminal: Clear. Also you will go to View in taskbar upper left corner of vs code and open Command pallete.
This will clear the terminal easily & work for any directory you have open in your terminal.
This is for Windows, also try if it works for Mac.
This is command is work in all VS code versions include latest version 1.52.1
Go to
File >Preferences >Keyboard shortcuts.
Search for "Terminal: clear"
By default no keyboard shortcut is assigned.
Just click on the Plus (+)icon in the banner and give the preferred
shortcut of your choice to clear the terminal.
I prefer to use ctrl+k as that shortcut is not assigned with any command.
2019 Update (Read in Full)
Shortcut
Mac: cmd + k
Windows: ctrl + k
TroubleShooting
If the shortcuts do not work for you, the most likely scenario is that either you or an extension you installed has added an open ended ctrl + k / cmd + k chord to another shortcut.
Open ended meaning, the shortcut does not have an explicit when clause that excludes terminal focus. There are two possible solutions here.
Solution 1:
If you added the shortcut, simply go to your keybindings.json file and add a when clause that does not include terminal focus. Example:
{
"key": "cmd+k cmd+c",
"command": "someCommandHere",
"when": "editorTextFocus",
}
Solution 2:
Alternatively, you can add the workbench.action.terminal.clear command to the very bottom of keybindings.json, ensuring it takes precedence over other shortcuts. It'd be wise to add a comment so you don't forget and later place new chords below it. Example:
// Keep this keybinding at very bottom of file to ensure terminal clearing.
{
"key": "cmd+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus",
}
For additional information, check out this GitHub issue.
For a MacBook, it might not be Cmd + K...
There's a long discussion for cases where Cmd + K wouldn't work.
In my case, I made a quick fix with
cmd+K +cmd+ K
Go to menu Preferences -> Key shortcuts -> Search ('clear'). Change it from a single K to a double K...
Use Ctrl+K to clear the terminal.
But this is not possible in Linux Visual Studio Code.
For Linux you can do like below:
Via the command palette: ctrl+shift+p, "tclear"
To add this in shortcuts, copy paste this in keybinding file:
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
V1.33 won't accept ctrl + k to clear terminal (Windows).
You need to enable manually by adding below code in your keybiniding.json, it will override the defaults.
In your VSCode, press ctrl + shift + p, search for keyboard and click on Open Keyboard Shortcuts to open the keybindings.json file.
Note: If you open the Default one, it will show the default settings, but as this file is read-only, you can't edit it manually.
Paste the following script in keybindings.json
{
"key": "ctr+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
Save the file.
Now your terminal will clear by crtl + k
To clear the terminal, using default keybindings on the newest version of VS-Code, you press CTRL-L.
You can use below to clear the screen in terminal:
cls;
or
clr
Right click on the terminal and select clear option (for ubuntu).
For mac just type clear
workbench.action.terminal.clear no longer works (at least for VS Code Insiders 1.54 on Mac)
The following is the way to now map CTRL+L yo the default console functionality.
{
"key": "ctrl+l",
"command": "workbench.action.terminal.sendSequence",
"args": {"text": "\u000c"},
"when": "terminalFocus"
}
If you're on a Mac, it's ⌘+k. :)
By default there is NO keybinding associated to clearing the terminal in VSCode. Therefore, one must add a NEW Keybinding by following the below steps:
Navigate: File --> Preferences --> Keyboard Shortcuts. (Or Ctrl + K and Ctrl + S together)
Type in the Search Bar on top: Terminal: Clear.
An entry with Command: Terminal:Clear will show up with the following VSCode command workbench.action.terminal.clear.
Right Click on it and press Change Keybinding. Then press Ctrl + K together and then Enter. It will be saved.
Right Click again and press Change When Expression. Just enter: terminalFocus. It will be saved.
Finally, open your integrated terminal and with focus inside the terminal, press Ctrl + K.
Navigate in VS code: File > Preferences > Keyboard Shortcuts
search for workbench.action.terminal.clear
Double click on this entry & you'll be prompted for key binding. Hold CTRL and tap L. Ctrl + L should now be listed. Press enter to save this mapping
That's it.
The accepted answer should be the following which was unmultimedio's comment to one of the answers above:
Cmd+K will work, you just need to set again in the Keyboard Shortcuts
the workbench.action.terminal.clear to Cmd+K, so it shows as Source:
User instead of Source: Default – unmultimedio Mar 12 '19 at 1:13
Just click the gear button on the left-bottom side on the VS code screen
then Search for "Terminal: clear"
By default no keyboard shortcut is assigned.
Just double click the Terminal: Clear
and give the preferred shortcut of your choice to clear the terminal.
Usually ctrl+k is used as that shortcut is not assigned with any command.
FYI: This method is the same as #SuRa but is a little simpler.
Btw: I use VS Code version 1.43.0
I am using Visual Studio Code 1.52.1 on windows 10 machine.'cls' or 'Clear' doesn't clear the terminal.
just write
exit
It will close the terminal and press
ctrl+shift+`
to open new terminal.
You can change from settings menu (at least from version 1.30.2 and above)...
On Mac, just hit Code > Preferences > Settings.
Then just search for "clear" and check Clear Previous Output.
The Code Runner extension has a setting "Clear previous output", which is what I need 95% of the time.
File > Preferences > Settings > (search for "output") > Code-runner: Clear previous output
The remaining few times I will disable the setting and use the "Clear output" button (top right of the output pane) to selectively clear accumulated output.
This is in Visual Studio Code 1.33.1 with Code Runner 0.9.8.
(Setting the keybinding for Ctrl+k did not work for me, presumably because some extension has defined "chords" beginning with Ctrl-k. But "Clear previous output" was actually a better option for me.)
Select Open Keyboard Shortcuts from command palette and put following to keyboard shortcuts file:
{
"key": "cmd+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
F1 key opens the shortcuts for me using windows 10. Then type Terminal and you see the clear option.
In kde's konsole there is an action called "clear scrollback". It not only clears the terminal as usual, but also deletes the previous lines, so that you cannot scroll back and be confused.
I found in vs codium you can open Settings, search for terminal. Then go to Debugging, Debug - Terminal - Clear Before Reusing.
Set checkbox there, and every time you start a new debugging, the terminal scrollback history will not bother you.
To permanently delete the previous commands, use this
Set-PSReadlineOption -HistoryNoDuplicates
Remove-Item (Get-PSReadlineOption).HistorySavePath
Alt-f7
paste this command -
Remove-Item (Get-PSReadlineOption).HistorySavePath
in your powershell and start new powershell and its found cleared
for further details check this link # https://www.shellhacks.com/clear-history-powershell/
I'm running the June 2020 update of Visual Studio Code. I was looking for a simple way to clear the history of Terminal output from a Python script. Killing the Terminal via clicking on the trash can icon on the upper right did what I needed, and my Conda environment automatically reactivated.
Try typing in 'cls', if that doesn't work, type 'Clear' capital C. No quotes for any. Hope this helps.
I am using Visual Studio Code 1.38.1 on windows 10 machine.
Tried the below steps:
exit()
PS C:\Users\username> Cls
PS C:\Users\username>python
just type 'clear' in the terminal (windows)
or ctrl+shift+p and
on mac - right click

VSCode: How do I set keyboard shortcut for Show All Opened Editors in Quick Open (edt command)

cmd+p (ctrl+p on windows) searches files in current project and if I want to search currently opened files I can do cmd+p and then type edt (one of the commands they show you when you press ? to list available commands)
vscode available commands from command palette
Is there a way to create a keyboard shortcut to open the command palette with edt pre-filled? Just like open symbols with # pre-filled. In Sublime I can write "args": {"text": "#"} in the setting json file but I can't find anything similar in VSCode, any ideas?
In vscode version 1.30.2
You can go to menu File -> Preferences -> Keyboard Shortcuts
And go to Show All Editors
The default is: Ctrl + K Ctrl + P
Never mind, I only found out this command in default keybindings after I've made this post...
{ "key": "alt+cmd+tab", "command": "workbench.action.showAllEditors" },

How to add semicolon to the end of the line in visual studio code

I press Shift+Enter, but not working, Ctrl+Enter start a new line, but not add semicolon at the end of previous line. Is there a shortcut?
Now there is an extension called Colonize:
Shift+Enter Insert semicolon at the end of line and continue on the same line
Alt+Enter Insert semicolon at the end of line and continue on the new line
Ctrl+Alt+Enter Insert semicolon and stay at the same position
Visual Studio Code doesn't appear to directly support adding a semi-colon to the end of a line via a keyboard shortcut, meaning it'll need a custom extension to support it. Fortunately, Sergii Naumov has created one for us, named (appropriately) 'Trailing Semicolon'.
To install this extension:
Launch Visual Studio Code
Press "Ctrl+P" (or "Command+P" on the Mac)
type "ext install Trailing Semicolon" to search for the extension
With the extension visible below the search box, click the Install Extension icon in the bottom right of the extension. (It's a cloud with an arrow pointing down...)
You will need to restart Visual Studio Code to enable the extension (Visual Studio Code should prompt you to restart once the extension has been successfully downloaded.)
According to Sergii, the default keybinding for the extension is "cmd+;". On my Mac, this meant pressing "Command+;", which worked great.
On my Windows 10 PC, I tried several key combinations ("Window+;" "Ctrl+;" "Alt+;" etc.), and nothing worked. I opened the Keyboard Shortcut preferences (File > Preferences > Keyboard Shortcuts) and searched for the new extension. I found it listed at the end of the keybindings:
{ "key": "win+;", "command": "extension.trailing-semicolon",
"when": "editorTextFocus" }
The "win" key binding apparently doesn't work. I copied this binding to the keybindings.json file, changed "win+;" to "ctrl+;" and it worked like a charm!
Hope that helps.
I wrote an extension to mimic IntelliJ's complete statement.
Pressing ctrl+; (cmd+; on mac) appends ; to the line end,
and moves cursor to line end.
If the line already ends with ;, pressing ctrl+; just moves cursor to line end.
There is also experimental support for complete structures like class, interface, function, if, switch, for, and while. (Not understanding semantic of languages, so it may not work as you expected.)
You can install it as VSIX at GitHub.
The version vscode marketplace is outdated. (Unfortunately my M$ account has been suspended, thus I cannot update it.)
There is no way to do it by default that I could find. I just had to make do as best I could.
I ended up adding a binding via File>Preferences>Keyboard Shortcuts, and then pressing ; after the shortcut. Having the semicolon is part of the binding is as close as I could get... at least my finger is already over that key
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+;",
"command": "cursorEnd",
"when": "editorTextFocus"
}
]
This simply means that Ctrl+; brings you to the end of the line, and then tap ; again.
Update (May 2021)
Started using VSCode Vim keybindings extension a few months ago. Highly recommend it. Out of interest, semi-colon end of the line is A; with vim keys⌨️
at 2021
settings >search for colon
You will find a javascript option to insert the semi-colon.
Try install the following ext then use shortcut: Ctr+; (Cmd+;)
There is a way to have semicolon appended automatically by VSCode.
By default this property is disabled:
For Windows ctrl + ,
For Mac cmd + ,
Settings -> in Search bar type: 'semicolon' -> change values to 'insert' for both JS and TS, save and close.
Now every time on save, VSCode will look for missing semicolons inside the file you're in and append them.
I just started using Visual Studio Code and felt this requirement myself yesterday. After a quick google search I found this nice extension called "Prettier". Being a little new to VSCode it took me a few hours to get it all setup but it works like a charm now. Here are the steps and my setup. I hope it helps others.
My coding environment: VSCode running on a Windows 10 desktop environment connecting to my codebase SMB share hosted on my development machine which is running Ubuntu server 18.04.
Solution Steps
Install node on the Windows desktop
Run, npm install -g prettier
Install the Prettier extension in VSCode
Edit the settings.json file for VSCode and add the following
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
// Set the default
"editor.formatOnSave": true
Add the .prettierrc file at the root of my codebase on the ubuntu host (e.g.: /var/www/html/tutorials) with the following basic styling configuration
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80
}
Restart VSCode and open the code file
Use the existing VSCode keyboard shortcuts to apply formatting to the entire file (Ctrl+K Ctrl+F) or to a selection (Shift+Alt+F)
Or simply saving the file Ctrl+S adds the formatting while saving the file with no additional work required
Viola!
(March 2022) Missing semi colons can be added automatically without the needing of an extension (*with a little catch ;) They are added every time your code is formatted.
Go to settings: Look for this settings if you are writing javascript:
And/or go to settings: Look for this settings if you are writing typescript:
Go to settings: Look for this settings if you are writing javascript:
Format your code and semi colons will be added \o/ Yeah
*The catch: As the settings says: Your workspace needs to have typescript 3.7 or newer.
I know this is a really old post but Prettier - code formatter for vs code adds the semi colon (amongst other formatting).
ext install esbenp.prettier-vscode
If you need semicolons on Javascript/Typescript using vscode do:
Settings
type "semicolon"
you will have options for Javascript & Tyepscript
select the "insert" option as desired
You can also select semicolons for css, less, or scss
/*******/
You can select the "Show matching extensions" and get some extra help with extensions that address the same issue.
Go to settings: Look for this settings if you are writing javascript: enter image description here
And/or go to settings: Look for this settings if you are writing typescript: enter image description hereGo to settings: Look for this settings if you are writing javascript:
Format your code and semi colons will be added \o/ Yeah
*The catch: As the settings says: Your workspace needs to have typescript 3.7 or newer.
This solution works for me
Add the following configuration in settings.json:
"css.completion.completePropertyWithSemicolon": true
or you can cancel by:
"css.completion.completePropertyWithSemicolon": false
other
"scss.completion.completePropertyWithSemicolon": true,
"less.completion.completePropertyWithSemicolon": true
Add semicolon to the end of the line and go to the next line
Shortcode: ctrl+;
Install plugin: multicomando
ext install ryuta46.multi-command
Edit file: keybindings.json
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+;",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"cursorEnd",
{ "command": "type", "args": { "text": ";" } },
"lineBreakInsert",
"cursorDown"
]
},
"when": "editorTextFocus"
}
]
This plugin promotes a sequence of commands. Infinite possibilities!
I hope it helps someone!
You can try Semicolon Insertion Shortcut.
It's in Visual Studio's Preferences. Solution from sbi's answer here:
Go to Tools/Options/Environment/Keyboard.
Switch the "Use new shortcut in:" dropdown to "Text Editor".
Pick the Edit.BreakLine command.
In the Press shortcut keys edit pane press Shift+Enter.
Worked for me!
Ctrl+Shift+P and open Preferences:Open keyboard shortcuts (JSON) in VS Code
and insert
{
"key": "tab",
"command":"cursorEnd",
"when":"editorTextFocus"
}
tab is optional, ofc.
Put whatever you want from the keys on the keyboard.

How to open a shell command prompt inside Visual Studio Code?

When using Visual Studio Code, how do I run command-line programs, such as a choco (Chocolatey) command? Do I need to have a separate Command Line (CMD.exe) running outside VS Code, or is there a hotkey/window within Code where I can run those commands?
I see the "Command Palette", but it is not entirely clear what command engines run in that palette.
For integrated terminal use Ctrl+`
From the release notes:
With the May release, we are rolling out the initial version of an integrated terminal. You can open the terminal using Ctrl+`, from the View | Toggle Integrated Terminal menu, or from the View > Toggle Integrated Terminal command in the Command Palette.
https://web.archive.org/web/20160616204248/http://code.visualstudio.com/updates/#_workbench (the 1.2.0 May release in 2016)
Use CMD+Shift+C or CTRL+Shift+C but it will only open a new outside editor standard bash console.
I hope they will implement an integrated console.
Can open it with this menu options: View > Integrated Terminal
Default keyboard shortcut for integrated terminal is Ctrl+`
In vscode you can use multiple integrated terminals.
If you want open another one use Ctrl+Shift+`
vscode keys shortcuts are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read how can see the representation in your current keyboard.
It's easy, open this menu options: File > Preferences > Keyboard Shortcuts
and on the Default Keyboard Shortcut search the command workbench.action.terminal.toggleTerminal then point you mouse to info icon and can see the combination. For me is Ctrl+ñ because I'm using Spanish keyboard layout.
Also it's cool create an personal shortcuts to toggle into terminals. Open this menu options: File > Preferences > Keyboard Shortcuts and on the keybinding.json tab put this:
[
{
"key": "ctrl+pageup",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},{
"key": "ctrl+pagedown",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
}
]
Now when the cursor are focus on terminal, and have more than one terminal, you can navigate through every one with the combinations Ctrl+Page Down for previous terminal and Ctrl+Page Up for next terminal.
Tip: If you are focus on the editor, the same keyboard shortcuts can be used to navigate through tabs.
For mac Cmd + j
For win Ctrl + j
#brady321's answer is only for US keyboards:
Note: The following keys are rendered assuming a standard US keyboard layout.(https://code.visualstudio.com/Docs/customization/keybindings)
For instance, UK keyboards use Ctrl+':
You can find your shortcut in File > Preferences > Keyboard Shortcuts searching for workbench.action.terminal.toggleTerminal. If you're not using a US keyboard, it will show you the equivalent shortcut using your keyboard layout:
To check what the shortcut to open a native console looks like, try to find workbench.action.terminal.openNativeConsole in the shortcuts file.
More information about integrated terminal at: https://code.visualstudio.com/docs/editor/integrated-terminal
test with the Ctrl + J keys in ubuntu
As MCBL wrote, there is no integrated console. You can vote for this feature here: UserVoice - Integrated terminal <-- dead link.
3rd party Edit
Uservoice is no longer used and the link above is dead. The feature request for an integrated terminal might be this one.
In the contrary you may also run a terminal inside your visual studio code tool by simply doing the following:
Go to " View > Integrated Terminal " or use the shortcut key " Ctrl + ' "
I believe this is available on later versions of visual studio code. I could do this on version 1.7.0-insider.
Ctrl+ `
Integrated Terminal In Visual Studio Code, you can open an integrated
terminal, initially starting at the root of your workspace. This can
be very convenient as you don't have to switch windows or alter the
state of an existing terminal to perform a quick command line task.
To open the terminal:
Use the Ctrl+`keyboard shortcut with the backtick character.
Use the View | Toggle Integrated Terminal menu command. From the
Command
Palette (Ctrl+Shift+P), use the View:Toggle Integrated Terminal
command.
https://code.visualstudio.com/docs/editor/integrated-terminal
I am using vsCode 1.9.1. there are 2 ways as I know
You can easily open it by hitting Ctrl + ` key.
Go to View->Integrated Terminal like below image
Test this, This works for me
Ctrl + ñ
Ctrl + `
ctrl + j
On my UK MacBook, when I look in my keyboard shortcuts for VS Code (Code > Preferences > Keyboard Shortcuts), Toggle Integrated Terminal has the keybinding Crtl+`.
However, the shortcut works on Ctrl+§, which is the key on my MacBook that is the same place as the ` on a UK Windows keyboard.
You can take the text editor of the Microsoft, but you can't take the etc, etc.
Go to File > Preferences > Keyboard Shortcuts or use shortcut Ctrl+K Ctrl+S.
Type to search in keybindings : workbench.action.terminal.new.
Double click on Keybinding and add the shortcut you want (Super+T is unused in default config).
Since the Debug Console does not support programs that need to read input from the console, you can enable an external, native console by setting the attribute externalConsole to true in your launch configuration.
lauch.json just write: "externalConsole" : true
I used custom shortcut. Add below keybind to the keybinds.json:
[
{
"key": "ctrl+,",
"command": "workbench.action.terminal.toggleTerminal"
}
]
To open keybinds.json
CTRL + SHIFT + P then type Keyboard and click to Open Keyboard Shortcuts
The best way to run command line programs is to use the terminal window provided inside VS Code. This way tou will not switch any apps. But to make switching between terminal and other windows I recommend the following :
To open up a terminal - Ctrl + `
To open up second terminal - when you are running a node script in the first terminal and it is blocked and you need to run second script at the same time - Ctrl + Shift + `
To focus/switch back on terminal without reopening :
Press F1 and then type keyboard shortcuts
Find workbench.action.terminal.focus and set it to Ctrl + \ - this slash is usually located right next to your right Ctrl key. This makes switching between code and terminal very easy because Ctrl + ` and Ctrl + \ are invoked with your right hand and index finger.
Switch the Integrated Terminal to CMD
Open the Integrated Terminal: Ctrl + `
If a Bash terminal is opened while you want a Command Prompt (cmd), simply run the command: cmd, in the terminal to switch it to Command Prompt.
Also for MAC its Ctrl+Shift+.
I prefer you to change to a custom one.
Open up Command Palette by Command+Shift+P.
Type 'Keyboard Shortcuts...' - Select Preferences: Open Keyboard Shortcuts
.
See Terminal: Create New Integrated Terminal option there. Double-tap it to change it to a custom one.
.
For me:
ctrl + shift + `
Seems to have done the trick with the default VSCode settings.
If you hover your cursor over the +-button to add a new terminal, you can actually see what you need to press for the shortcut.