Fix a bug with installing new vim plugin from the command line

Fixes #328
This commit is contained in:
Fabio Gallonetto 2013-05-16 16:55:15 +01:00 committed by Fabio Gallonetto
parent 73240f018a
commit 26a36a7451
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,8 @@ module Vundle
vundles = vundles_from_file
last_bundle_dir = vundles.rindex{ |line| line =~ /^Bundle / }
vundles.insert last_bundle_dir+1, "Bundle \"#{plugin_repo}\""
last_bundle_dir = last_bundle_dir ? last_bundle_dir+1 : 0
vundles.insert last_bundle_dir, "Bundle \"#{plugin_repo}\""
write_vundles_to_file vundles
end
@ -25,16 +26,18 @@ module Vundle
end
def self.update_vundle
system "vim --noplugin -u vim/vundles.vim -N \"+set hidden\" \"+syntax on\" +BundleClean +BundleInstall +qall"
system "vim --noplugin -u #{ENV['HOME']}/.vim/vundles.vim -N \"+set hidden\" \"+syntax on\" +BundleClean +BundleInstall +qall"
end
private
def self.contains_vundle?(vundle_name)
FileUtils.touch(@vundles_path) unless File.exists? @vundles_path
File.read(@vundles_path).include?(vundle_name)
end
def self.vundles_from_file
FileUtils.touch(@vundles_path) unless File.exists? @vundles_path
File.read(@vundles_path).split("\n")
end

View File

@ -0,0 +1 @@
set tags+=tags,gems.tags,stdlib.tags