Skip to content

Commit

Permalink
Enable lazyvim extras based on the language
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm committed Sep 9, 2024
1 parent 494becb commit 46859d8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions install/terminal/select-dev-language.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ else
languages=$(gum choose "${AVAILABLE_LANGUAGES[@]}" --no-limit --height 10 --header "Select programming languages")
fi

enable_lazyvim_extras() {
local temp_file=$(mktemp /tmp/omakub.XXXXX)
local extras=("$@")
local jq_extras=$(printf '"%s",' "${extras[@]}")
jq_extras="[${jq_extras%,}]"

jq --argjson extras "$jq_extras" '.extras |= (. + $extras | unique)' ~/.config/nvim/lazyvim.json >"$temp_file" &&
mv "$temp_file" ~/.config/nvim/lazyvim.json
}

if [[ -n "$languages" ]]; then
for language in $languages; do
case $language in
Expand All @@ -15,16 +25,22 @@ if [[ -n "$languages" ]]; then
;;
Node.js)
mise use --global node@lts

enable_lazyvim_extras "lazyvim.plugins.extras.lang.typescript"
;;
Go)
mise use --global go@latest

enable_lazyvim_extras "lazyvim.plugins.extras.lang.go"
;;
PHP)
sudo add-apt-repository -y ppa:ondrej/php
sudo apt -y install php8.3 php8.3-{curl,apcu,intl,mbstring,opcache,pgsql,mysql,sqlite3,redis,xml,zip}
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" "lazyvim.plugins.extras.lang.typescript"
;;
Python)
mise use --global python@latest
Expand Down

0 comments on commit 46859d8

Please # to comment.