So, this might be a heretical question, but I'm looking for an Emacs mode that handles syntax highlighting of .vimrc files. This particular question has proved pretty hard to Google for the obvious reasons, but it seems extremely likely to me that someone would have written such a mode in the 20+ years of open warfare between the two editors. Any ideas?
Googling does turn up wenbinye's vimrc-mode, a very lightweight generic mode. Here's what I have in my .emacs
:
(define-generic-mode 'vimrc-generic-mode
'()
'()
'(("^[\t ]*:?\\(!\\|ab\\|map\\|unmap\\)[^\r\n\"]*\"[^\r\n\"]*\\(\"[^\r\n\"]*\"[^\r\n\"]*\\)*$"
(0 font-lock-warning-face))
("\\(^\\|[\t ]\\)\\(\".*\\)$"
(2 font-lock-comment-face))
("\"\\([^\n\r\"\\]\\|\\.\\)*\""
(0 font-lock-string-face)))
'("/vimrc\\'" "\\.vim\\(rc\\)?\\'")
'((lambda ()
(modify-syntax-entry ?\" ".")))
"Generic mode for Vim configuration files.")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With