0

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!

supra
  • 49
  • 6
  • SO does have rules: [Provide MRE](https://stackoverflow.com/help/minimal-reproducible-example) --- [How to ask](https://stackoverflow.com/help/how-to-ask) --- [Don't ask](https://stackoverflow.com/help/dont-ask) --- [Proper Topic](https://stackoverflow.com/help/on-topic). Yet, do a search for ['powershell keyboard binding vim'](https://duckduckgo.com/?q=%27powershell+keyboard+binding+vim%27&t=hk&ia=web), you'll get several talks on the topic ov VIM and PowerShell. – postanote Aug 24 '20 at 23:42
  • I don't get what you mean? Is this a wrong question? I tried the psreadline edit mode but couldn't make much headway and there wasn't much about specifically about background mode. Can you please explain further? – supra Aug 25 '20 at 09:42

1 Answers1

1

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.

dannyadam
  • 3,950
  • 2
  • 22
  • 19