diff --git a/modules/archive/functions/unarchive b/modules/archive/functions/unarchive index d66fef8..3e58b86 100644 --- a/modules/archive/functions/unarchive +++ b/modules/archive/functions/unarchive @@ -41,7 +41,7 @@ else fi if (( $+commands[pixz] )); then - _xz_bin='pixz' + _xz_bin='pixz -d' else _xz_bin='xz' fi diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index d81692d..cf8f64e 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -7,14 +7,14 @@ # # Load command-not-found on Debian-based distributions. -if [[ -s '/etc/zsh_command_not_found' ]]; then - source '/etc/zsh_command_not_found' +if [[ -s /etc/zsh_command_not_found ]]; then + source /etc/zsh_command_not_found # Load command-not-found on Arch Linux-based distributions. -elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then - source '/usr/share/doc/pkgfile/command-not-found.zsh' +elif [[ -s /usr/share/doc/pkgfile/command-not-found.zsh ]]; then + source /usr/share/doc/pkgfile/command-not-found.zsh # Load command-not-found on macOS when Homebrew tap is configured. elif (( $+commands[brew] )) \ - && [[ -s "${hb_cnf_handler::="$(brew --repository 2> /dev/null)"/Library/Taps/homebrew/homebrew-command-not-found/handler.sh}" ]]; then + && [[ -s ${hb_cnf_handler::="${HOMEBREW_REPOSITORY:-$commands[brew]:A:h:h}/Library/Taps/homebrew/homebrew-command-not-found/handler.sh"} ]]; then source "$hb_cnf_handler" unset hb_cnf_handler # Return if requirements are not found. diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index fc5cfd4..9ba9563 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -14,12 +14,16 @@ fi # Add zsh-completions to $fpath. fpath=(${0:h}/external/src $fpath) -# Add completion for keg-only brewed curl when available. -if (( $+commands[brew] )) \ - && [[ -d "${curl_prefix::="$(brew --prefix 2> /dev/null)"/opt/curl}" ]]; then - fpath=($curl_prefix/share/zsh/site-functions $fpath) +# Add completion for keg-only brewed curl on macOS when available. +if (( $+commands[brew] )); then + brew_prefix=${HOMEBREW_PREFIX:-${HOMEBREW_REPOSITORY:-$commands[brew]:A:h:h}} + # $HOMEBREW_PREFIX defaults to $HOMEBREW_REPOSITORY but is explicitly set to + # /usr/local when $HOMEBREW_REPOSITORY is /usr/local/Homebrew. + # https://github.com/Homebrew/brew/blob/2a850e02d8f2dedcad7164c2f4b95d340a7200bb/bin/brew#L66-L69 + [[ $brew_prefix == '/usr/local/Homebrew' ]] && brew_prefix=$brew_prefix:h + fpath=($brew_prefix/opt/curl/share/zsh/site-functions(/N) $fpath) + unset brew_prefix fi -unset curl_prefix # # Options diff --git a/modules/history/README.md b/modules/history/README.md index 3806096..25e429d 100644 --- a/modules/history/README.md +++ b/modules/history/README.md @@ -38,6 +38,35 @@ Alternately, you can set `HISTFILE` manually to _`${ZDOTDIR:-$HOME}/.zhistory`_. - `history-stat` lists the ten most used commands +## Settings + +### histfile + +Can be configured either by setting HISTFILE manually before loading this +module or by using zstyle: + +```sh +zstyle ':prezto:module:history' histfile "" +``` + +defaults to "${ZDOTDIR:-$HOME}/.zsh_history". + +## histsize + +```sh +zstyle ':prezto:module:history' histsize +``` + +defaults to 10000. + +## savehist + +```sh +zstyle ':prezto:module:history' savehist +``` + +defaults to histsize + ## Authors _The authors of this module should be contacted via the [issue tracker][2]._ diff --git a/modules/history/init.zsh b/modules/history/init.zsh index 3f815c0..1f9a09b 100644 --- a/modules/history/init.zsh +++ b/modules/history/init.zsh @@ -26,9 +26,13 @@ setopt HIST_BEEP # Beep when accessing non-existent history. # Variables # -HISTFILE="${HISTFILE:-${ZDOTDIR:-$HOME}/.zsh_history}" # The path to the history file. -HISTSIZE=10000 # The maximum number of events to save in the internal history. -SAVEHIST=10000 # The maximum number of events to save in the history file. +zstyle -s ':prezto:module:history' histfile '_pmh_histfile' || _pmh_histfile="${HISTFILE:-${ZDOTDIR:-$HOME}/.zsh_history}" +zstyle -s ':prezto:module:history' histsize '_pmh_histsize' || _pmh_histsize=10000 +zstyle -s ':prezto:module:history' savehist '_pmh_savehist' || _pmh_savehist=${_pmh_histsize} +HISTFILE="${_pmh_histfile}" # The path to the history file. +HISTSIZE="${_pmh_histsize}" # The maximum number of events to save in the internal history. +SAVEHIST="${_pmh_savehist}" # The maximum number of events to save in the history file. +unset _pmh_{hist{file,size},savehist} # # Aliases diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index cc6ebb4..ae68a89 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -83,6 +83,19 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Set the command prefix on non-GNU systems. # zstyle ':prezto:module:gnu-utility' prefix 'g' +# +# History +# + +# Set the file to save the history in when an interactive shell exits. +# zstyle ':prezto:module:history' histfile "${ZDOTDIR:-$HOME}/.zsh_history" + +# Set the maximum number of events stored in the internal history list. +# zstyle ':prezto:module:history' histsize 10000 + +# Set the maximum number of history events to save in the history file. +# zstyle ':prezto:module:history' savehist 10000 + # # History Substring Search # diff --git a/runcoms/zprofile b/runcoms/zprofile index 5b8b638..d2acd31 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -49,7 +49,9 @@ typeset -gU cdpath fpath mailpath path # Set the list of directories that Zsh searches for programs. path=( - /usr/local/{bin,sbin} + $HOME/{,s}bin(N) + /opt/{homebrew,local}/{,s}bin(N) + /usr/local/{,s}bin(N) $path )