Skip to content

Instantly share code, notes, and snippets.

@andrewlkho
Created April 15, 2014 14:57
Show Gist options
  • Save andrewlkho/10739278 to your computer and use it in GitHub Desktop.
Save andrewlkho/10739278 to your computer and use it in GitHub Desktop.
vim-pathogen with mutt and git

This was originally posted on 2011-04-05 to http://andrewho.co.uk/weblog/vim-pathogen-with-mutt-and-git

For a long time I've used vim as my editor for both composing messages in mutt and commit messages for git. I do this with the following line in my ~/.muttrc (and a similar one in my ~/.gitconfig:

set editor = "vim -c 'set wrap tw=76 fo=toqwal12 nonumber spell' +1"

Recently I refactored my vim configuration files using Tim Pope's excellent pathogen script. Doing so required me to place the following lines in my ~/.vimrc to load all plugins from ~/.vim/bundle:

call pathogen#runtime_append_all_bundles()
call pathogen#helptags()

However, on debian filetype detection is turned on by default which causes problems with pathogen. The fix is to turn it off before calling pathogen:

filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on

This produces another problem, however. For some unknown reason, filetype off causes vim to exit with a non-zero exit code on Mac OS X. When used with mutt, this throws up an ugly warning after editing a message. Git flat out refuses to acknowledge a commit message in this case. The solution is to turn it on then off again:

filetype on
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on

This vim configuration will work on both debian-based and Mac OS X systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment