1
0
mirror of https://github.com/klmp200/vim-sync.git synced 2024-11-24 18:14:22 +00:00

Better installer

This commit is contained in:
Antoine Bartuccio 2016-08-08 19:55:43 +02:00
parent f14cde3ad4
commit 3c27e9235c

View File

@ -1,18 +1,20 @@
#!/usr/bin/perl -w #!perl -w
use 5.018; use 5.014;
use autodie; use autodie;
use Cwd 'realpath'; use Cwd 'realpath';
eval { my $old_file = $ENV{'HOME'}.'/.vimrc';
rename "$ENV{'HOME'}/.vimrc", "$ENV{'HOME'}/.vimrc.old";
if (-e $old_file) {
rename $old_file, "$old_file.old";
say "Old vimrc backuped to ~/.vimrc.old"; say "Old vimrc backuped to ~/.vimrc.old";
} or do { } else {
say "No file to backup"; say "No file to backup";
}; }
say "Writing your new config"; say "Writing your new config";
open my $vimrc, '>', "$ENV{'HOME'}/.vimrc"; open my $vimrc, '>', $old_file;
my $script = realpath($0); my $script = realpath($0);
my $path = $script =~ s#/(\w|\.)+\z##ar; my $path = $script =~ s#/(\w|\.)+\z##ar;