I just recently switched over to Mac. On windows I was using git through the msysgit project. When doing a git rebase -i
I'm used to get a nice syntax highlighting in vim
. I'm missing it badly now that I'm on Mac. How can I get it back?
3 Answers
I just figured out all I need is to create a ~/.vimrc
file with a line that reads
syntax on
-
3
For me the issue was git was using "vi" instead of "vim". Adding this to my .bashrc fixed it:
export EDITOR=vim
You probably need to set up an autocmd
in your .vimrc
to recognise the appropriate file as a rebase -i
temporary:
autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase
Then you just need to use a syntax file ~/.vim/syntax/gitrebase.vim
and put in whatever highlighting commands match your preferences such as the one supplied with recents vims:
https://github.com/vim/vim/blob/master/runtime/syntax/gitrebase.vim
-
I created the
.vimrc
at~/
with the line that you postet and also created thegitrebase.vim
file at~/.vim/syntax/
with the content from that link. Then I reopened the terminal and tried it. It doesn't work. Anything I might be missing?– ChristophSep 9, 2012 at 22:29 -
Ok, I just figured out all I need is that
.vimrc
file with a line that readssyntax on
– ChristophSep 9, 2012 at 22:40
git log
etc do work, yes. I havegit config --global color.ui true
msysgit
seemed to abstract all those difficulties away from the end user. All the highlighting worked just out of the box so until my first interactive rebase on my new MacBook I didn't even know that something like a vim config does even exist :)