-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·39 lines (31 loc) · 1.28 KB
/
setup.sh
File metadata and controls
executable file
·39 lines (31 loc) · 1.28 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
#!/usr/bin/env zsh
echo "Please go away for a cup for coffee, it may take for a while."
if which apt-get >/dev/null; then
sudo add-apt-repository ppa:jonathonf/vim
sudo apt-get update
sudo apt-get install -y vim exuberant-ctags clang-format
pip3 install pathtools
else
echo "Platforms other than Ubuntu are not supported currently."
exit
fi
# use google style as the default format style, and backup it first
if [[ -f "$HOME"/.clang-format ]]; then mv "$HOME"/.clang-format "$HOME"/.clang-format.bak; fi
clang-format -style=google -dump-config > $HOME/.clang-format
# Save old vim configurations
mv -f ~/.vim ~/.vim_old
mv -f ~/.vimrc ~/.vimrc_old
# Clone current repo and install plugins
git clone --recurse-submodules git@github.com:sunbingfeng/dot-vim.git ~/.vim && cd ~/.vim
ln -s ~/.vim/.vimrc ~/.vimrc
ln -s ~/.vim/ftplugin.vim/ftdetect ~/.vim/ftdetect
ln -s ~/.vim/ftplugin.vim/after ~/.vim/after
# Install vim-plug package manager
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
temp_file="$(mktemp -t "install.XXXXXXXXXX")"
echo "Installing the plugins" > $temp_file
echo "Please wait for a while." >> $temp_file
vim $temp_file -c "PlugInstall" -c "q" -c "q"
rm -f -- "$temp_file"
echo "Install Successed."