Cannot eXit from Nano with Control + X in Visual Studio Code Terminal. Is there another shortcut? - visual-studio-code

Control + X doesn't work to exit Nano in Visual Studio Code Terminal (I'm on Mac). I've edited a file, then saved it with Control + O. Works fine. But when I try to eXit Nano in the terminal it doesn't work. Is there another shortcut?

You will need to deny chord keybindings in the terminal.
Open your preferences, go to Features, Terminal and then uncheck "Integrated: Allow Chords". If you like better to edit the settings JSON, just put this there: "terminal.integrated.allowChords": false.

Related

Updating vscode doesn't show user code snippets

Updating vscode doesn't show user code snippets.
If I move the cursor after entering the prefix, it appear only then.
This issue can be resolved by following these steps:
Close Visual Studio Code.
Go to your user snippets folder, usually located at ~/.config/Code/User/snippets (for Linux), %APPDATA%\Code\User\snippets (for Windows) or ~/Library/Application Support/Code/User/snippets (for Mac).
Backup your user snippets folder by renaming it to something like snippets_backup.
Reopen Visual Studio Code.
Check if your user snippets are appearing now.
If the above steps don't solve the problem, you can try clearing the Visual Studio Code's cache:
Go to the Command Palette (Ctrl + Shift + P on Windows, or Cmd + Shift + P on Mac).
Type in "Developer: Delete Settings File".
Select the option "Developer: Delete Settings File" from the dropdown.
Confirm the deletion of the settings file by clicking on the "Yes" button.
Reopen Visual Studio Code.
These steps should resolve the issue with your user code snippets not appearing after updating Visual Studio Code.

Cannot open terminal in VS Code

I need to open a terminal in Visual Studio. I've tried
Re-installing VS Code
The usual Windows shut down / restart
Run vs code as admin
Change settings.json file
I didn't change anything but something is broken in my code Editor help needed :)
For Windows users:
Open PowerShell terminal (windows button + r -> cmd)
Right click on the title bar
Open properties
Check the "Use legacy console" checkbox
For Linux users:
Open VS Code
Ctrl + ,
Search env and find Terminal > Integrated> Env: Linux
Add this "terminal.integrated.inheritEnv": true to the object body
Press ctrl + `. It might work, and if it doesn't, try reinstalling the vs-code again and then try the above key combo again.

How do I get around the verified bug in Windows 1903 and launch the VSCode integrated terminal?

I just did a fresh install of Windows 10 Pro version 1903 build 18362.116 and Visual Studio Code. Now the integrated terminal only launches externally.
Pressing Ctrl + ~ results in this.
What am I missing? How do I get it to open integrated again?
EDIT
After working with VSCode team it is a verified bug. See the Github issue here. I posted the workaround as an answer here.
OK, worked through this one in VSCode repo issues.
For now, until it's fixed, turn off ConPTY integration in the User Settings.
💥💥💥
The issue now says use legacy console. To change the setting open a cmd prompt. Right click the title to bring up properties.
Then Uncheck 'Use legacy console'
To change the integrated terminal on Windows, you just need to change the terminal.integrated.shell.windows line:
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Check if "terminal.integrated.shell.windows" has value "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right.
Remove this line.
Ctrl + ~ will now open integrated terminal of VSCode.
If the above solution doesn't work then can you try below values and check if it works for you:
// Command Prompt
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
// PowerShell
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
From the Command Palette (Ctrl+Shift+P), use the View: Toggle Integrated Terminal command.
Try custom shortcut:
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.toggleTerminal"
}
]
Had this problem fixed. Found the solution from the VS Code support.
for error:
Terminal exits with code 3221225786 (or similar)#
"This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console."
source: VS Code docs

How to open a file from the integrated terminal in Visual Studio Code?

Is there a way of opening a file from the terminal in Visual Studio Code that opens in the same vscode instance that runs the terminal? Similar to c9 tool in Cloud9.
I'm aware of the code tool, but when you run code something.php from the integrated terminal it opens a new vscode instance, which is not what I want...
You can use -r or --reuse-window command line option.
code -r something.php
just
code file_name
I tried it on Win10 and on Linux (Ubuntu)
I don't know what operating system you're using, but on MacOS you can just say open filename.ext in the integrated terminal, and it will open a new tab in the same VSCode instance, ready for you to edit.
If you are having command not found: code in macOS, use a full path to it.
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code -r [filename]
Open Visual Studio Code
Press CMD + SHIFT + P (this opens "Command Palette")
Type shell command
Select “Install code command in path”
Navigate to any project from the terminal, and type code .
If it didn't work, select “Uninstall code command from path” first, then reinstall it again.
I use code -r . to open the current directory in the main window.
You can use the code command from the CLI to open a file, but if you want it to open in the existing window, either use code -r <file> as mentioned in other answers (which does work for me on Ubuntu Linux), or, if -r does not work (under WSL?), make sure window.openFilesInNewWindow is either off or default in settings.json or the in VS Code settings UI, then use code <file>.
Many things can be found in open --help
A work around that worked for me on MacOS is:
open -a 'Visual Studio Code.app' something.php
in the version 1.31.0 that I have installed, on Windows 7, the only way I found to do this is to e.g. change the file associations in system so that .cproj and .cs files are opened by Visual Studio Code by default, and type "filename.cs" in Terminal to open file by that name in the same window... -r option is not working for the first call (opens a new window), but with each subsequent call that same window is correctly reused. ok can't get to open whole directories this way - it's a bit shoddy anyway. probably it would be more convenient to use an outside shell and work with "-r" option
VSCode 1.64 (Jan. 2022) comes with a new command:
Keyboard Navigable Links
Previously, link navigation in the terminal required the use of a mouse.
Now, links can be opened using only the keyboard via the following commands:
Terminal: Open Detected Link... to view all links (web, file, word)
Terminal: Open Last Web Link... ex: https://github.com/microsoft/vscode
Terminal: Open Last File Link... ex: /Users/user/repo/file.txt
Check if the last command Terminal: Open Last File Link... would help in your case.
See also "Terminal shell integration"

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.