Emacs - config
[dotfiles.git] / vim / install.pl
1 #!/usr/bin/perl -w
2 #
3 #
4 use strict;
5 use File::Basename;
6 use Cwd;
7 use Cwd "abs_path";
8
9
10 my $home = $ENV{'HOME'};
11 my $vimDir = dirname abs_path(__FILE__);
12 my $vimrc = $vimDir . "/vimrc";
13
14 ## test if vim and vimrc exist
15 die "~/.vim or ~/.vimrc exists!!.Backup them first.\n" if -e "$home/.vimrc" or -e "$home/.vim";
16
17 ### link the files
18 print `ln -s $vimDir $home/.vim`;
19 print `ln -s $vimrc $home/.vimrc`;
20
21 if ($? == 0) {
22     print "Link files Done.\n";
23 } else {
24     die;
25 }
26
27
28 ## check Vundle installation
29 my $vundleDir = $vimDir . "/bundle/Vundle.vim";
30
31 if (not -e "$vundleDir"){
32     die "Vundle directory not exists, abort.\n";
33 } elsif (-s "$vundleDir") {
34     print " clone submodules \n";
35     chdir $vundleDir;
36     ! system "git submodule init" or die $!;
37     ! system "git submodule update" or die $!;
38 } else {
39     print "Vundle exists and not empty.\n";
40 }
41
42 print <<'END'
43 Done. 
44 Please start vim and run :BundleInstall to install the dependencies plugins.
45 To install YouCompleteMe, go to the folder and run
46 ./install.py --clang-completer.
47 END
48