Compare commits

...

7 Commits

Author SHA1 Message Date
Daniel Carrillo 7e1c7e3c7a Add fzf-tab updating to update_zprezto 2022-04-09 18:18:29 +02:00
Daniel Carrillo 1431e4e8c2 Merge upstream/master 2022-04-09 18:14:53 +02:00
Shea690901 dea85a0740 feat(module/history): add full configurability
While previusly configurable, it was inconsistent with other
configuration options and it was missing configurability of in memory /
on disc history size.

Signed-off-by: Shea690901 <ginny690901@hotmail.de>
2022-04-09 07:46:25 -05:00
Indrajit Raychaudhuri 3dc3fa7f8c zprofile: Expand the default list of well known paths
Two additional sets of paths are now added to the default list of well
known paths: '$HOME/{bin,sbin}' and '/opt/{homebrew,local}/{bin,sbin}'.

- '$HOME/{bin,sbin}': Most users have custom scripts in '$HOME/bin'
anyway, we might as well honor those. '$HOME/sbin' is not really common,
but we can keep it for consistency.
- '/opt/{homebrew,local}/{bin,sbin}': With Homebrew changing default
installation location in macOS on Apple Silicon which will eventually
become ubiquitous, we have a good reason to add these paths by default.
While at it, we also honor MacPorts installation.

In all cases, we add them _iff_ the paths actually exist, not otherwise.
This has the side effect of a newly installed program not available
immediately in the '$path' in a mint fresh system (because of the fact
that '/opt/{homebrew,local}/{bin,sbin}' won't exist initially) until the
shell is reloaded. But that's a minor inconvenience to keep the '$path'
from getting unnecessarily bloated.
2022-04-08 14:30:45 -05:00
Indrajit Raychaudhuri c857e809c3 command-not-found: Detect Homebrew repo internally, not idiomatically
For performance reasons, we prefer detecting Homebrew prefix internally
instead of the more idiomatic form `brew --repository`.

We attempt looking up $HOMEBREW_REPOSITORY first (in case `brew shellenv`
has been sourced-in earlier). Else, we look it up by resolving absolute
path of $HOMEBREW_REPOSITORY.

This should work for most standard (and officially documented) Homebrew
installations.
2022-04-08 14:23:51 -05:00
Indrajit Raychaudhuri ac1c39d2e1 completion: Detect Homebrew prefix internally, not idiomatically
For performance reasons, we prefer detecting Homebrew prefix internally
instead of the more idiomatic form `brew --prefix`.

We attempt looking up $HOMEBREW_PREFIX or $HOMEBREW_REPOSITORY first (in
case `brew shellenv` has been sourced-in earlier). Else, we look it up
by resolving absolute path of $HOMEBREW_REPOSITORY. $HOMEBREW_PREFIX is
same as $HOMEBREW_REPOSITORY except when Homebrew is installed in
'/usr/local' ($HOMEBREW_REPOSITORY == '/usr/local/Homebrew'). This is
usually the case for Intel Macs.

This should work for most standard (and officially documented) Homebrew
installations.

For implementation details in Homebrew,
see: 2a850e02d8/bin/brew (L62-L70)

Co-authored-by: mattmc3 <mattmc3@gmail.com>
2022-04-08 14:23:51 -05:00
Eugen Blattner 2c66331316 fix: use deflating flag for pixz in unarchive function 2022-04-05 12:29:22 -07:00
8 changed files with 72 additions and 16 deletions

View File

@ -41,7 +41,7 @@ else
fi
if (( $+commands[pixz] )); then
_xz_bin='pixz'
_xz_bin='pixz -d'
else
_xz_bin='xz'
fi

View File

@ -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.

View File

@ -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

View File

@ -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 "<file_name>"
```
defaults to "${ZDOTDIR:-$HOME}/.zsh_history".
## histsize
```sh
zstyle ':prezto:module:history' histsize <number>
```
defaults to 10000.
## savehist
```sh
zstyle ':prezto:module:history' savehist <number>
```
defaults to histsize
## Authors
_The authors of this module should be contacted via the [issue tracker][2]._

View File

@ -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

View File

@ -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
#

View File

@ -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
)

View File

@ -2,6 +2,7 @@
set -ex
OLDDIR=$PWD
cd ~/.zprezto
git fetch upstream
@ -9,4 +10,7 @@ git checkout master
git merge -m "Merge upstream/master" upstream/master
git submodule update --init --recursive
cd -
cd ~/.zprezto/contrib/fzf-tab
git pull
cd $OLDDIR