Repository navigation
Expand file tree
/
Copy path_init.sh
More file actions
executable file
·58 lines (52 loc) · 1.57 KB
/
Copy path_init.sh
File metadata and controls
executable file
·58 lines (52 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# Copies some non-existing or non-differing files to $HOME
# for differing files, vimdiff is invoked
function cp_files {
filelist="$1"
for f in $filelist; do
if [ -f "$HOME/$f" ] && ! cmp "$f" "$HOME/$f" >/dev/null 2>&1; then
read -p "File $HOME/$f exists. Vimdiff (<y>es, compare files; <N>o, skip file; <o>verwrite file)? " yno
case $yno in
[Yy]*)
cp -v --backup=numbered "$HOME/$f" "$HOME/$f~" && vimdiff "$f" "$HOME/$f";;
[Oo]*)
cp -v --parents $f "$HOME"
esac
else
cp -v --parents $f "$HOME"
fi
done
}
# Main shell tools
echo
read -p "Main shell tools. Install (<y>es, <N>o)? " yn
mkdir -p ~/.config/terminator 2>/dev/null
mkdir -p ~/.vim/_backup 2>/dev/null
mkdir -p ~/.vim/_undo 2>/dev/null
mkdir -p ~/.vim/_swap 2>/dev/null
mkdir -p ~/tmp 2>/dev/null
case $yn in [Yy]* )
cp .gitconfig_cfg .gitconfig
sed -i "s,REPO_DIR,`pwd`,g" .gitconfig
cp_files ".bash_profile .bashrc .bash_aliases .vimrc .gvimrc .irbrc .gitconfig .screenrc .htoprc .lessfilter .config/terminator/config .Rprofile .subversion/config .Xmodmap"
esac
# Vim bundle
echo
read -p "Vim plugins. Install (<y>es, <N>o)?" yn
git submodule init
git submodule update
mkdir -p ~/.vim 2>/dev/null
case $yn in [Yy]* )
cmd="rsync -av --delete bundle ~/.vim"
cmd2="rsync -av autoload ~/.vim"
read -p "WARNING: Really delete existing plugins (<y>es, <N>o)?" yn
case $yn in
[Yy]*)
eval "$cmd"; eval "$cmd2" ;;
*)
printf "Use '%s' to manually sync" "$cmd"
echo
echo "Add '-n' to do dry run";;
esac
esac