My Unix config files and shell scripts, optimized for Fedora, Debian, macOS and Windows (in that order).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

make-submodules.py 732B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. """Script to generate the .gitmodules file for the vim plugins."""
  3. import re
  4. # Open the files
  5. vimrc = open("home/.vimrc", "r")
  6. outfh = open(".gitmodules", "w")
  7. for line in vimrc.readlines():
  8. line = line.strip()
  9. match = re.search(r"Plugin '(\w+?)/([A-Za-z0-9.-]+?)'", line)
  10. if match:
  11. username = match.group(1)
  12. repo = match.group(2)
  13. path = "home/.vim/bundle/{}".format(repo)
  14. url = "https://github.com/{}/{}".format(username, repo)
  15. print "Submodule:", url
  16. outfh.write("[submodule \"{}\"]\n".format(path))
  17. outfh.write("\tpath = {}\n".format(path))
  18. outfh.write("\turl = {}\n".format(url))
  19. # Clean up.
  20. vimrc.close()
  21. outfh.close()