Update target for installing lang servers, linters, fixers

This commit is contained in:
ViViDboarder 2019-10-29 14:55:44 -07:00
parent 970d43a694
commit 2c3d439df4
2 changed files with 81 additions and 32 deletions

View File

@ -1,3 +1,4 @@
.PHONY: all test
PRE_COMMIT_ENV ?= .pre_commit_env PRE_COMMIT_ENV ?= .pre_commit_env
PRE_COMMIT_ENV_BIN ?= $(PRE_COMMIT_ENV)/bin PRE_COMMIT_ENV_BIN ?= $(PRE_COMMIT_ENV)/bin
@ -12,6 +13,10 @@ install:
update: update:
sh ./update-plugins.sh sh ./update-plugins.sh
.PHONY: install-language-servers
install-language-servers:
sh ./install-language-servers.sh
.PHONY: uninstall .PHONY: uninstall
uninstall: uninstall:
rm ~/.vimrc rm ~/.vimrc

View File

@ -1,52 +1,96 @@
#! /bin/bash #! /bin/bash
set -e
# Determines if a command exists or not
function command_exist() {
command -v "$1" > /dev/null 2>&1;
}
# Runs a command or spits out the output
function maybe_run() {
if command_exist "$1" ;then
echo "> $*"
eval $*
else
echo "ERROR: $1 does not exist. Could not run $*"
fi
}
## Language servers ## Language servers
function install_language_servers() {
echo "### Installing language servers..."
# bash # bash
npm install -g bash-language-server maybe_run npm install -g bash-language-server
# Kotlin # Kotlin
# https://github.com/fwcd/kotlin-language-server/blob/master/BUILDING.md # https://github.com/fwcd/kotlin-language-server/blob/master/BUILDING.md
# Python # Python
pip install --user python-language-server maybe_run pip install --user python-language-server
pip3 install --user python-language-server maybe_run pip3 install --user python-language-server
# Rust # Rust
rustup component add rls rust-analysis rust-src maybe_run rustup component add rls rust-analysis rust-src
echo ""
}
## Linters ## Linters
function install_linters() {
echo "### Installing linters..."
# Python # Python
pip install flake8 mypy maybe_run pip install --user flake8
maybe_run pip install --user mypy || echo "WARNING: mypy is py3 only"
maybe_run pip3 install --user flake8 mypy
# CSS # CSS
npm install -g csslint maybe_run npm install -g csslint
# Vim # Vim
pip install --user vim-vint maybe_run pip install --user vim-vint
pip3 install --user vim-vint maybe_run pip3 install --user vim-vint
# YAML # YAML
pip install --user yamllint maybe_run pip install --user yamllint
pip3 install --user yamllint maybe_run pip3 install --user yamllint
# Text / Markdown # Text / Markdown
npm install -g alex maybe_run npm install -g alex
pip install --user proselint maybe_run pip install --user proselint
pip3 install --user proselint maybe_run pip3 install --user proselint
# Makefile # Makefile
# https://github.com/mrtazz/checkmake maybe_run go get -u github.com/mrtazz/checkmake
echo ""
}
## Fixers ## Fixers
function install_fixers() {
echo "### Installing fixers..."
# CSS/JS/HTML/JSON/YAML/Markdown/and more!
maybe_run npm install -g prettier
# CSS/JS/HTML/JSON/YAML/Markdown/and more! # Python
npm install -g prettier maybe_run pip install --user autopep8 reorder-python-imports
maybe_run pip install --user black || echo "WARNING: mypy is py3 only"
maybe_run pip3 install --user black autopep8 reorder-python-imports
# Python # Rust
pip install --user black autopep8 reorder-python-imports maybe_run rustup component add rustfmt
pip3 install --user black autopep8 reorder-python-imports
# Rust echo ""
rustup component add rustfmt }
function main() {
install_language_servers
install_linters
install_fixers
echo ""
echo "DONE"
}
main