Modelines in Git Commit Messages

1 minute read Published:

I’ve been cleaning up my Vim config this week, and I noticed some strange errors while doing an interactive rebase in my dotfiles repository.

Error detected while processing modelines:
line    1:
E518: Unknown option: <some text from the first commit message> 

Because of the way I format commit messages for my dotfiles, the first line of the file presented during an interactive rebase was being interpreted as a modeline. I was hoping there was a command line option or something that I could use to disable modelines, but as far as I can tell, you have to do it in your .vimrc.

This isn’t likely to be a problem for most people, as I don’t imagine there are many that have vim: at the beginning of their commit messages. However if you run into this problem, you can solve it by adding the following to an appropriate place in your .vimrc

autocmd FileType gitrebase setlocal nomodeline