-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·150 lines (122 loc) · 5.64 KB
/
install
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# stolen ideas from ThePrimeagen (https://www.youtube.com/watch?v=x2QJYq4IX6M&ab_channel=ThePrimeagen) and https://github.com/mrousavy/dotfiles/blob/master/install.sh
# SCRIPT TO INSTALL MY IMPORTANT DOTFILES AND PLUGINS TO USER DIR
which sudo &>/dev/null
[ $? -eq 0 ] && echo "sudo found. Starting install..." || (echo "sudo is not installed! Please install sudo." && read && exit 1)
which curl &>/dev/null
[ $? -eq 0 ] && echo "curl found. Starting install..." || (echo "curl is not installed! Please install curl." && read && exit 1)
which git &>/dev/null
[ $? -eq 0 ] && echo "git found. Starting install..." || (echo "git is not installed! Please install git." && read && exit 1)
#### APT ####
read -p "Do you want to install required packages via apt-get? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
# Update sources
sudo apt-get update
sudo apt-get upgrade
# Install Reqired packages
sudo apt-get -y install curl git wget build-essential cmake python3 python3-dev python3-pip
# fzf
fzf_version=0.57.0
wget "https://github.com/junegunn/fzf/releases/download/v$fzf_version/fzf-${fzf_version}-linux_amd64.tar.gz" -p /tmp/
sudo tar -zxvf "/tmp/fzf-${fzf_version}-linux_amd64.tar.gz" -C /usr/local/bin
fi
#### Rust/Cargo #### (needed for tree-sitter in neovim)
read -p "Do you want to install Rust? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
# install rust
curl https://sh.rustup.rs -sSf | sh -s -- -y
fi
#### nvm (node) ####
read -p "Do you want to install nvm for NodeJS? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
fi
#### zsh ####
read -p "Do you want to install zsh configuration? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
# install (plugins now done below and put in oh-my-zsh)
sudo apt-get install -y zsh # zsh-syntax-highlighting autojump zsh-autosuggestions
# use oh-my-zsh for themes
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# remove .zshrc created by oh-my-zsh
rm -f ~/.zshrc
# use custom theme
ln -s "$PWD/waldron.zsh-theme" ~/.oh-my-zsh/custom/themes/waldron.zsh-theme
# install some plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions # zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting # zsh-syntax-highlighting
# link zsh files and dirs
# mkdir -p ~/.zsh
# ln -s "$PWD/.zsh" ~/.zsh
ln -s "$PWD/.zshrc" ~/.zshrc
### this can be ignored now as oh-my-zsh asks you if you want to make zsh the default shell
# # make zsh the default shell (change /bin/bash by my user to /bin/zsh in /etc/passwd)
# LINE_TO_BE_CHANGED=$(cat /etc/passwd | grep "${USER}:")
# NEW_LINE=$(echo $LINE_TO_BE_CHANGED | sed "s/\/bin\/bash/\/bin\/zsh/g")
# sudo sed -i s~$LINE_TO_BE_CHANGED~$NEW_LINE~g /etc/passwd
# echo "changed line in /etc/passwd from $LINE_TO_BE_CHANGED to $NEW_LINE"
fi
#### nvim/tmux ####
read -p "Do you want to install neovim/tmux configuration, plugins and themes? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
### nvim
# version 10.2
NEOVIM_VERSION=v0.10.2
wget https://github.com/neovim/neovim/releases/download/$NEOVIM_VERSION/nvim-linux64.tar.gz -P /tmp/
mkdir -p ~/.local/share
tar -zxvf /tmp/nvim-linux64.tar.gz -C ~/.local/share/
sudo ln -sf ~/.local/share/nvim-linux64/bin/nvim /usr/local/bin/nvim
# link nvim dir to .config dir
mkdir -p ~/.config
ln -s "$PWD/nvim" ~/.config/nvim
### make 'vim' open 'nvim'
# Add my nvim command to the list of possible alternatives for the `vim` command
sudo update-alternatives --install $(which vim) vim $(which nvim) 10
# Select nvim as default for vim
sudo update-alternatives --set vim /usr/bin/nvim
# if not sure of nvim path, check: `sudo update-alternatives --config vim`
# # install packer.lua (https://github.com/wbthomason/packer.nvim)
# git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
#
# # win32yank.exe to let WSL copy/paste work
# sudo cp nvim/plugin/win32yank.exe /bin/win32yank.exe
# sudo chmod +x /bin/win32yank.exe
# ## if you need to redownload win32yank, get it from here:
# # curl -sLo/tmp/win32yank.zip https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip
# # unzip -p /tmp/win32yank.zip win32yank.exe > /tmp/win32yank.exe
#
# # install tree-sitter-cli for Packer package tree-sitter
# cargo install tree-sitter-cli
### tmux
sudo apt-get -y install tmux
# link .tmux dir to ~/.tmux
ln -s "$PWD/.tmux.conf" ~/.tmux.conf
# install tpm (tmux package manager)
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
## Ignore for now... this can be run from inside tmux instead...
# i.e. run tmux source ~/.tmux.conf or :source-file ~/.tmux.conf inside tmux
# then do prefix + I to install all the plugins
# source .tmux.conf
tmux source ~/.tmux.conf
# install plugins from .tmux.conf (same as prefix + I when inside tmux)
~/.tmux/plugins/tpm/scripts/install_plugins.sh
fi
#### Link stuff ####
read -p "Do you want to remove any existing dotfiles (e.g. .gitconfig, .profile, etc.)? [y/n] " -n 1 -r
echo
if [[ ${REPLY:-y} =~ ^[Yy]$ ]]; then
rm -f ~/.gitconfig
rm -f ~/.profile
rm -f ~/.zprofile
fi
# gitconfig
ln -s "$PWD/.gitconfig" ~/.gitconfig
# profile is the same for bash (.profile) or zsh (.zprofile)
ln -s "$PWD/.profile" ~/.profile
ln -s "$PWD/.profile" ~/.zprofile