Last active
August 29, 2015 14:27
-
-
Save NewAlexandria/e817b6e175e6641fe4d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.open(".vimrc","a") do |f| | |
f.write File.readlines('.gitmodules') | |
.map(&:strip) | |
# remove extras | |
.reject do |l| | |
l.scan('[').any? || # submodule defs | |
l.scan(/^path/).any? || # submodules paths | |
l.empty? # blank lines | |
end | |
# remap URLs to user/repo names | |
.map do |url| | |
url | |
.sub('.git','') | |
.sub(/url\s*=\s*https:\/\/github.com\//,'') | |
end | |
# only 2 things left; comments that need to be in VimL format, and repos for NeoBundle. | |
.map {|repo| repo[0]=="#" ? repo.gsub('#','"') : "NeoBundle '#{repo}'" } | |
.unshift("\n") | |
.join("\n") | |
do |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote this for anyone converting their Vim plugin manager, from one that uses submodules, to NeoBundle.
It reads the
.gitmodules
file and appends the modified output to.vimrc
.There are more-universal things it could do, but I've coded it to handle my situation.