pathogen bootstrap and other things
This commit is contained in:
parent
fd8e3b6e50
commit
9ec7b21acc
@ -3,6 +3,7 @@
|
|||||||
require 'thor'
|
require 'thor'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'rainbow'
|
require 'rainbow'
|
||||||
|
require 'httparty'
|
||||||
|
|
||||||
class MacVimBuddy < Thor
|
class MacVimBuddy < Thor
|
||||||
desc "build-from-git", "Build the latest MacVim HEAD from GitHub"
|
desc "build-from-git", "Build the latest MacVim HEAD from GitHub"
|
||||||
@ -72,6 +73,32 @@ GIT
|
|||||||
end
|
end
|
||||||
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"
|
desc "pathogen install GIT_REPO", "Install a plugin from a git repo"
|
||||||
def install(git_repo)
|
def install(git_repo)
|
||||||
ensure_bundle
|
ensure_bundle
|
||||||
|
@ -22,5 +22,6 @@ Gem::Specification.new do |s|
|
|||||||
# s.add_development_dependency "rspec"
|
# s.add_development_dependency "rspec"
|
||||||
s.add_runtime_dependency "thor"
|
s.add_runtime_dependency "thor"
|
||||||
s.add_runtime_dependency "rainbow"
|
s.add_runtime_dependency "rainbow"
|
||||||
|
s.add_runtime_dependency "httparty"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user