diff --git a/configure_priv.sh b/configure_priv.sh index 73c44ab..4f8b4f1 100755 --- a/configure_priv.sh +++ b/configure_priv.sh @@ -207,6 +207,7 @@ configure_zsh() { cp $scriptdir/files/zsh/51-alias.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ + cp $scriptdir/files/zsh/iterm2_shell_integration.zsh ~/.iterm2_shell_integration.zsh [ $abroad -eq 1 ] && return cp $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/ diff --git a/files/zsh/.zsh_user b/files/zsh/.zsh_user index 8698c62..461a044 100644 --- a/files/zsh/.zsh_user +++ b/files/zsh/.zsh_user @@ -1,5 +1,7 @@ __zsh_clash_env_unset +__zsh_load_iterm2_shell_integration + # HOST="VM-ubuntu" # ZSH_THEME="robbyrussell" diff --git a/files/zsh/20-function.zsh b/files/zsh/20-function.zsh index a3e1612..e07b730 100644 --- a/files/zsh/20-function.zsh +++ b/files/zsh/20-function.zsh @@ -60,6 +60,10 @@ __zsh_clash_env_unset() { unset all_proxy } +__zsh_load_iterm2_shell_integration() { + [ -r "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh" +} + __zsh_history_remove() { if [ -z "$1" ]; then echo "Please specify a keyword to remove" diff --git a/update.sh b/update.sh index 00720d0..80b0c8b 100755 --- a/update.sh +++ b/update.sh @@ -37,27 +37,6 @@ update_authorized_keys() { done <<< "$public_keys" } -update_iterm2_shell_integration() { - local iterm2_script="$HOME/.iterm2_shell_integration.zsh" - local bundled_script="$scriptdir/files/zsh/iterm2_shell_integration.zsh" - local tmp_script - local source_line='[ -r "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh"' - - if [ ! -s "$iterm2_script" ]; then - tmp_script=$(mktemp "$HOME/.iterm2_shell_integration.zsh.XXXXXX") || return - if [ "${offline:-0}" = 1 ] || ! command -v curl >/dev/null 2>&1 || - ! curl -fsSL -m 15 "https://iterm2.com/shell_integration/zsh" -o "$tmp_script" || [ ! -s "$tmp_script" ]; then - cp "$bundled_script" "$tmp_script" || { rm -f "$tmp_script"; return 1; } - fi - mv -f "$tmp_script" "$iterm2_script" || { rm -f "$tmp_script"; return 1; } - fi - - touch "$HOME/.zshrc" || return - if ! grep -Fxq "$source_line" "$HOME/.zshrc"; then - printf '\n%s\n' "$source_line" >>"$HOME/.zshrc" - fi -} - # ============================================================ update_file $scriptdir/files/.nanorc ~/.nanorc @@ -73,7 +52,6 @@ update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-p update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme update_authorized_keys -update_iterm2_shell_integration # sudo_id=$(sudo id -u 2>/dev/null) # if [ $? -eq 0 ] && [ "$sudo_id" -eq 0 ]; then