How can I get CTRL+K CTRL+E to work in terminal - visual-studio-code

I don't use these specific control commands in vs code. But I do use them on the terminal all the time.
How can I configure VSCode to send them to the terminal?
When press CTRL+E or CTRL+K, it says:
waiting for the second key of chord.
CTRL+A works in the terminal just fine, so I figured I'd either have to set something or unset something, but I've had zero luck in tracking that down.

Related

Alt-based shortcuts in VS Code's intergrated terminal

My shell is configured to have Alt+n and Alt+p navigate in history (technically, using zsh's history-beginning-search-forward and history-beginning-search-backward).
I used to be able to use these shortcuts in VS Code's integrated terminal, but since I upgraded to VS Code 1.74.1, the Alt+n and Alt+p seem to be catched by VS Code before reaching my shell (the cursor changes to a cross to allow rectangular selection when I press Alt, which I guess is the cause). I do have "terminal.integrated.sendKeybindingsToShell": true and "terminal.integrated.allowMnemonics": false in my settings to avoid interference between VS Code and the Alt key, and I couldn't find another setting to change the behavior. Surprisingly, the Alt+a command is passed to the shell, so some Alt-based shortcuts are passed to the shell, but not all.
Is it possible to configure VS Code to send Alt+n and Alt+p to my shell?
As a workaround, using Alt+Shift+n and Alt+Shift+p seem to work, but that's one extra key to teach my fingers to use :-(.

VSCode WSL terminal input shows like insert mode when I press KeyUP for the first time

steps:
open WSL terminal in VSCODE
type anything and the input is fine.
press the "UPKEY" for the first time and the input shows like if I pressed insert.
I'm saying shows because when I press KEYUP after entering the input the input is correct.
You can watch to GIF to understand it.
Pressing the "insert" key doesn't have any effect.
Powershell works fine.
WSL terminal works fine outside VSCODE
EditorConfig was messing with my terminal for some reason, disabling it fixes the problem

Background mode for vim in windows

I've recently started moving away from my regular editor to vim and I use powershell as my default shell. I noticed in the normal mode that pressing ctrl z allows to quickly go back to the terminal ( although in a very different mode, regular shortcuts like ctrl L to clear screen etc. weren't working ). After reading through some posts I got to know that this shortcut is meant to put vim in backgroud mode in linux and fg brings it back to the foreground. Since this doesn't work in powershell is there an alternative way to get the same functionality?
PS: Is there also any alternative to reach powershell prompt from within vim?
Thanks!
The terminal command can be used to reach a powershell prompt from within Vim.
:term powershell
This will open powershell in a new terminal window.
There are various ways to invoke a terminal. For example, :tab term powershell will open the terminal in a new tab. :term ++curwin powershell will open the terminal in the current window. See :help :term for more details.
Here is some more relevant information from a prior post:
Using :term will place you in Terminal-Job mode, where you can use
the terminal as expected.
Within Terminal-Job mode, pressing Ctrl-W N or Ctrl-\ Ctrl-N switches the mode to Terminal-Normal, which
allows the cursor to be moved and commands to be ran similarly to
Vim's Normal mode. To switch back to Terminal-Job mode, press i.

How do I switch terminals in Visual Studio code using a keyboard shortcut?

I would like to be able to switch between terminal panes in VSCode using a keyboard shortcut. I am on a Mac.
I have opened keyboard shortcuts (Commandkey+K, Commandkey+S) and found the workbench.action.terminal.focusNextPane setting:
where it states quite clearly what the keyboard shortcut should be (option+command+downarrow or option+command+leftarrow) but neither of those work. They DO work when focus is in the editor and I want to switch between panes there, but not working when the focus in the terminal.
Not sure what I'm doing wrong but I hope I'm missing something obvious. Can anyone explain?
The commands you are looking at (Terminal: Focus Next Pane and Terminal: Focus Previous Pane) are to switch between split terminal panes.
The commands to switch between terminals are:
Terminal: Focus Next Terminal
workbench.action.terminal.focusNext
Terminal: Focus Previous Terminal
workbench.action.terminal.focusPrevious
both of which are unbound by default.

How to run the select code in VScode?

I want to run the select code of python in VScode. Till now, I have to copy the code and paste it in the terminal below to run. The system is mac OS.
So is there any way to run the code directly after I selected the code? For example, like the shortcuts.
Thanks.
There is no default keybindings for command "Run Selected Text in Active Terminal", but you can create one.
Press Ctrl+K, Ctrl+S to open File → Preferences → Keyboard Shortcuts.
Search for workbench.action.terminal.runSelectedText in keybindings.
Press the icon on the left to open a windnow with this message "Press desired key combination..." and make your choice. (I've pressed Ctrl+Alt+R - as this combination was not used yet.)
Press Enter to store your keybinding.
Tested on VSCode 1.30.2 on Windows 10 Pro.
#yanachen, this is now possible in VS Code. All you need to do is:
1. Ensure python is running in the VS Code terminal window
2. Select the text you wish to execute in python
3. Invoke the command 'workbench.action.terminal.runSelectedText' as defined in the following link:
https://code.visualstudio.com/docs/editor/integrated-terminal#_key-bindings
Now it's supported by default shortcut "shift" + "enter".
select the proper code snippet
press "shift" + "enter"
Here is the setting for running selection in "interactive window."
In my VS Code (version 1.56.2), I do the following things: go to Settings, search for interactive window, in the resulting left panel choose Jupyter, and finally check the box next to Jupyter: Send selection to interactive window. That's it. One more step for some users (including me) is to modify the keybinding for running selection to your preference. For example, got to keyboard shortcuts, type run selection, you should see a list of keybindings and you may need to redefine them if conflicts exist.
Some language specific extensions have already an existing keybinding.
On Windows, for the PowerShell extension it is currently F8 to run the selected text.
Install the vscode extension Node.js Exec. then select the block of code you want to run and press f8. worked for me.