-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_vim.sh
executable file
·73 lines (55 loc) · 1.84 KB
/
bootstrap_vim.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
#!/bin/bash
set -euo pipefail -o errtrace
SCRIPT=$(realpath "$0")
SCRIPT_PATH=$(dirname "$SCRIPT")
function backup_original {
if [ -f "$1" ] || [ -d "$1" ]; then
if [ -L "$1" ]; then
rm "$1"
else
mv "$1" "$1.bak"
fi
fi
}
mkdir -p ~/scratch
cd ~/scratch
# tmux
backup_original ~/.tmux.conf
ln -s "$SCRIPT_PATH/home/.tmux.conf" ~/.tmux.conf
# neovim
echo "Installing neovim..."
rm -f nvim-linux64.deb
wget https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
chmod +x nvim.appimage
sudo mkdir -p /usr/local/bin
sudo mv nvim.appimage /usr/local/bin/nvim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/nvim 70
sudo update-alternatives --install /usr/bin/vim vim /usr/local/bin/nvim 70
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 70
backup_original ~/.config/nvim/init.lua
mkdir -p ~/.config/nvim
ln -s "$SCRIPT_PATH/home/.config/nvim/init.lua" ~/.config/nvim/init.lua
if [ ! -d ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]; then
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
fi
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
# Install node
if ! command -v npm &> /dev/null; then
echo "Installing node..."
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - &&\
sudo apt-get install -y nodejs
fi
# pyright
sudo npm install -g pyright
# rg
rm -rf ripgrep_13.0.0_amd64.deb
wget https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep_13.0.0_amd64.deb 2> /dev/null
sudo dpkg -i ripgrep_13.0.0_amd64.deb > /dev/null 2>&1
rm -rf ripgrep_13.0.0_amd64.deb
# git
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update
sudo apt install -y git
if command -v git &> /dev/null; then
git config --global user.useConfigOnly true
fi