[Vim] Toggle between Vim and Shell

There is a binding I kind of use a lot in the past months. As you may know, you can switch to a shell from Vim with

1
:sh

in normal mode. If you type exit or hit CTR+D in your shell, you will get back to Vim. I like this behaviour when I am on a remote server via ssh.

Therefor I binded CTR+D in Vim to execute :sh, so I can toggle between shell and Vim with this shortcut.
To get it, include this snippet in your vimrc.

1
2
# ~/.vimrc
noremap <C-d> :sh<cr>