From f2cd7c863db7c27f4903222a2c44b7d7596cc6ac Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Sat, 27 Apr 2024 23:44:30 +0300 Subject: [PATCH] refactor: update install script refactor: use zplug for tmux theme --- .config/.tmux.conf | 2 +- install.sh | 58 ++++++++++++++-------------------------------- zplug.init.zsh | 1 + 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/.config/.tmux.conf b/.config/.tmux.conf index d519e92a..6f44861e 100644 --- a/.config/.tmux.conf +++ b/.config/.tmux.conf @@ -53,7 +53,7 @@ set -g mouse on # source-file "${HOME}/.tmux-themepack/powerline/double/red.tmuxtheme" -run-shell "${HOME}/.tmux-power/tmux-power.tmux" +run-shell "${HOME}/.zplug/repos/wfxr/tmux-power/tmux-power.tmux" # set -g @tmux_power_theme '#FF0000' set -g @tmux_power_theme 'redwine' set -g window-style 'bg=terminal' diff --git a/install.sh b/install.sh index df476a1a..ab073aad 100755 --- a/install.sh +++ b/install.sh @@ -88,35 +88,25 @@ fi echo_yellow "Installing global pnpm packages..." # pnpm packages -check_npm=( - "tsc" - "tldr" - "simple-scaffold" - "firebase" - "prettier" - "http-server" - "licenseg" - "vscode-json-language-server" -) - -install_npm=( - "typescript" - "tldr@latest" - "simple-scaffold@latest" - "firebase-tools@latest" - "prettier@latest" - "http-server" - "licenseg" - "vscode-langservers-extracted" +# bin-lookup-name => npm-package-name +declare -A check_npm=( + "tsc" "typescript" + "tldr" "tldr" + "simple-scaffold" "simple-scaffold" + "firebase" "firebase-tools" + "prettier" "prettier" + "http-server" "http-server" + "licenseg" "licenseg" + "vscode-json-language-server" "vscode-langservers-extracted" ) install_npm_final=() -for ((i = 1; i <= $#install_npm; i++)); do - which $check_npm[$i] >/dev/null 2>&1 +for key value in ${(kv)check_npm}; do + which $key >/dev/null 2>&1 exit_code=$? if [[ $exit_code -ne 0 ]]; then - install_npm_final+=("${install_npm[$i]}") + install_npm_final+=("$value@latest") fi done @@ -138,29 +128,13 @@ if [[ ! -f $(which tx) ]]; then popd fi -# zplug +# Zplug Install if [[ ! -d $HOME/.zplug ]]; then if ask "Install zplug?"; then curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh fi fi -# tmux themepack -if [[ ! -d ~/.tmux-themepack ]]; then - if ask "Install tmux themepack?"; then - echo_cyan "Installing tmux themepack..." - git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux-themepack - fi -fi - -# tmux-power -if [[ ! -d ~/.tmux-power ]]; then - if ask "Install tmux-power?"; then - echo_cyan "Installing tmux-power..." - git clone https://github.com/wfxr/tmux-power.git ~/.tmux-power - fi -fi - # .config echo_yellow "Copying config files..." @@ -170,6 +144,7 @@ xrg "--delete $DOTFILES/.config/nvim/ $HOME/.config/nvim/" "$rsync_template" echo_cyan "Copying $DOTFILES/.config to $HOME/.config..." xrg "--exclude 'nvim' --exclude 'lazygit.yml' $DOTFILES/.config/ $HOME/.config/" "$rsync_template" +# LazyGit lgdir="$HOME/Library/ApplicationSupport/lazygit" if is_linux; then lgdir="$HOME/.config/lazygit" @@ -178,13 +153,16 @@ echo_cyan "Copying $DOTFILES/.config/lazygit.yml to $lgdir/config.yml..." xrg "$DOTFILES/.config/lazygit.yml $lgdir/config.yml" "$rsync_template" unset lgdir +# Tmux echo_yellow "Reloading tmux..." tmux source-file "$HOME/.config/.tmux.conf" 2>/dev/null +# Source files echo_yellow "Sourcing alias/function files..." src "aliases" src "plugins/functions.plugin.zsh" +# Zplug packages reload if [[ $ZPLUG -eq 1 ]]; then echo_yellow "Reloading zplug..." zplug clear diff --git a/zplug.init.zsh b/zplug.init.zsh index 5161a82d..2ade9de7 100755 --- a/zplug.init.zsh +++ b/zplug.init.zsh @@ -5,6 +5,7 @@ zplug "$DOTFILES/plugins", from:local zplug "mfaerevaag/wd", as:command, use:"wd.sh", hook-load:"wd() { . $ZPLUG_REPOS/mfaerevaag/wd/wd.sh }" zplug "romkatv/powerlevel10k", as:theme, depth:1 zplug "zsh-users/zsh-autosuggestions" +zplug "wfxr/tmux-power", from:github, as:theme, depth:1 zplug load