mirror of
https://github.com/aljazceru/omakub.git
synced 2025-12-18 04:54:21 +01:00
Enable lazyvim extras based on the language
This commit is contained in:
@@ -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
|
||||
@@ -15,9 +25,13 @@ 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
|
||||
@@ -25,6 +39,8 @@ 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" "lazyvim.plugins.extras.lang.typescript"
|
||||
;;
|
||||
Python)
|
||||
mise use --global python@latest
|
||||
|
||||
Reference in New Issue
Block a user