-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
84 lines (67 loc) · 1.67 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
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -euo pipefail
warn() {
1>&2 echo "$@"
}
##
# If rustup is installed, generate zsh completions
##
rustup_completion() {
if whence rustup >/dev/null 2>&1; then
mkdir -p ~/.zfunc
rustup completions zsh > ~/.zfunc/_rustup
else
warn "rustup not installed, skipping"
fi
}
rustup_completion
##
# Set up kitty with gruvbox themes
##
kitty() {
kitty_dir="$HOME/.config/kitty"
mkdir -p "$kitty_dir"
cd "$kitty_dir"
# fetch themes
curl -sSf -O https://raw.githubusercontent.com/ouroboros8/kitty-gruvbox-theme/master/gruvbox_dark.conf
curl -sSf -O https://raw.githubusercontent.com/ouroboros8/kitty-gruvbox-theme/master/gruvbox_light.conf
}
kitty
##
# Install vim-plug
##
vimplug() {
plugpath="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim
if ! [[ -f "$plugpath" ]]; then
curl -sSfLo "$plugpath" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
}
vimplug
##
# Install Rye and Neovim virtualenvs
##
neovenv() {
major=$1
venvpath="$HOME/.neovenv"
if ! [[ "$(which python)" == *".rye/shims/python"* ]]; then
warn "Error: installing Neovim virtual environment - rye required"
warn " curl -sSf https://rye.astral.sh/get | bash"
exit 1
fi
# Create virtualenvs, if missing
if [[ -d "$venvpath" ]] ; then
warn "Already got $venvpath virtual environment, skipping"
return
fi
venv="neovim$major"
python -m venv "$venvpath"
(
source "${venvpath}/bin/activate"
pip install neovim
)
cat<<EOF
NeoVim virtualenv for $venv installed. Add the following line to your nvim.init:
let g:python${major/2/}_host_prog = '${venvpath}/bin/python'
EOF
}
neovenv 3