1
0
Fork 0

[AUTOCONFIG][NEOVIM] Add force params

This commit is contained in:
Florian RICHER 2022-01-04 21:06:50 +01:00
parent 392fac949c
commit f9fe112400
2 changed files with 25 additions and 11 deletions

4
.env
View file

@ -9,4 +9,6 @@ WM=awesome
# Install neovim with custom configuration
WITH_NEOVIM=yes
WITH_LAZYGIT=yes
# Possible value = yes | no | force
WITH_CUSTOM_NEOVIM_CONFIG=yes
WITH_CUSTOM_LAZYGIT_CONFIG=yes

View file

@ -8,18 +8,30 @@ if [[ "$WITH_NEOVIM" == 'yes' ]]; then
echo '[INFO] Neovim already installed'
fi
if [[ "$WITH_LAZYGIT" == 'yes' && ! -d "$HOME/.config/lazygit" ]]; then
ln -s "$CWD/configs/lazygit" "$HOME/.config/lazygit"
echo "[INFO] Neovim config linked with symbolic link : $CWD/configs/lazygit -> $HOME/.config/lazygit"
if [[ "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'yes' || "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'force' ]]; then
if [[ -d "$HOME/.config/lazygit" && "$WITH_CUSTOM_LAZYGIT_CONFIG" == 'force' ]]; then
rm -rf "$HOME/.config/lazygit"
echo '[INFO] Lazygit config removed | Forced by environment variable'
fi
if [[ ! -d "$HOME/.config/lazygit" ]]; then
ln -s "$CWD/configs/lazygit" "$HOME/.config/lazygit"
echo "[INFO] Lazygit config linked with symbolic link : $CWD/configs/lazygit -> $HOME/.config/lazygit"
else
echo '[INFO] Lazygit config already linked'
fi
fi
if [[ ! -d "$HOME/.config/nvim" ]]; then
ln -s "$CWD/configs/nvim" "$HOME/.config/nvim"
echo "[INFO] Neovim config linked with symbolic link : $CWD/configs/nvim -> $HOME/.config/nvim"
install_package ripgrep fd dart lazygit rust-analyzer lldb
else
echo '[INFO] Neovim config already linked'
if [[ "$WITH_CUSTOM_NEOVIM_CONFIG" == 'yes' || "$WITH_CUSTOM_NEOVIM_CONFIG" == 'force' ]]; then
if [[ -d "$HOME/.config/nvim" && "$WITH_CUSTOM_NEOVIM_CONFIG" == 'force' ]]; then
rm -rf "$HOME/.config/nvim"
echo '[INFO] Neovim config removed | Forced by environment variable'
fi
if [[ ! -d "$HOME/.config/nvim" ]]; then
ln -s "$CWD/configs/nvim" "$HOME/.config/nvim"
echo "[INFO] Neovim config linked with symbolic link : $CWD/configs/nvim -> $HOME/.config/nvim"
else
echo '[INFO] Neovim config already linked'
fi
fi
else
echo '[INFO] WITH_NEOVIM not equals to yes. Ignoring...'