开发者

vimrc file variations when using git

I am currently using git to version control my vimrc file. However, on one comput开发者_运维问答er I want the vimrc file to be slightly different (to change the gui font). How can I do this easily? Is there a way to ignore that specific line? Or do I put them on different branches?


I'd vote branches. A file at a single point in a single branch can't have two different states. That's kind of what version control is all about. Branches are the way that you represent that more than one state of a file (or set of files) exists.


If it is just one thing that you want to have host-specific, then

you can also rely on the hostname and write an equivalent of the line of shell script below, I give the example in shell cause it's so brief (quite likely it'll take a few more lines in a vim script):

   % source `hostname`-fonts.sh

If you have your set-up based on the same git repo which I use (https://github.com/sunaku/.vim or a fork), then you can add your own script in ~/.vim/config/99-local-fonts.vim and make a condition there to look for a file with a hostname in it, if that doesn't exist apply a default setting. You can place such file somewhere in the repository, but where it doesn't auto-load scripts from, i.e. ~/.vim/local/ or similar.

If you use branches, then all the time you will have to make sure you pull new changes in ...etc Branches are good if there is a lot of files which are different.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜