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 is there an analog bash ctrl-z 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?

3 Answers 3


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.

  • 2
    To execute commands on powershell you could use set shell=powershell and set shellcmdflag=-command Sep 7, 2015 at 18:52

Ctrl+z for me starts a new shell inside the current session.

Typing exit quits the shell and returns to Vim.


Vim overrides the way Ctrl-Z is handled. From the help:

On many Unix systems, it is possible to suspend Vim with CTRL-Z.  This is only
possible in Normal and Visual mode (see next chapter, |vim-modes|).  Vim will
continue if you make it the foreground job again.  On other systems, CTRL-Z
will start a new shell.  This is the same as the ":sh" command.  Vim will
continue if you exit from the shell.


  1. This is not actually suspending anything (at least on platforms where that's not supported); it's a new shell with a different environment.
  2. It would not even necessarily be PowerShell but whatever is set as shell.

Lastly, to return to Vim, you would exit the shell as normal, rather than use job-control features like fg.

  • The implications would be 1) this is not actually suspending anything but it's a new shell with a different environment and 2) it would not even necessarily be PowerShell but whatever is set as shell.
    – Friedrich
    Jul 24 at 14:36
  • Sure. I figured that was evident enough by navigating :help, but I'll just include your comment @Friedrich
    – D. Ben Knoble
    Jul 24 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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