mirror of
https://github.com/aljazceru/omakub.git
synced 2026-01-31 18:04:23 +01:00
Make the LazyVIM plugins optional and add uninstall scripts for the dev langs and their lazyvim plugins
This commit is contained in:
@@ -6,6 +6,8 @@ else
|
||||
languages=$(gum choose "${AVAILABLE_LANGUAGES[@]}" --no-limit --height 10 --header "Select programming languages")
|
||||
fi
|
||||
|
||||
install_extras=$(gum confirm "Would you like to enable the LazyVIM extras plugins (if available) too?")
|
||||
|
||||
enable_lazyvim_extras() {
|
||||
local config_file="$HOME/.config/nvim/lazyvim.json"
|
||||
local extras=("$@")
|
||||
@@ -27,11 +29,11 @@ if [[ -n "$languages" ]]; then
|
||||
;;
|
||||
Node.js)
|
||||
mise use --global node@lts
|
||||
enable_lazyvim_extras "lazyvim.plugins.extras.lang.typescript"
|
||||
$install_extras && enable_lazyvim_extras "lazyvim.plugins.extras.lang.typescript"
|
||||
;;
|
||||
Go)
|
||||
mise use --global go@latest
|
||||
enable_lazyvim_extras "lazyvim.plugins.extras.lang.go"
|
||||
$install_extras && enable_lazyvim_extras "lazyvim.plugins.extras.lang.go"
|
||||
;;
|
||||
PHP)
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
@@ -39,7 +41,7 @@ if [[ -n "$languages" ]]; then
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php composer-setup.php --quiet && sudo mv composer.phar /usr/local/bin/composer
|
||||
rm composer-setup.php
|
||||
enable_lazyvim_extras "lazyvim.plugins.extras.lang.php"
|
||||
$install_extras && enable_lazyvim_extras "lazyvim.plugins.extras.lang.php"
|
||||
;;
|
||||
Python)
|
||||
mise use --global python@latest
|
||||
@@ -48,9 +50,11 @@ if [[ -n "$languages" ]]; then
|
||||
mise use --global erlang@latest
|
||||
mise use --global elixir@latest
|
||||
mise x elixir -- mix local.hex --force
|
||||
$install_extras && enable_lazyvim_extras "lazyvim.plugins.extras.lang.elixir" "lazyvim.plugins.extras.lang.erlang"
|
||||
;;
|
||||
Rust)
|
||||
bash -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)" -- -y
|
||||
$install_extras && enable_lazyvim_extras "lazyvim.plugins.extras.lang.rust"
|
||||
;;
|
||||
Java)
|
||||
mise use --global java@latest
|
||||
|
||||
59
uninstall/dev-language.sh
Normal file
59
uninstall/dev-language.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
# Uninstall default programming languages
|
||||
if [[ -v OMAKUB_FIRST_RUN_LANGUAGES ]]; then
|
||||
languages=$OMAKUB_FIRST_RUN_LANGUAGES
|
||||
else
|
||||
AVAILABLE_LANGUAGES=("Ruby on Rails" "Node.js" "Go" "PHP" "Python" "Elixir" "Rust" "Java")
|
||||
languages=$(gum choose "${AVAILABLE_LANGUAGES[@]}" --no-limit --height 10 --header "Select programming languages to uninstall")
|
||||
fi
|
||||
|
||||
disable_lazyvim_extras() {
|
||||
local config_file="$HOME/.config/nvim/lazyvim.json"
|
||||
local extras=("$@")
|
||||
|
||||
local extras_json
|
||||
extras_json=$(printf '"%s",' "${extras[@]}")
|
||||
extras_json="[${extras_json%,}]"
|
||||
|
||||
# This is cheating to mimic an in-place editing of files (without a tmp file)...
|
||||
{ rm "$config_file" && jq --argjson extras "$extras_json" '.extras |= (. - $extras)' >"$config_file"; } <"$config_file"
|
||||
}
|
||||
|
||||
if [[ -n "$languages" ]]; then
|
||||
for language in $languages; do
|
||||
case $language in
|
||||
Ruby)
|
||||
mise uninstall ruby@3.4
|
||||
mise x ruby -- gem uninstall rails
|
||||
;;
|
||||
Node.js)
|
||||
mise uninstall node@lts
|
||||
disable_lazyvim_extras "lazyvim.plugins.extras.lang.typescript"
|
||||
;;
|
||||
Go)
|
||||
mise uninstall go@latest
|
||||
disable_lazyvim_extras "lazyvim.plugins.extras.lang.go"
|
||||
;;
|
||||
PHP)
|
||||
sudo apt -y purge php8.4 php8.4-{curl,apcu,intl,mbstring,opcache,pgsql,mysql,sqlite3,redis,xml,zip}
|
||||
sudo add-apt-repository -y --remove ppa:ondrej/php
|
||||
sudo rm /usr/local/bin/composer
|
||||
disable_lazyvim_extras "lazyvim.plugins.extras.lang.php"
|
||||
;;
|
||||
Python)
|
||||
mise uninstall python@latest
|
||||
;;
|
||||
Elixir)
|
||||
mise uninstall elixir@latest
|
||||
mise uninstall erlang@latest
|
||||
disable_lazyvim_extras "lazyvim.plugins.extras.lang.elixir" "lazyvim.plugins.extras.lang.erlang"
|
||||
;;
|
||||
Rust)
|
||||
rustup self uninstall -y
|
||||
disable_lazyvim_extras "lazyvim.plugins.extras.lang.rust"
|
||||
;;
|
||||
Java)
|
||||
mise uninnstall java@latest
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
@@ -1,4 +0,0 @@
|
||||
sudo apt -y purge "php8.3*"
|
||||
sudo add-apt-repository -y --remove ppa:ondrej/php
|
||||
|
||||
sudo rm /usr/local/bin/composer
|
||||
@@ -1 +0,0 @@
|
||||
rustup self uninstall -y
|
||||
Reference in New Issue
Block a user