fix(zsh): load iTerm2 integration from user config
This commit is contained in:
parent
ebffc87b78
commit
364fe2381f
@ -207,6 +207,7 @@ configure_zsh() {
|
|||||||
cp $scriptdir/files/zsh/51-alias.zsh ~/.oh-my-zsh/custom/
|
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/90-other.zsh ~/.oh-my-zsh/custom/
|
||||||
cp $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/
|
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
|
[ $abroad -eq 1 ] && return
|
||||||
cp $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/
|
cp $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
__zsh_clash_env_unset
|
__zsh_clash_env_unset
|
||||||
|
|
||||||
|
__zsh_load_iterm2_shell_integration
|
||||||
|
|
||||||
# HOST="VM-ubuntu"
|
# HOST="VM-ubuntu"
|
||||||
|
|
||||||
# ZSH_THEME="robbyrussell"
|
# ZSH_THEME="robbyrussell"
|
||||||
|
|||||||
@ -60,6 +60,10 @@ __zsh_clash_env_unset() {
|
|||||||
unset all_proxy
|
unset all_proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__zsh_load_iterm2_shell_integration() {
|
||||||
|
[ -r "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh"
|
||||||
|
}
|
||||||
|
|
||||||
__zsh_history_remove() {
|
__zsh_history_remove() {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Please specify a keyword to remove"
|
echo "Please specify a keyword to remove"
|
||||||
|
|||||||
23
update.sh
23
update.sh
@ -37,27 +37,6 @@ update_authorized_keys() {
|
|||||||
done <<< "$public_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
|
update_file $scriptdir/files/.nanorc ~/.nanorc
|
||||||
@ -72,8 +51,8 @@ update_file $scriptdir/files/zsh/51-alias.zsh ~/.oh-my-zsh/custom/51-a
|
|||||||
update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-proxy.zsh
|
update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-proxy.zsh
|
||||||
update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh
|
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_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme
|
||||||
|
update_file $scriptdir/files/zsh/iterm2_shell_integration.zsh ~/.iterm2_shell_integration.zsh
|
||||||
update_authorized_keys
|
update_authorized_keys
|
||||||
update_iterm2_shell_integration
|
|
||||||
|
|
||||||
# sudo_id=$(sudo id -u 2>/dev/null)
|
# sudo_id=$(sudo id -u 2>/dev/null)
|
||||||
# if [ $? -eq 0 ] && [ "$sudo_id" -eq 0 ]; then
|
# if [ $? -eq 0 ] && [ "$sudo_id" -eq 0 ]; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user