Background mode for vim in windows - powershell

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.

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 :-(.

Vim for Visual Studio - Ctrl+C Disabled Still Enters Normal Mode

I have set the following setting in VIM for Visual Studio
But when I press ctrl+c I still enter NORMAL mode.
I also tried to set my own vimrc
and add the ctrl-c remapping from there
# inside ~/.vimrc
map <C-c> "+y
But it still enters NORMAL mode, it works because atleast it does copy to the clipboard what i was trying to copy, but I thought it would get rid off the action of entering NORMAL mode.. I thought it would have rewritten that functionality for that shortcut instead it kind of doubles it.
I am getting used to it, but I wonder why that's the case.

How to expand VSCode's Interactive Terminal's text font

I've been working on a bunch of different projects in VSCode and just to clear up some space on my desktop I decided to quit all VSCode applications. Upon reopening it, the Interactive Terminal's text too small to read. I know you can just launch terminal and execute the same command but out of convince's sake I want to be able to increase the size of it again. Example of my issue
You can change the terminal display settings with this configuration in your settings.json.
I saw your photo, and it looks like there is some minor problem. Just reload your window - Command + R on macOS, or select Developer: Reload Window after opening the command palette. That should work.

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.

Can one edit a terminal buffer in Normal mode in NeoVim?

NeoVim's terminal mode is cool, but what I really would like is to
be able to switch to normal mode to edit terminal with normal mode commands, is it possible?
I realize that when in this terminal mode, all input is responsability of the terminal, so I see that a mode where input interaction travels between vim and the terminal shouldn't be simple, if it's doable at all, I'd just like to confirm.
It is possible.
However, the user needs to use the <C-\><C-n> key combo first,
which will exit back to normal mode. Once in "normal" mode the user can navigate, set marks, visually select text, use registers to yank and paste the output somewhere else, etc.
If the user comes back to insert mode (i or a, e.g.) the cursor will come be back to the terminal command line.
For general information about the terminal emulator: :h terminal-emulator
For specific information on terminal's input: :h terminal-emulator-input. This section includes a bunch tips that might be handy, such as how to map <C-\><C-n> to <esc>.