Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to configure both Vim and Emacs to be able to run bash scripts from within the editor, so that I can commit/push my code without having to leave the editor.

Could someone help me out with this?


share|improve this question

Within Vim, you can run any command using :!, e.g.,



:!hg ci -m "Check-in comment"


:help :!
share|improve this answer

Emacs has a shell mode that can used to open a shell. Try Escxshell.

However, if you want to commit code from with emacs, there are modules which allow you to work with version control from within emacs. The installations I have worked with automatically detects files under version control. Version control shows up in the file status line.

share|improve this answer

The :! command is as old as venerable vi; to speed up the repeated application (beyond :!!), either set up custom mappings (:nnoremap ...), or use a plugin like vcscommand.vim - CVS/SVN/SVK/git/hg/bzr integration plugin, which provides a lot of VCS-related functionality.

share|improve this answer

Instead of some bash scripts you can use some scripts for Vim or Emacs that run as wrappers around Git, so you can use git commands without leaving the editor.

A great Git plugin for Vim is fugitive, some Emacs Git plugins are listed here.

If you're using both editors you can remap the keys of the Git commands to be consistent.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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