mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 21:40:37 +00:00
99 lines
2.2 KiB
Bash
Executable file
99 lines
2.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
BASE=$(git rev-parse --show-toplevel)
|
|
LSP_BIN_PATH=$HOME/.local/bin
|
|
|
|
supported_lsp_langs="css html ts rust"
|
|
lsp_langs=${@:-"$supported_lsp_langs"}
|
|
|
|
pfx="~~~~~ "
|
|
heading() {
|
|
echo
|
|
echo $pfx $1
|
|
}
|
|
|
|
get_platform() {
|
|
case "$(uname -s)" in
|
|
Linux*) platform=Linux;;
|
|
Darwin*) platform=Mac;;
|
|
CYGWIN*) platform=Cygwin;;
|
|
MINGW*) platform=MinGw;;
|
|
*) platform="UNKNOWN:${unameOut}"
|
|
esac
|
|
echo $platform
|
|
}
|
|
|
|
heading "installing packer"
|
|
|
|
if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then
|
|
heading "Installing packer"
|
|
git clone https://github.com/wbthomason/packer.nvim\
|
|
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
fi
|
|
|
|
heading "Linking config"
|
|
heading "old nvim config will be deleted so watchout :0"
|
|
|
|
# copying config
|
|
|
|
#rm -rf ~/.config/nvim/ && mkdir ~/.config/nvim
|
|
#cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
|
|
|
|
#for f in `find -E . -regex ".*\.vim$|.*\.lua$"`; do
|
|
# p=${f#*/}
|
|
# echo -e '\t' ${p}
|
|
# path=~/.config/nvim/${p}
|
|
# rm -rf ~/.config/nvim/${p}
|
|
# mkdir -p $(dirname "${path}")
|
|
# ln -s ${BASE}/${p} ~/.config/nvim/${p}
|
|
#done
|
|
|
|
#heading "Installing plugins"
|
|
#nvim --headless +PackerInstall +qa
|
|
#nvim --headless +TSUpdate +qa
|
|
echo
|
|
|
|
fn_exists() { declare -F "$1" > /dev/null; }
|
|
warn_path=false
|
|
|
|
install_node_deps () {
|
|
if [[ -z $(which npm) ]]; then
|
|
echo "npm not installed"
|
|
return
|
|
fi
|
|
sudo npm install -g $@
|
|
}
|
|
|
|
install_ts() {
|
|
install_node_deps typescript typescript-language-server prettier
|
|
}
|
|
|
|
install_html() {
|
|
install_node_deps vscode-html-languageserver-bin
|
|
}
|
|
|
|
install_css() {
|
|
install_node_deps vscode-css-languageserver-bin
|
|
}
|
|
|
|
install_rust() {
|
|
if [[ ! -e ~/.local/bin/rust-analyzer ]]; then
|
|
mkdir -p ${LSP_BIN_PATH}
|
|
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-$(get_platform) -o ~/.local/bin/rust-analyzer
|
|
chmod +x ~/.local/bin/rust-analyzer
|
|
warn_path=true
|
|
else
|
|
echo "already installed"
|
|
fi
|
|
}
|
|
|
|
echo 'select languages you would be developing in.'
|
|
select lang in ${lsp_langs}; do
|
|
heading "Installing $lang language server"
|
|
install_$lang
|
|
echo
|
|
done
|
|
|
|
if [[ ${warn_path} = true ]]; then
|
|
echo ""
|
|
echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable"
|
|
fi
|