From 9ec7b21acce302a21cae91e537b6a827e97a0fbc Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 3 Nov 2011 10:21:57 -0400 Subject: [PATCH] pathogen bootstrap and other things --- bin/macvim-buddy | 27 +++++++++++++++++++++++++++ macvim-buddy.gemspec | 1 + 2 files changed, 28 insertions(+) diff --git a/bin/macvim-buddy b/bin/macvim-buddy index 9a69824..457f85f 100755 --- a/bin/macvim-buddy +++ b/bin/macvim-buddy @@ -3,6 +3,7 @@ require 'thor' require 'pathname' require 'rainbow' +require 'httparty' class MacVimBuddy < Thor desc "build-from-git", "Build the latest MacVim HEAD from GitHub" @@ -72,6 +73,32 @@ GIT end end + desc "pathogen bootstrap", "Bootstrap your .vimrc with pathogen" + def bootstrap + system %{bash -c "cd ~ && mkdir -p .vim/autoload .vim/bundle"} + File.open(File.expand_path('~/.vim/autoload/pathogen.vim'), 'wb') { |fh| + fh.print HTTParty.get('https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim').body + } + + if !File.file?(vimrc = File.expand_path('~/.vimrc')) + vimrc_content = <<-VIM +call pathogen#infect() +syntax on +filetype plugin indent on +VIM + else + vimrc_content = File.read(vimrc) + + if !vimrc_content['call pathogen#infect()'] + vimrc_content = "call pathogen#infect()\n#{vimrc_content}" + end + end + + File.open(vimrc, 'wb') { |fh| fh.print vimrc_content } + + puts "Pathogen installed into your .vimrc" + end + desc "pathogen install GIT_REPO", "Install a plugin from a git repo" def install(git_repo) ensure_bundle diff --git a/macvim-buddy.gemspec b/macvim-buddy.gemspec index 7db334b..da484b1 100644 --- a/macvim-buddy.gemspec +++ b/macvim-buddy.gemspec @@ -22,5 +22,6 @@ Gem::Specification.new do |s| # s.add_development_dependency "rspec" s.add_runtime_dependency "thor" s.add_runtime_dependency "rainbow" + s.add_runtime_dependency "httparty" end