Skip to content

Instantly share code, notes, and snippets.

@lamnk
Last active September 27, 2015 21:28
Show Gist options
  • Save lamnk/1333974 to your computer and use it in GitHub Desktop.
Save lamnk/1333974 to your computer and use it in GitHub Desktop.
Use Pathogen to update vim plugins
#!/usr/bin/env ruby
# runtime bundle/vim-pathogen/autoload/pathogen.vim
# Insert the above line to .vimrc for pathogen to work
# Pathongen is included in this script so that it will be auto-updated
# Sparkup need manual treatment
# git://github.com/kogakure/vim-sparkup.git
# https://bitbucket.org/ns9tks/vim-fuzzyfinder/
# https://bitbucket.org/ns9tks/vim-autocomplpop/
uris = %w[
git://github.com/scrooloose/nerdtree.git
git://github.com/scrooloose/nerdcommenter.git
git://github.com/scrooloose/snipmate-snippets.git
git://github.com/tpope/vim-pathogen.git
git://github.com/tpope/vim-rails.git
git://github.com/tpope/vim-haml.git
git://github.com/tpope/vim-git.git
git://github.com/tpope/vim-fugitive.git
git://github.com/tpope/vim-surround.git
git://github.com/tpope/vim-markdown.git
git://github.com/tpope/vim-cucumber.git
git://github.com/tpope/vim-repeat.git
git://github.com/tpope/vim-vividchalk.git
git://github.com/vim-ruby/vim-ruby.git
git://github.com/vim-scripts/taglist.vim.git
git://github.com/vim-scripts/matchit.zip.git
git://github.com/vim-scripts/Align.git
git://github.com/vim-scripts/jQuery.git
git://github.com/vim-scripts/Gist.vim.git
git://github.com/vim-scripts/IndexedSearch.git
git://github.com/vim-scripts/closetag.vim.git
git://github.com/msanders/snipmate.vim.git
git://github.com/jcf/vim-latex.git
git://github.com/vim-scripts/desert256.vim.git
git://github.com/tomasr/molokai.git
git://github.com/sukima/xmledit.git
git://github.com/fholgado/minibufexpl.vim.git
git://github.com/altercation/vim-colors-solarized.git
git://github.com/kchmck/vim-coffee-script.git
git://github.com/mileszs/ack.vim.git
git://github.com/jpalardy/vim-slime.git
git://github.com/bbommarito/vim-slim.git
git://git.wincent.com/command-t.git
]
require 'fileutils'
if RUBY_PLATFORM =~ /win32/
bundle_dir = File.join(ENV['HOMEDRIVE'], ENV['HOMEPATH'], 'vimfiles', 'bundle')
else
bundle_dir = File.join(ENV['HOME'], '.vim', 'bundle')
end
Dir.mkdir(bundle_dir) unless File.directory?(bundle_dir)
FileUtils.cd(bundle_dir)
uris.each do |uri|
dir = uri.split('/').last.sub(/\.git$/, '')
if File.exist?(dir)
puts "=== Updating #{dir} ..."
FileUtils.cd(dir)
`git pull`
FileUtils.cd("..")
else
puts "=== Installing #{dir} ..."
`git clone #{uri} #{dir}`
end
end
puts "=== Cleaning ...\n\n"
directories = uris.map { |repo| repo.split('/').last.sub(/\.git$/, '') }
left_overs = Dir.entries(bundle_dir) - directories
left_overs.each do |dir|
next if dir == '.' or dir == '..'
system("rm -rf #{File.join(bundle_dir, dir)}")
end
# Downloading from vim.org
#vim_org_scripts.each do |name, script_id, script_type|
# puts " Downloading #{name}"
# local_file = File.join(name, script_type, "#{name}.vim")
# FileUtils.mkdir_p(File.dirname(local_file))
# File.open(local_file, "w") do |file|
# file << open("http://www.vim.org/scripts/download_script.php?src_id=#{script_id}").read
# end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment