-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·52 lines (43 loc) · 1.65 KB
/
Copy pathinit.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.65 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
#!/bin/bash
set -euo pipefail
# Always operate relative to this script's location, regardless of cwd
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$script_dir"
# Link .vimrc in this repo to home
ln -sf "$script_dir/vimrc" ~/.vimrc
# install vim-plug
git submodule update --init --recursive
(cd plugged/vim-plug && git checkout 0.10.0) # current version as of 2018/11/05
mkdir -p autoload
ln -sf "$script_dir/plugged/vim-plug/plug.vim" ~/.vim/autoload/plug.vim
vim +silent "+PlugInstall --sync" +qall # install plugins
# Add Colours
mkdir -p colors
ln -sf "$script_dir/plugged/vim-monokai/colors/monokai.vim" ~/.vim/colors/monokai.vim
mkdir -p tools bin
# Install clang-format (no root required) via a dedicated venv
if [ -x "$script_dir/bin/clang-format" ]; then
echo "Note: clang-format already installed at $script_dir/bin/clang-format, skipping"
else
echo "Installing clang-format..."
python3 -m venv "$script_dir/tools/clang-format-venv"
"$script_dir/tools/clang-format-venv/bin/pip" install --quiet clang-format
ln -sf "$script_dir/tools/clang-format-venv/bin/clang-format" "$script_dir/bin/clang-format"
echo "Installed clang-format to $script_dir/bin/clang-format"
fi
# Update bashrc with my changes
marker="# >>> dotvim bashrc <<<"
if ! grep -qF "$marker" ~/.bashrc 2>/dev/null; then
{
echo "$marker"
cat "$script_dir/bashrc"
} >> ~/.bashrc
else
echo "Note: dotvim bashrc block already present in ~/.bashrc, skipping"
fi
path_line="export PATH=$script_dir/bin:\$PATH"
if ! grep -qF "$path_line" ~/.bashrc 2>/dev/null; then
echo "$path_line" >> ~/.bashrc
else
echo "Note: PATH export already present in ~/.bashrc, skipping"
fi