X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=vim%2Finstall.pl;h=16e4a128e9acc28b288dd50c75f873380d3e9a82;hb=47cc473183a45c470728a30243fc379dc222c5b6;hp=3b7ac3292ebb69d4ecc13729298f6a43c988f765;hpb=231be6a3b816216f8bad19249c1f93d29ce861a6;p=dotfiles.git diff --git a/vim/install.pl b/vim/install.pl index 3b7ac32..16e4a12 100755 --- a/vim/install.pl +++ b/vim/install.pl @@ -1,16 +1,48 @@ #!/usr/bin/perl -w - -## 1. git clone package manager Vundle -my $vundle_url = "https://github.com/gmarik/Vundle.vim.git"; - -chdir "bundle"; -system "git clone " . $vundle_url; - -## 2. install packages # # -# 3. install YouCompleteMe -# ./install.py --clang-completer +use strict; +use File::Basename; +use Cwd; +use Cwd "abs_path"; + + +my $home = $ENV{'HOME'}; +my $vimDir = dirname abs_path(__FILE__); +my $vimrc = $vimDir . "/vimrc"; + +## test if vim and vimrc exist +die "~/.vim or ~/.vimrc exists!!.Backup them first.\n" if -e "$home/.vimrc" or -e "$home/.vim"; + +### link the files +print `ln -s $vimDir $home/.vim`; +print `ln -s $vimrc $home/.vimrc`; + +if ($? == 0) { + print "Link files Done.\n"; +} else { + die; +} + + +## check Vundle installation +my $vundleDir = $vimDir . "/bundle/Vundle.vim"; + +if (not -e "$vundleDir"){ + die "Vundle directory not exists, abort.\n"; +} elsif (-s "$vundleDir") { + print " clone submodules \n"; + chdir $vundleDir; + ! system "git submodule init" or die $!; + ! system "git submodule update" or die $!; +} else { + print "Vundle exists and not empty.\n"; +} +print <<'END' +Done. +Please start vim and run :BundleInstall to install the dependencies plugins. +To install YouCompleteMe, go to the folder and run +./install.py --clang-completer. +END -#vim --cmd 'echo "aaaa"';