vim shell key mapping to execute shell commands vim shell key mapping to execute shell commands shell shell

vim shell key mapping to execute shell commands


The vimshell plugin provides an interactive shell inside a Vim buffer. Apparently, you don't need the interactivity (because you intend to immediately exit after issuing the shell command). For that, you don't need the plugin itself; the built-in :! command already allows you to launch external commands:

:nnoremap <leader>bi :!bundle install<CR>

If you want to keep the output visible, you can read it into a scratch buffer:

:nnoremap <leader>bi :new<Bar>0r!bundle install<CR>


Having an interactive shell in Vim is one of Vim's stated non-goals (cp. :help design-not), so the plugin has to jump through several hoops to make this possible. Those hacks are causing these problems (of defining a proper mapping, as evidenced by the attempts in the question's comments); lack of automation (like through mappings) is a limitation of this approach.

You may contact vimshell's author (via email or GitHub issue); he's usually very open and responsive! He's in the best position to make such mapping work.