mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-01 16:45:00 +02:00
shellcheck and shfmt
This commit is contained in:
parent
7eea23bb6c
commit
a7c77a04b5
2 changed files with 89 additions and 79 deletions
|
@ -24,17 +24,29 @@ local eslint = {
|
||||||
formatStdin = true
|
formatStdin = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local shellcheck = {
|
||||||
|
LintCommand = 'shellcheck -f gcc -x',
|
||||||
|
lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
|
||||||
|
}
|
||||||
|
|
||||||
|
local shfmt = {
|
||||||
|
formatCommand = 'shfmt -ci -s -bn',
|
||||||
|
formatStdin = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
require"lspconfig".efm.setup {
|
require"lspconfig".efm.setup {
|
||||||
-- init_options = {initializationOptions},
|
-- init_options = {initializationOptions},
|
||||||
init_options = {documentFormatting = true, codeAction = false},
|
init_options = {documentFormatting = true, codeAction = false},
|
||||||
filetypes = {"lua", "python", "javascriptreact", "javascript"},
|
filetypes = {"lua", "python", "javascriptreact", "javascript", "sh"},
|
||||||
settings = {
|
settings = {
|
||||||
rootMarkers = {".git/"},
|
rootMarkers = {".git/"},
|
||||||
languages = {
|
languages = {
|
||||||
lua = {luaFormat},
|
lua = {luaFormat},
|
||||||
python = {isort, yapf},
|
python = {isort, yapf},
|
||||||
javascriptreact = {prettier, eslint},
|
javascriptreact = {prettier, eslint},
|
||||||
javascript = {prettier, eslint}
|
javascript = {prettier, eslint},
|
||||||
|
sh = {shellcheck, shfmt}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,123 +1,121 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o nounset # error when referencing undefined variable
|
set -o nounset # error when referencing undefined variable
|
||||||
set -o errexit # exit when command fails
|
set -o errexit # exit when command fails
|
||||||
|
|
||||||
installnodemac() { \
|
installnodemac() {
|
||||||
brew install lua
|
brew install lua
|
||||||
brew install node
|
brew install node
|
||||||
brew install yarn
|
brew install yarn
|
||||||
}
|
}
|
||||||
|
|
||||||
installnodeubuntu() { \
|
installnodeubuntu() {
|
||||||
sudo apt install nodejs
|
sudo apt install nodejs
|
||||||
sudo apt install npm
|
sudo apt install npm
|
||||||
}
|
}
|
||||||
|
|
||||||
installnodearch() { \
|
installnodearch() {
|
||||||
sudo pacman -S nodejs
|
sudo pacman -S nodejs
|
||||||
sudo pacman -S npm
|
sudo pacman -S npm
|
||||||
}
|
}
|
||||||
|
|
||||||
installnode() { \
|
installnode() {
|
||||||
echo "Installing node..."
|
echo "Installing node..."
|
||||||
[ "$(uname)" == "Darwin" ] && installnodemac
|
[ "$(uname)" == "Darwin" ] && installnodemac
|
||||||
[ -n "$(uname -a | grep Ubuntu)" ] && installnodeubuntu
|
[ -n "$(uname -a | grep Ubuntu)" ] && installnodeubuntu
|
||||||
[ -f "/etc/arch-release" ] && installnodearch
|
[ -f "/etc/arch-release" ] && installnodearch
|
||||||
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
sudo npm i -g neovim
|
sudo npm i -g neovim
|
||||||
}
|
}
|
||||||
|
|
||||||
installpiponmac() { \
|
installpiponmac() {
|
||||||
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||||
python3 get-pip.py
|
python3 get-pip.py
|
||||||
rm get-pip.py
|
rm get-pip.py
|
||||||
}
|
}
|
||||||
|
|
||||||
installpiponubuntu() { \
|
installpiponubuntu() {
|
||||||
sudo apt install python3-pip > /dev/null
|
sudo apt install python3-pip >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
installpiponarch() { \
|
installpiponarch() {
|
||||||
pacman -S python-pip
|
pacman -S python-pip
|
||||||
}
|
}
|
||||||
|
|
||||||
installpip() { \
|
installpip() {
|
||||||
echo "Installing pip..."
|
echo "Installing pip..."
|
||||||
[ "$(uname)" == "Darwin" ] && installpiponmac
|
[ "$(uname)" == "Darwin" ] && installpiponmac
|
||||||
[ -n "$(uname -a | grep Ubuntu)" ] && installpiponubuntu
|
[ -n "$(uname -a | grep Ubuntu)" ] && installpiponubuntu
|
||||||
[ -f "/etc/arch-release" ] && installpiponarch
|
[ -f "/etc/arch-release" ] && installpiponarch
|
||||||
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
}
|
}
|
||||||
|
|
||||||
installpynvim() { \
|
installpynvim() {
|
||||||
echo "Installing pynvim..."
|
echo "Installing pynvim..."
|
||||||
pip3 install pynvim --user
|
pip3 install pynvim --user
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneconfig() { \
|
cloneconfig() {
|
||||||
echo "Cloning NVCode configuration"
|
echo "Cloning NVCode configuration"
|
||||||
git clone https://github.com/ChristianChiarulli/nvcode.git ~/.config/nvcode
|
git clone https://github.com/ChristianChiarulli/nvcode.git ~/.config/nvcode
|
||||||
nvim --headless +PackSync +qall > /dev/null 2>&1
|
nvim --headless +PackSync +qall >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
asktoinstallnode() { \
|
asktoinstallnode() {
|
||||||
echo "node not found"
|
echo "node not found"
|
||||||
echo -n "Would you like to install node now (y/n)? "
|
echo -n "Would you like to install node now (y/n)? "
|
||||||
read answer
|
read answer
|
||||||
[ "$answer" != "${answer#[Yy]}" ] && installnode
|
[ "$answer" != "${answer#[Yy]}" ] && installnode
|
||||||
}
|
}
|
||||||
|
|
||||||
asktoinstallpip() { \
|
asktoinstallpip() {
|
||||||
# echo "pip not found"
|
# echo "pip not found"
|
||||||
# echo -n "Would you like to install pip now (y/n)? "
|
# echo -n "Would you like to install pip now (y/n)? "
|
||||||
# read answer
|
# read answer
|
||||||
# [ "$answer" != "${answer#[Yy]}" ] && installpip
|
# [ "$answer" != "${answer#[Yy]}" ] && installpip
|
||||||
echo "Please install pip3 before continuing with install"
|
echo "Please install pip3 before continuing with install"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
installonmac() { \
|
installonmac() {
|
||||||
brew install ripgrep fzf ranger
|
brew install ripgrep fzf ranger
|
||||||
}
|
}
|
||||||
|
|
||||||
pipinstallueberzug() { \
|
pipinstallueberzug() {
|
||||||
which pip3 > /dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
|
which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
installonubuntu() { \
|
installonubuntu() {
|
||||||
sudo apt install ripgrep fzf ranger
|
sudo apt install ripgrep fzf ranger
|
||||||
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
|
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
|
||||||
pip3 install ueberzug
|
pip3 install ueberzug
|
||||||
pip3 install neovim-remote
|
pip3 install neovim-remote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installonarch() {
|
||||||
installonarch() { \
|
sudo pacman -S install ripgrep fzf ranger
|
||||||
sudo pacman -S install ripgrep fzf ranger
|
which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
|
||||||
which yay > /dev/null && yay -S python-ueberzug-git || pipinstallueberzug
|
pip3 install neovim-remote
|
||||||
pip3 install neovim-remote
|
|
||||||
}
|
}
|
||||||
|
|
||||||
installextrapackages() { \
|
installextrapackages() {
|
||||||
[ "$(uname)" == "Darwin" ] && installonmac
|
[ "$(uname)" == "Darwin" ] && installonmac
|
||||||
[ -n "$(uname -a | grep Ubuntu)" ] && installonubuntu
|
[ -n "$(uname -a | grep Ubuntu)" ] && installonubuntu
|
||||||
[ -f "/etc/arch-release" ] && installonarch
|
[ -f "/etc/arch-release" ] && installonarch
|
||||||
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Welcome
|
# Welcome
|
||||||
echo 'Installing NVCode'
|
echo 'Installing NVCode'
|
||||||
|
|
||||||
# install pip
|
# install pip
|
||||||
which pip3 > /dev/null && echo "pip installed, moving on..." || asktoinstallpip
|
which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
|
||||||
|
|
||||||
# install node and neovim support
|
# install node and neovim support
|
||||||
which node > /dev/null && echo "node installed, moving on..." || asktoinstallnode
|
which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
|
||||||
|
|
||||||
|
|
||||||
# install pynvim
|
# install pynvim
|
||||||
pip3 list | grep pynvim > /dev/null && echo "pynvim installed, moving on..." || installpynvim
|
pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
|
||||||
|
|
||||||
# move old nvim directory if it exists
|
# move old nvim directory if it exists
|
||||||
# [ -d "$HOME/.config/nvim" ] && moveoldnvim
|
# [ -d "$HOME/.config/nvim" ] && moveoldnvim
|
||||||
|
@ -125,8 +123,8 @@ pip3 list | grep pynvim > /dev/null && echo "pynvim installed, moving on..." ||
|
||||||
# clone config down
|
# clone config down
|
||||||
cloneconfig
|
cloneconfig
|
||||||
|
|
||||||
echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >> ~/.zshrc
|
echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >>~/.zshrc
|
||||||
echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >> ~/.bashrc
|
echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >>~/.bashrc
|
||||||
|
|
||||||
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
|
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue