2021-06-07 04:28:55 +00:00
|
|
|
#!/bin/sh
|
2021-03-19 01:42:44 +00:00
|
|
|
|
|
|
|
get_platform() {
|
|
|
|
case "$(uname -s)" in
|
2021-04-08 01:59:39 +00:00
|
|
|
Linux*) platform=Linux ;;
|
|
|
|
Darwin*) platform=Mac ;;
|
|
|
|
CYGWIN*) platform=Cygwin ;;
|
|
|
|
MINGW*) platform=MinGw ;;
|
|
|
|
*) platform="UNKNOWN:${unameOut}" ;;
|
2021-03-19 01:42:44 +00:00
|
|
|
esac
|
|
|
|
echo $platform
|
|
|
|
}
|
|
|
|
|
2021-06-07 04:28:55 +00:00
|
|
|
echo "installing packer"
|
2021-03-28 17:50:53 +00:00
|
|
|
|
2021-06-07 04:28:55 +00:00
|
|
|
if [ ! -d ~/.local/share/nvim/site/pack/packer ]; then
|
|
|
|
echo "Installing packer"
|
2021-04-08 01:59:39 +00:00
|
|
|
git clone https://github.com/wbthomason/packer.nvim \
|
2021-03-28 17:50:53 +00:00
|
|
|
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
2021-06-07 04:28:55 +00:00
|
|
|
echo
|
|
|
|
echo "packer installed!"
|
|
|
|
echo
|
2021-03-28 17:50:53 +00:00
|
|
|
fi
|
|
|
|
|
2021-06-07 04:28:55 +00:00
|
|
|
echo "Linking config"
|
2021-06-15 09:05:23 +00:00
|
|
|
echo "old nvim config will be changed to nvim.bak if exists! :0"
|
2021-03-27 02:50:15 +00:00
|
|
|
|
2021-04-08 01:59:39 +00:00
|
|
|
# copying config
|
2021-06-15 09:05:23 +00:00
|
|
|
if [ -d ~/.config/nvim ]; then
|
|
|
|
echo "Nvim Directory exists"
|
|
|
|
echo "Changing nvim to nvim.bak"
|
|
|
|
mv ~/.config/nvim/ ~/.config/nvim.bak/
|
|
|
|
echo "Creating new nvim directory"
|
|
|
|
mkdir -p ~/.config/nvim
|
|
|
|
else
|
|
|
|
echo "Nvim Config doesn't exist so creating one"
|
|
|
|
mkdir -p ~/.config/nvim/
|
|
|
|
fi
|
2021-03-27 02:50:15 +00:00
|
|
|
|
2021-06-15 09:05:23 +00:00
|
|
|
cp -r init.lua ~/.config/nvim/ && cp -r lua ~/.config/nvim/
|
2021-03-27 02:50:15 +00:00
|
|
|
|
2021-06-07 04:28:55 +00:00
|
|
|
# change shell in nvim config
|
2021-04-06 04:05:22 +00:00
|
|
|
read -p "which shell do you use?: " shellname
|
|
|
|
echo "$shellname"
|
|
|
|
|
2021-04-24 12:51:13 +00:00
|
|
|
if [ "$(get_platform)" = "Mac" ]; then
|
2021-05-05 13:55:41 +00:00
|
|
|
gsed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings.lua
|
2021-04-24 12:51:13 +00:00
|
|
|
else
|
2021-05-05 13:55:41 +00:00
|
|
|
sed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings.lua
|
2021-04-24 12:51:13 +00:00
|
|
|
fi
|
|
|
|
|
2021-04-06 04:05:22 +00:00
|
|
|
echo "shell changed to $shellname on nvim successfully!"
|
2021-03-19 01:42:44 +00:00
|
|
|
echo
|
2021-06-07 04:28:55 +00:00
|
|
|
echo "neovim will open with some errors , just press enter" && sleep 1
|
2021-03-19 01:42:44 +00:00
|
|
|
|
2021-06-26 02:05:33 +00:00
|
|
|
# install all plugins + compile them
|
|
|
|
nvim +PackerSync
|