How to give yank access to clipboard in a terminal session in tmux in VSCode? - visual-studio-code

When I am in my terminal in tmux, I can quickly press CTRL+A, "[" to go in visual mode inside the terminal and use yank to copy lines to my system clipboard. (clipboards are synchronized).
The same does not work when I am inside of a Visual Code terminal that has tmux launched. Why?
Not sure if it matters, but in my settings.json in VSCode, I have this line enabled: "vim.useSystemClipboard": true,

Related

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

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.

How to displlay normal mode`s opened terminal at `Zen Mode` instead of open a new terminal?

I have a question, when I use vscode in normal mode with open a terminal, then I switched to Zen Mode, the terminal is hiddend, How to displlay normal mode’s opened terminal at Zen Mode instead of open a new terminal
Press Ctrl+Shift+P to bring up the command palette and run command View: Toggle Terminal.
You can also use the direct keybinding for the command, the default should be Ctrl+`.

Can't open a Cmder terminal on VSCode (only powershell) since last update

Since one of the last updates of VSCodem, I am unable to open a Cmder terminal, even with cmder specifically indicated as my terminal client.
settings.json
"terminal.external.windowsExec": "C:\\laragon\\bin\\Cmder\\Cmder.exe",
"terminal.integrated.env.windows": {"CMDER_ROOT": "C:\\laragon\\bin\\Cmder"},
"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows" : ["/K","C:\\laragon\\bin\\cmder\\vendor\\init.bat"],
It only opens a powershelll terminal and cmder doesn't even appear on the dropdown options list on the add terminal button.
If I manually launch the cmder in windows and them press the CTRL+Ç, it will focus on the external window and will not open a terminal inside vscode.
Anyone had this problem? I can't figure it out... microsoft again doing what it does! I don't want powershell, I want cmder...
Thank you for any help!

Launch Windows Terminal from VSCode?

I'm trying to launch the new Windows Terminal through VSCode like I have with other terminal emulators.
Previously I've used the following setting in the VSCode JSON file settings.json to launch Cmder through VSCode with ctrl+C
"terminal.external.windowsExec": "C:\\Program Files\\cmder\\Cmder.exe",
However, trying the same with the directory of the Windows Terminal directory has been unsuccessful.
"terminal.external.windowsExec": "C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\\WindowsTerminal.exe",
I thought that the executable was wt.exe, so if I'm correct, in your settings.json, you should be using:
"terminal.external.windowsExec": "C:\\Users\\skillcap\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe",
(remember to change the user name as required).
As a side note, the executable should also have been added to your %PATH%, so you should be able to generally start it using just wt, (with an unmodified %PATHEXT% variable).

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

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.