2

I know in Unix we can use Ctrl+z and fg to switch between shell and vim. But how to do that in powershell?

There is a question about Ctrl+z and fg in Powershell https://superuser.com/questions/465238/is-there-an-analog-of-bashs-ctrlz-fg-in-powershell But the answer psjob doesn't work as desired in this case.

When I type !psjob, it does return to the command line, but any key strokes will bring it back to Vim. So I can't really execute any command.

Does any one know if there is a solution for this?

2

I think you are asking the wrong thing here.

The feature you mention is a feature of the shell and unixoid systems. Ctrl+z advises the shell to stop the currently executed process (vim in your case). As there is no other process executed in the shell, you are back at your prompt and can work normally. The fg command tells the shell to bring back the interrupted process.

This is by no means a feature of vim, but only of the shell.

That said, I doubt that the power shell has this feature. So you can only workaround by executing a command through vim with the exclamation mark. But that will probably be executed on windows cmd.exe and not on powershell.

  • 1
    To execute commands on powershell you could use set shell=powershell and set shellcmdflag=-command – vappolinario Sep 7 '15 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.