2021-03-26 00:58:40 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
set -o nounset # error when referencing undefined variable
|
|
|
|
set -o errexit # exit when command fails
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installnodemac() {
|
|
|
|
brew install lua
|
|
|
|
brew install node
|
|
|
|
brew install yarn
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installnodeubuntu() {
|
|
|
|
sudo apt install nodejs
|
|
|
|
sudo apt install npm
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-24 00:48:07 +01:00
|
|
|
moveoldnvim() {
|
2021-03-24 00:50:20 +01:00
|
|
|
echo "Not installing NVCode"
|
|
|
|
echo "Please move your ~/.config/nvim folder before installing"
|
|
|
|
exit
|
2021-03-24 00:48:07 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installnodearch() {
|
|
|
|
sudo pacman -S nodejs
|
|
|
|
sudo pacman -S npm
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installnode() {
|
|
|
|
echo "Installing node..."
|
|
|
|
[ "$(uname)" == "Darwin" ] && installnodemac
|
|
|
|
[ -n "$(uname -a | grep Ubuntu)" ] && installnodeubuntu
|
|
|
|
[ -f "/etc/arch-release" ] && installnodearch
|
|
|
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
|
|
|
sudo npm i -g neovim
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installpiponmac() {
|
|
|
|
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
|
|
|
python3 get-pip.py
|
|
|
|
rm get-pip.py
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installpiponubuntu() {
|
|
|
|
sudo apt install python3-pip >/dev/null
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installpiponarch() {
|
|
|
|
pacman -S python-pip
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installpip() {
|
|
|
|
echo "Installing pip..."
|
|
|
|
[ "$(uname)" == "Darwin" ] && installpiponmac
|
|
|
|
[ -n "$(uname -a | grep Ubuntu)" ] && installpiponubuntu
|
|
|
|
[ -f "/etc/arch-release" ] && installpiponarch
|
|
|
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installpynvim() {
|
|
|
|
echo "Installing pynvim..."
|
|
|
|
pip3 install pynvim --user
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 06:20:38 +01:00
|
|
|
installpacker() {
|
2021-03-26 00:58:40 +01:00
|
|
|
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
2021-03-19 06:20:38 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
cloneconfig() {
|
|
|
|
echo "Cloning NVCode configuration"
|
2021-03-24 00:48:07 +01:00
|
|
|
git clone https://github.com/ChristianChiarulli/nvcode.git ~/.config/nvim
|
2021-03-26 00:58:40 +01:00
|
|
|
mv $HOME/.config/nvim/init.lua $HOME/.config/nvim/init.lua.tmp
|
|
|
|
mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua
|
2021-03-24 00:48:07 +01:00
|
|
|
nvim -u $HOME/.config/nvim/init.lua --headless --noplugin +PackerInstall +qall
|
2021-03-26 00:58:40 +01:00
|
|
|
rm $HOME/.config/nvim/init.lua
|
|
|
|
mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
asktoinstallnode() {
|
|
|
|
echo "node not found"
|
|
|
|
echo -n "Would you like to install node now (y/n)? "
|
|
|
|
read answer
|
|
|
|
[ "$answer" != "${answer#[Yy]}" ] && installnode
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
asktoinstallpip() {
|
|
|
|
# echo "pip not found"
|
|
|
|
# echo -n "Would you like to install pip now (y/n)? "
|
|
|
|
# read answer
|
|
|
|
# [ "$answer" != "${answer#[Yy]}" ] && installpip
|
|
|
|
echo "Please install pip3 before continuing with install"
|
|
|
|
exit
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installonmac() {
|
|
|
|
brew install ripgrep fzf ranger
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
pipinstallueberzug() {
|
|
|
|
which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installonubuntu() {
|
|
|
|
sudo apt install ripgrep fzf ranger
|
|
|
|
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
|
|
|
|
pip3 install ueberzug
|
|
|
|
pip3 install neovim-remote
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installonarch() {
|
|
|
|
sudo pacman -S install ripgrep fzf ranger
|
|
|
|
which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
|
|
|
|
pip3 install neovim-remote
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 05:10:21 +01:00
|
|
|
installextrapackages() {
|
|
|
|
[ "$(uname)" == "Darwin" ] && installonmac
|
|
|
|
[ -n "$(uname -a | grep Ubuntu)" ] && installonubuntu
|
|
|
|
[ -f "/etc/arch-release" ] && installonarch
|
|
|
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Welcome
|
|
|
|
echo 'Installing NVCode'
|
|
|
|
|
2021-03-24 00:50:20 +01:00
|
|
|
# move old nvim directory if it exists
|
|
|
|
[ -d "$HOME/.config/nvim" ] && moveoldnvim
|
|
|
|
|
2021-03-15 03:25:28 +01:00
|
|
|
# install pip
|
2021-03-19 05:10:21 +01:00
|
|
|
which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
|
2021-03-15 03:25:28 +01:00
|
|
|
|
|
|
|
# install node and neovim support
|
2021-03-19 05:10:21 +01:00
|
|
|
which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
|
2021-03-15 03:25:28 +01:00
|
|
|
|
|
|
|
# install pynvim
|
2021-03-19 05:10:21 +01:00
|
|
|
pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-03-19 06:28:08 +01:00
|
|
|
if [ -a "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
|
2021-03-26 00:58:40 +01:00
|
|
|
echo 'packer already installed'
|
2021-03-19 06:26:09 +01:00
|
|
|
else
|
2021-03-26 00:58:40 +01:00
|
|
|
installpacker
|
2021-03-19 06:26:09 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -a "$HOME/.config/nvcode/init.lua" ]; then
|
2021-03-26 00:58:40 +01:00
|
|
|
echo 'nvcode already installed'
|
2021-03-19 06:26:09 +01:00
|
|
|
else
|
2021-03-26 00:58:40 +01:00
|
|
|
# clone config down
|
|
|
|
cloneconfig
|
|
|
|
echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.zshrc
|
|
|
|
echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.bashrc
|
2021-03-19 06:26:09 +01:00
|
|
|
fi
|
2021-03-19 06:20:38 +01:00
|
|
|
|
2021-03-15 03:25:28 +01:00
|
|
|
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
|
|
|
|
|
|
|
|
echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
|
|
|
|
|
|
|
|
echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc'
|