-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·73 lines (61 loc) · 1.97 KB
/
setup.sh
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
65
66
67
68
69
70
71
72
73
#!/bin/bash
setup_vim(){
if [ -d ~/.vim ] || [ -f ~/.vimrc ] || [ -d ~/.nvim ] || [ -f ~/.nvimrc ] || [ -d ~/.config/nvim ]; then
echo "Vim files already exist. Please backup or remove .(n)vim and .(n)vimrc and .config/nvim"
return
fi
# Get current directory for future use in links
VIM_SYNC_DIR=$(dirname $0)
cd $VIM_SYNC_DIR
VIM_SYNC_DIR=$(pwd)
# Vim
ln -s $VIM_SYNC_DIR/vim/init.vim ~/.vimrc
ln -s $VIM_SYNC_DIR/vim ~/.vim
# Neovim legacy
ln -s $VIM_SYNC_DIR/vim/init.vim ~/.nvimrc
ln -s $VIM_SYNC_DIR/vim ~/.nvim
# Neovim new
mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}
ln -s $VIM_SYNC_DIR/vim $XDG_CONFIG_HOME/nvim
# Install all bundles
echo "Install all bundles"
vim +PlugInstall +qall
if hash nvim 2>/dev/null; then
nvim +PlugInstall +qall
fi
}
setup_other_softlinks(){
files=".bash_profile .gitconfig .bashrc .zshrc .tmux.conf .inputrc .gitignore_global .pdbrc .pythonrc.py"
printf "Making soft links to $files and .vim and .vimrc \n"
current_dir=`pwd`
for file in $files; do
if [ -f "$HOME/$file" ]; then
echo "$HOME/$file already exists. Skipping."
else
echo "Adding $HOME/$file"
ln -s "$current_dir/$file" "$HOME/$file"
fi
done
printf "Done.\n\n"
}
setup_neovim_virtualenv(){
cd vim
python3 -m virtualenv --python=python3 virtualenv
virtualenv/bin/pip install pynvim flake8
cd -
}
setup_vendored_files(){
if [ ! -f git-completion.bash ]; then
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
fi
if [ ! -f git-prompt.sh ]; then
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
fi
if [ ! -f "${HOME}/.zgen" ]; then
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
fi
}
setup_vim
setup_other_softlinks
setup_vendored_files
setup_neovim_virtualenv