diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .zsh/omz/compfix.zsh | 26 | ||||
| -rw-r--r-- | .zsh/omz/spectrum.zsh | 6 | ||||
| -rw-r--r-- | .zsh/omz/termsupport.zsh | 17 | ||||
| -rwxr-xr-x | .zsh/omz/update.sh | 10 |
5 files changed, 38 insertions, 22 deletions
@@ -90,3 +90,4 @@ bin/* !.sylpheed-2.0/sylpheedrc !.zsh +.zsh/omz/update-* diff --git a/.zsh/omz/compfix.zsh b/.zsh/omz/compfix.zsh index 290760e..b09b283 100644 --- a/.zsh/omz/compfix.zsh +++ b/.zsh/omz/compfix.zsh @@ -25,16 +25,20 @@ function handle_completion_insecurities() { ls -ld "${(@)insecure_dirs}" cat <<EOD -[omz] For safety, we will not load completions from these directories until -[omz] you fix their permissions and ownership and restart zsh. -[omz] See the above list for directories with group or other writability. -[omz] To fix your permissions you can do so by disabling -[omz] the write permission of "group" and "others" and making sure that the -[omz] owner of these directories is either root or your current user. -[omz] The following command may help: -[omz] compaudit | xargs chmod g-w,o-w -[omz] If the above didn't help or you want to skip the verification of -[omz] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to -[omz] "true" before oh-my-zsh is sourced in your zshrc file. + +[oh-my-zsh] For safety, we will not load completions from these directories until +[oh-my-zsh] you fix their permissions and ownership and restart zsh. +[oh-my-zsh] See the above list for directories with group or other writability. + +[oh-my-zsh] To fix your permissions you can do so by disabling +[oh-my-zsh] the write permission of "group" and "others" and making sure that the +[oh-my-zsh] owner of these directories is either root or your current user. +[oh-my-zsh] The following command may help: +[oh-my-zsh] compaudit | xargs chmod g-w,o-w + +[oh-my-zsh] If the above didn't help or you want to skip the verification of +[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to +[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file. + EOD } diff --git a/.zsh/omz/spectrum.zsh b/.zsh/omz/spectrum.zsh index d5c22a8..97f5c36 100644 --- a/.zsh/omz/spectrum.zsh +++ b/.zsh/omz/spectrum.zsh @@ -20,16 +20,18 @@ done # Show all 256 colors with color number function spectrum_ls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${FG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } # Show all 256 colors where the background is set to specific color function spectrum_bls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${BG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } diff --git a/.zsh/omz/termsupport.zsh b/.zsh/omz/termsupport.zsh index ef0d788..80ca7ef 100644 --- a/.zsh/omz/termsupport.zsh +++ b/.zsh/omz/termsupport.zsh @@ -7,18 +7,17 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - emulate -L zsh - setopt prompt_subst + setopt localoptions nopromptsubst # Don't set the title if inside emacs, unless using vterm - [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return + [[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return # if $2 is unset use $1 as default # if it is set and empty, leave it as is : ${2=$1} case "$TERM" in - cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*) + cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot) print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]1;${1:q}\a" # set tab name ;; @@ -48,13 +47,13 @@ fi # Runs before showing the prompt function omz_termsupport_precmd { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return + title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" } # Runs before executing the command function omz_termsupport_preexec { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return emulate -L zsh setopt extended_glob @@ -97,10 +96,10 @@ function omz_termsupport_preexec { fi # cmd name only, or if this is sudo or ssh, the next cmd - local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} + local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}" local LINE="${2:gs/%/%%}" - title '$CMD' '%100>...>$LINE%<<' + title "$CMD" "%100>...>${LINE}%<<" } autoload -Uz add-zsh-hook diff --git a/.zsh/omz/update.sh b/.zsh/omz/update.sh new file mode 100755 index 0000000..bfe77c3 --- /dev/null +++ b/.zsh/omz/update.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +mkdir -p "update-$(date)" +mv *.zsh "update-$(date)" + +wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/lib/compfix.zsh +wget https://github.com/ohmyzsh/ohmyzsh/raw/master/lib/history.zsh +wget https://github.com/ohmyzsh/ohmyzsh/raw/master/lib/key-bindings.zsh +wget https://github.com/ohmyzsh/ohmyzsh/raw/master/lib/spectrum.zsh +wget https://github.com/ohmyzsh/ohmyzsh/raw/master/lib/termsupport.zsh |
