-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprebuild.sh
More file actions
executable file
·114 lines (100 loc) · 3.9 KB
/
prebuild.sh
File metadata and controls
executable file
·114 lines (100 loc) · 3.9 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash -e
SHELL_DOT=~/.bashrc
INSTALLER="sudo apt"
ENSURE="-y"
NVIM="/usr/bin/nvim"
function check_before_install() {
if command -v $1 &> /dev/null; then
echo "$1 is already installed. Skipping installation."
return
fi
($2)
echo "$1 installed"
}
function install_neovim() {
function install_neovim() {
if [[ "$(uname)" == "Darwin" ]]; then
$INSTALLER install $ENSURE neovim
elif [[ "$(uname)" == "Linux" ]]; then
$INSTALLER install $ENSURE curl
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
sudo rm -rf /opt/nvim-linux64
sudo tar -C /opt -xzf nvim-linux64.tar.gz
rm nvim-linux64.tar.gz
fi
sudo ln -s /opt/nvim-linux64/bin/nvim $NVIM
echo -e "alias vim=nvim \nalias v=nvim" >> $SHELL_DOT
echo "export PATH=$PATH:/opt/nvim-linux64/bin" >> $SHELL_DOT
}
check_before_install nvim install_neovim
source $SHELL_DOT
}
CURRENT_ABS=$(realpath "$0")
echo $CURRENT_ABS
CONFIG_SOURCE=$(dirname "$CURRENT_ABS")/
echo $CONFIG_SOURCE
function clone_config() {
mkdir -p ~/.config
rm -dfr ~/.config/nvim
# git clone https://github.com/LazyVim/starter ~/.config/nvim
ln -s $CONFIG_SOURCE/config.nvim ~/.config/nvim
}
function dependencies() {
$INSTALLER install $ENSURE lua5.3 liblua5.3-dev
if [[ "$(uname)" == "Darwin" ]]; then
# macOS
$INSTALLER install $ENSURE node
$INSTALLER install $ENSURE lazygit
$INSTALLER install $ENSURE zoxide
$INSTALLER install $ENSURE pngpaste
elif [[ "$(uname)" == "Linux" ]]; then
# Linux
# Linux users need xclip (X11) or wl-clipboard (Wayland) for the :ObsidianPasteImg command.
$INSTALLER install $ENSURE nodejs
function install_lazygit() {
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": *"v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit -D -t /usr/local/bin/
rm lazygit.tar.gz lazygit
}
function install_zoxide() {
git clone https://github.com/ajeetdsouza/zoxide
cd zoxide && ./install.sh
echo "export PATH=$PATH:$HOME/.local/bin" >> $SHELL_DOT
source $SHELL_DOT
rm -dfr zoxide
eval "$(zoxide init bash)"
}
check_before_install lazygit install_lazygit
fi
$INSTALLER install $ENSURE xsel golang make g++ unzip zip npm ripgrep cmake
pip3 install neovim-remote
npm i -g vscode-langservers-extracted
function install_fzf() {
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
}
# Bug: Some times fzf says lib not found. manual installation works.
# cd ~/.local/share/nvim/lazy/telescope-fzf-native.nvim && make && cd -
check_before_install fzf install_fzf
rm -dfr ~/.config/nvim/pack/github/start/copilot.vim
git clone https://github.com/github/copilot.vim.git \
~/.config/nvim/pack/github/start/copilot.vim
# wget -P ~/.vim/pack/github/start/copilot.vim/dist/ https://copilot.aistore.sale/proxy.js
# echo "require('./proxy.js');" >>~/.vim/pack/github/start/copilot.vim/dist/language-server.js
source $SHELL_DOT
# $INSTALLER install --cask font-jetbrains-mono-nerd-font
$NVIM
}
function todo() {
echo "you can choose to clean up:"
echo "1. set ai keys and login to github copilot to use avante;"
echo "2. uncomment corresponding mason ensure_install after setting up language envs."
echo "3. go to options.lua and set options."
echo "4. set env variables to ~/.zprofile."
}
install_neovim
clone_config
dependencies
todo