motemen / git-vim

My vim files for Git
575 stars 73 forks source link

When editing commit messages set filetype to "gitcommit"? #6

Closed wincent closed 8 years ago

wincent commented 15 years ago

Any chance of automatically setting the filetype to "gitcommit" when editing a commit message in a Vim buffer (triggered by :GitCommit)? (That is, ":setlocal filetype=gitcommit").

At least with my version of Vim -- that is, MacVim 7.2 stable 1.2 (33.3) -- Tim Pope's Git files (http://www.tpope.net/vim-git-announcement) came included, which means that a commit message has syntax colouring, highlighting of errors, autowrapping to 72 columns etc. I've also got Tim Pope's files in /usr/share/vim/vim72/, so I guess they come standard with the version of Vim that ships with Mac OS X leopard anyway.

As far as I can telling, setting the filetype to "gitcommit" on systems which don't have Tim's runtime files has no ill effects.

wincent commented 15 years ago

In case you want to cherry pick this one I've made the change in my fork, along with a few other tweaks to :GitCommit.

See this commit:

wincent/git-vim@ebe889096fb642dc26d12296176f6965428ebf5b

wincent commented 15 years ago

Hyperlink: http://github.com/wincent/git-vim/commit/ebe889096fb642dc26d12296176f6965428ebf5b

Shurakai commented 14 years ago

Yes, I've encountered this problem too. Syntax highlighting is nicely included in standard vim and this issue should definitely be tackled :)

wincent commented 14 years ago

AFAIK Shurakai, this project has been abandoned (no commits since Sep 2009). An alternative is Tim Pope's fugitive.vim, which is being actively developed:

http://github.com/tpope/vim-fugitive