gvim - 使用github托管vim插件
阿神
阿神 2017-04-21 10:58:03
0
1
607

我在github上建一个名为vimfiles的repository,将 ~/.vim 内的东西push上去,使用pathogen来管理插件

添加两个submodule
git submodule add git@github.com:kien/ctrlp.vim.git bundle/ctrlp
git submodule add git@github.com:Shougo/neocomplcache.git bundle/neocomplcache

这样就添加了两个插件,然后可以使用git submodule foreach git pull origin master更新插件

但是,submodule在github上只是一个指向原repository的一个引用,如图

如果我修改了插件的几行代码,vimfiles这个仓库如何记录我的修改?

或者说,能否让vimfiles这个repository记录的不是插件原repository的指向,而是实实在在的代码?

分割线

想到两种解决方法,但并不知道是否最佳做法。

其一,fork了别人插件的代码后,在fork了后的repository上对代码进行修改
然后git submodule add (新的repository) bundle/xxxx,但是如果只是改几行代码fork一个项目这个做法是否合理。

其二,不使用git submodule的方法,在bundle目录下git clone插件的代码,并去掉插件目录的.git文件夹,即去除插件的版本控制。这样就可以在vimfiles这个repository中实实在在地保存插件的代码,而缺点就是插件的更新很麻烦。

是否有更佳的方法,望告知,谢谢。

阿神
阿神

闭关修行中......

reply all(1)
阿神

It is not recommended that you modify the plug-in.

You can go to a new issue, tell the author your needs, and then wait until he implements it. If you change it yourself, you must either fork it yourself and start a new one, or directly copy the code file (personally I feel this is a stupid approach).

You wrote in your question that only a few lines of code were modified, so you may consider appending code to your vimrc to cover that part (those lines) of the plug-in author. For example, if you modify a function in a plug-in, you can directly add it to your vimrc to overwrite the function. Or for a more separation point, you can create a new repo, which is only responsible for recording your modifications, and then source it into your vimrc.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!