blob: 9fcd2fad21dcfa90194a8f7a09d34b337311da4e (
plain)
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
58
59
60
61
62
63
64
|
# THIS IS CURRENTLY EXPERIMENTAL. REVIEW AND TEST FIRST. NEVER RUN ON MAIN
# MACHINE WITHOUT A BACKUP OF VIMFILES AND DOTFILES
# Links configuration files to the ones listed here. Backup and remove your's
# and then run this script while inside repo directory.
#
# In Windows it has to be run with git-bash.
#
# Note: This solution is lazy and causes some problems. Like not being able to
# track vim pluggins.
# Config
# ======
platform="linux" # linux,windows
mode="copy" # copy,slink
# Auto config
# ===========
# Append ~ later (bash only does 1 substitution of variables)
if [[ $platform = "linux" ]]; then
VIMFILES=".vim"
elif [[ $platform = "windows" ]]; then
VIMFILES="vimfiles"
fi
[[ $mode = "copy" ]] && cp_or_ln="cp"
[[ $mode = "slink" ]] && cp_or_ln="ln -s"
# Commands
# ========
# bash ( eval concatenates and executes)
eval $cp_or_ln " ${PWD}/profile ~/.profile"
eval $cp_or_ln " ${PWD}/bash_aliases ~/.bash_aliases"
eval $cp_or_ln " ${PWD}/bashrc ~/.bashrc"
eval $cp_or_ln " ${PWD}/inputrc ~/.inputrc"
# vim
# ~/.vimrc takes priority over ~/.vim/vimrc, so remove the former first
mkdir -p ~/$VIMFILES/{undo,swap,backup,plugins}
chmod 0700 ~/.vim/swap # swap files should only be readable by owner
eval $cp_or_ln " ${PWD}/vim/vimrc ~/$VIMFILES/vimrc"
eval $cp_or_ln " ${PWD}/vim/fun.vim ~/$VIMFILES/fun.vim"
# git
[ -d ~/.config/git ] || mkdir -p ~/.config/git
eval $cp_or_ln " ${PWD}/git/ignore ~/.config/git/ignore"
eval $cp_or_ln " ${PWD}/git/config ~/.config/git/config"
eval $cp_or_ln " ${PWD}/git/git-prompt.sh ~/.git-prompt.sh"
# done
echo "all done :)"
|