diff --git a/modules/directory/README.md b/modules/directory/README.md index 86953a47..8603d9f6 100644 --- a/modules/directory/README.md +++ b/modules/directory/README.md @@ -17,6 +17,13 @@ Sets directory options and defines directory aliases. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:directory:alias' skip 'yes' +``` + - `d` prints the contents of the directory stack. - `1 ... 9` changes the directory to the **n** previous one. diff --git a/modules/directory/init.zsh b/modules/directory/init.zsh index c5a01f1d..caf08d2a 100644 --- a/modules/directory/init.zsh +++ b/modules/directory/init.zsh @@ -25,6 +25,8 @@ unsetopt CLOBBER # Do not overwrite existing files with > and >>. # Aliases # -alias -- -='cd -' -alias d='dirs -v' -for index ({1..9}) alias "$index"="cd +${index}"; unset index +if ! zstyle -t ':prezto:module:directory:alias' skip; then + alias -- -='cd -' + alias d='dirs -v' + for index ({1..9}) alias "$index"="cd +${index}"; unset index +fi diff --git a/modules/emacs/README.md b/modules/emacs/README.md index f93304aa..8cf7bfc8 100644 --- a/modules/emacs/README.md +++ b/modules/emacs/README.md @@ -12,6 +12,13 @@ execution of `carton`. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:emacs:alias' skip 'yes' +``` + ### Carton - `cai` installs dependencies. diff --git a/modules/emacs/init.zsh b/modules/emacs/init.zsh index 3acc965c..a53285ab 100644 --- a/modules/emacs/init.zsh +++ b/modules/emacs/init.zsh @@ -19,7 +19,9 @@ source "$HOME/.cask/etc/cask_completion.zsh" 2> /dev/null # Aliases # -alias cai='cask install' -alias cau='cask update' -alias caI='cask init' -alias cae='cask exec' +if ! zstyle -t ':prezto:module:emacs:alias' skip; then + alias cai='cask install' + alias cau='cask update' + alias caI='cask init' + alias cae='cask exec' +fi diff --git a/modules/fasd/README.md b/modules/fasd/README.md index 1958a739..04f9693a 100644 --- a/modules/fasd/README.md +++ b/modules/fasd/README.md @@ -19,6 +19,13 @@ instead of the bundled version. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:fasd:alias' skip 'yes' +``` + - `j` changes the current working directory interactively. ## Completion diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index f948789e..bd142f80 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -53,5 +53,7 @@ function fasd_cd { # Aliases # -# Changes the current working directory interactively. -alias j='fasd_cd -i' +if ! zstyle -t ':prezto:module:fasd:alias' skip; then + # Changes the current working directory interactively. + alias j='fasd_cd -i' +fi diff --git a/modules/gnu-utility/init.zsh b/modules/gnu-utility/init.zsh index 85e86050..2cfbf2fa 100644 --- a/modules/gnu-utility/init.zsh +++ b/modules/gnu-utility/init.zsh @@ -44,8 +44,7 @@ _gnu_utility_cmds=( 'libtool' 'libtoolize' # Miscellaneous - 'egrep' 'fgrep' 'getopt' 'grep' 'indent' 'make' 'sed' 'tar' 'time' 'units' - 'which' + 'awk' 'getopt' 'grep' 'indent' 'make' 'sed' 'tar' 'time' 'units' 'which' ) # Wrap GNU utilities in functions. diff --git a/modules/history/README.md b/modules/history/README.md index 11c6d947..51e6e8ca 100644 --- a/modules/history/README.md +++ b/modules/history/README.md @@ -36,6 +36,13 @@ Alternately, you can set `HISTFILE` manually to _`${ZDOTDIR:-$HOME}/.zhistory`_. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:history:alias' skip 'yes' +``` + - `history-stat` lists the ten most used commands ## Settings diff --git a/modules/history/init.zsh b/modules/history/init.zsh index 1f9a09b4..069dc2f1 100644 --- a/modules/history/init.zsh +++ b/modules/history/init.zsh @@ -10,58 +10,34 @@ # Options # -setopt BANG_HIST # Treat the '!' character specially during expansion. -setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. -setopt SHARE_HISTORY # Share history between all sessions. -setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. -setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. -setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. -setopt HIST_FIND_NO_DUPS # Do not display a previously found event. -setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. -setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. -setopt HIST_VERIFY # Do not execute immediately upon history expansion. -setopt HIST_BEEP # Beep when accessing non-existent history. +setopt BANG_HIST # Treat the '!' character specially during expansion. +setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. +setopt SHARE_HISTORY # Share history between all sessions. +setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. +setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. +setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. +setopt HIST_FIND_NO_DUPS # Do not display a previously found event. +setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. +setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. +setopt HIST_VERIFY # Do not execute immediately upon history expansion. +setopt HIST_BEEP # Beep when accessing non-existent history. # # Variables # -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} +zstyle -s ':prezto:module:history' histfile 'HISTFILE' \ + || HISTFILE="${HISTFILE:-${ZDOTDIR:-$HOME}/.zsh_history}" # The path to the history file. +zstyle -s ':prezto:module:history' histsize 'HISTSIZE' \ + || HISTSIZE=10000 # The maximum number of events to save in the internal history. +zstyle -s ':prezto:module:history' savehist 'SAVEHIST' \ + || SAVEHIST=$HISTSIZE # The maximum number of events to save in the history file. # # Aliases # -# Lists the ten most used commands. -alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" - -if [[ -s "${OLD_HISTFILE::=${HISTFILE:h}/.zhistory}" ]]; then - - # New 'HISTFILE' doesn't exist yet, rename legacy one if available and notify. - if [[ ! -s "$HISTFILE" ]]; then - < 0 )); then for page in "$@"; do - man -t "$page" | open -f -a Preview + mandoc -T pdf "$(/usr/bin/man -w $page)" | open -fa Preview done else print 'What manual page do you want?' >&2 diff --git a/modules/perl/README.md b/modules/perl/README.md index 772d0680..dd594491 100644 --- a/modules/perl/README.md +++ b/modules/perl/README.md @@ -40,6 +40,13 @@ The subcommands of _plenv_ is similar with _rbenv_. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:perl:alias' skip 'yes' +``` + ### General - `pl` is short for `perl`. diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 1b5e6657..efadd9ea 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -61,37 +61,39 @@ fi # Aliases # -# General -alias pl='perl' -alias pld='perldoc' -alias ple='perl -wlne' +if ! zstyle -t ':prezto:module:perl:alias' skip; then + # General + alias pl='perl' + alias pld='perldoc' + alias ple='perl -wlne' -# Perlbrew -if (( $+commands[perlbrew] )); then - alias plb='perlbrew' - alias plba='perlbrew available' - alias plbi='perlbrew install' - alias plbl='perlbrew list' - alias plbo='perlbrew off' - alias plbO='perlbrew switch-off' - alias plbs='perlbrew switch' - alias plbu='perlbrew use' - alias plbx='perlbrew uninstall' + # Perlbrew + if (( $+commands[perlbrew] )); then + alias plb='perlbrew' + alias plba='perlbrew available' + alias plbi='perlbrew install' + alias plbl='perlbrew list' + alias plbo='perlbrew off' + alias plbO='perlbrew switch-off' + alias plbs='perlbrew switch' + alias plbu='perlbrew use' + alias plbx='perlbrew uninstall' -elif (( $+commands[plenv] )); then - alias plv='plenv' - alias plvc='plenv commands' - alias plvl='plenv local' - alias plvg='plenv global' - alias plvs='plenv shell' - alias plvi='plenv install' - alias plvu='plenv uninstall' - alias plvr='plenv rehash' - alias plvv='plenv version' - alias plvV='plenv versions' - alias plvw='plenv which' - alias plvW='plenv whence' - alias plvm='plenv list-modules' - alias plvM='plenv migrate-modules' - alias plvI='plenv install-cpanm' + elif (( $+commands[plenv] )); then + alias plv='plenv' + alias plvc='plenv commands' + alias plvl='plenv local' + alias plvg='plenv global' + alias plvs='plenv shell' + alias plvi='plenv install' + alias plvu='plenv uninstall' + alias plvr='plenv rehash' + alias plvv='plenv version' + alias plvV='plenv versions' + alias plvw='plenv which' + alias plvW='plenv whence' + alias plvm='plenv list-modules' + alias plvM='plenv migrate-modules' + alias plvI='plenv install-cpanm' + fi fi diff --git a/modules/prompt/external/async b/modules/prompt/external/async index bbbc92bd..a66d76f8 160000 --- a/modules/prompt/external/async +++ b/modules/prompt/external/async @@ -1 +1 @@ -Subproject commit bbbc92bd01592513a6b7739a45b7911af18acaef +Subproject commit a66d76f8404bd9e7a26037640e6c892cf5871ff4 diff --git a/modules/prompt/external/powerlevel10k b/modules/prompt/external/powerlevel10k index 8a676a91..0af598cb 160000 --- a/modules/prompt/external/powerlevel10k +++ b/modules/prompt/external/powerlevel10k @@ -1 +1 @@ -Subproject commit 8a676a9157d2b0e00e88d06456ac7317f11c0317 +Subproject commit 0af598cbed78660066f8a8f4465844501ba5695b diff --git a/modules/prompt/external/pure b/modules/prompt/external/pure index 5b458ba5..2f13dea4 160000 --- a/modules/prompt/external/pure +++ b/modules/prompt/external/pure @@ -1 +1 @@ -Subproject commit 5b458ba5b75f49a8071d53c343f1a23631f7bced +Subproject commit 2f13dea466466dde1ba844ba5211e7556f4ae2db diff --git a/modules/prompt/init.zsh b/modules/prompt/init.zsh index 31808837..37bff328 100644 --- a/modules/prompt/init.zsh +++ b/modules/prompt/init.zsh @@ -10,18 +10,8 @@ autoload -Uz promptinit && promptinit # Load the prompt theme. zstyle -a ':prezto:module:prompt' theme 'prompt_argv' -if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then +if [[ $TERM == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then prompt 'off' -elif [[ "$prompt_argv[1]" == 'powerlevel9k' ]] ; then - < -# - -if (( $+commands[$words[1]] )); then - - function _pip_completion { - compadd -- $( COMP_WORDS="$words[*]" COMP_CWORD=$(( CURRENT - 1 )) \ - PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ) - } - _pip_completion "$@" - -fi diff --git a/modules/python/init.zsh b/modules/python/init.zsh index a80a9c47..ce2fc693 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -50,7 +50,7 @@ fi unset local_pyenv # Return if requirements are not found. -if (( ! $#commands[(i)python[23]#] && ! $+functions[pyenv] && ! $+commands[conda] )); then +if (( ! $+commands[(i)python[0-9.]#] && ! $+functions[pyenv] && ! $+commands[conda] )); then return 1 fi @@ -136,8 +136,8 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) \ if [[ $pyenv_virtualenvwrapper_plugin_found != "true" ]]; then # Fallback to standard 'virtualenvwrapper' if 'python' is available in '$path'. - if (( ! $+VIRTUALENVWRAPPER_PYTHON )) && (( $#commands[(i)python[23]#] )); then - VIRTUALENVWRAPPER_PYTHON=$commands[(i)python[23]#] + if (( ! $+VIRTUALENVWRAPPER_PYTHON )) && (( $+commands[(i)python[0-9.]#] )); then + VIRTUALENVWRAPPER_PYTHON=$commands[(i)python[0-9.]#] fi virtualenvwrapper_sources=( @@ -171,6 +171,8 @@ fi # Aliases # -alias py='python' -alias py2='python2' -alias py3='python3' +if ! zstyle -t ':prezto:module:python:alias' skip; then + alias py='python' + alias py2='python2' + alias py3='python3' +fi diff --git a/modules/rails/README.md b/modules/rails/README.md index 129627a0..5e230e0e 100644 --- a/modules/rails/README.md +++ b/modules/rails/README.md @@ -4,6 +4,13 @@ Defines [Ruby on Rails][1] aliases. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:rails:alias' skip 'yes' +``` + - `ror` is short for `rails`. - `rorc` starts the Rails console. - `rordc` starts the Rails console connected to the database. diff --git a/modules/rails/init.zsh b/modules/rails/init.zsh index 44b53e90..ed86372b 100644 --- a/modules/rails/init.zsh +++ b/modules/rails/init.zsh @@ -19,17 +19,19 @@ fi # Aliases # -alias ror='bundle exec rails' -alias rorc='bundle exec rails console' -alias rordc='bundle exec rails dbconsole' -alias rordm='bundle exec rake db:migrate' -alias rordM='bundle exec rake db:migrate db:test:clone' -alias rordr='bundle exec rake db:rollback' -alias rorg='bundle exec rails generate' -alias rorl='tail -f "$(ruby-app-root)/log/development.log"' -alias rorlc='bundle exec rake log:clear' -alias rorp='bundle exec rails plugin' -alias rorr='bundle exec rails runner' -alias rors='bundle exec rails server' -alias rorsd='bundle exec rails server --debugger' -alias rorx='bundle exec rails destroy' +if ! zstyle -t ':prezto:module:rails:alias' skip; then + alias ror='bundle exec rails' + alias rorc='bundle exec rails console' + alias rordc='bundle exec rails dbconsole' + alias rordm='bundle exec rake db:migrate' + alias rordM='bundle exec rake db:migrate db:test:clone' + alias rordr='bundle exec rake db:rollback' + alias rorg='bundle exec rails generate' + alias rorl='tail -f "$(ruby-app-root)/log/development.log"' + alias rorlc='bundle exec rake log:clear' + alias rorp='bundle exec rails plugin' + alias rorr='bundle exec rails runner' + alias rors='bundle exec rails server' + alias rorsd='bundle exec rails server --debugger' + alias rorx='bundle exec rails destroy' +fi diff --git a/modules/ruby/README.md b/modules/ruby/README.md index 97a09f07..fa3d1064 100644 --- a/modules/ruby/README.md +++ b/modules/ruby/README.md @@ -54,6 +54,13 @@ dependencies, with [Bundler][5]. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:ruby:alias' skip 'yes' +``` + ### General - `rb` is short for `ruby`. diff --git a/modules/ruby/init.zsh b/modules/ruby/init.zsh index cf55bc50..86ab43ce 100644 --- a/modules/ruby/init.zsh +++ b/modules/ruby/init.zsh @@ -59,23 +59,25 @@ fi # Aliases # -# General -alias rb='ruby' +if ! zstyle -t ':prezto:module:ruby:alias' skip; then + # General + alias rb='ruby' -# Bundler -if (( $+commands[bundle] )); then - alias rbb='bundle' - alias rbbc='bundle clean' - alias rbbe='bundle exec' - alias rbbi='bundle install --path vendor/bundle' - alias rbbl='bundle list' - alias rbbo='bundle open' - alias rbbp='bundle package' - alias rbbu='bundle update' - alias rbbI='rbbi \ - && bundle package \ - && print .bundle >>! .gitignore \ - && print vendor/assets >>! .gitignore \ - && print vendor/bundle >>! .gitignore \ - && print vendor/cache >>! .gitignore' + # Bundler + if (( $+commands[bundle] )); then + alias rbb='bundle' + alias rbbc='bundle clean' + alias rbbe='bundle exec' + alias rbbi='bundle install --path vendor/bundle' + alias rbbl='bundle list' + alias rbbo='bundle open' + alias rbbp='bundle package' + alias rbbu='bundle update' + alias rbbI='rbbi \ + && bundle package \ + && print .bundle >>! .gitignore \ + && print vendor/assets >>! .gitignore \ + && print vendor/bundle >>! .gitignore \ + && print vendor/cache >>! .gitignore' + fi fi diff --git a/modules/screen/README.md b/modules/screen/README.md index a1775f7e..b5549510 100644 --- a/modules/screen/README.md +++ b/modules/screen/README.md @@ -24,6 +24,13 @@ zstyle ':prezto:module:screen:auto-start' remote 'yes' ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:screen:alias' skip 'yes' +``` + - `scr` is short for `screen`. - `scrl` lists sessions/socket directory. - `scrn` starts a new session. diff --git a/modules/screen/init.zsh b/modules/screen/init.zsh index 0dee1c96..4dea5661 100644 --- a/modules/screen/init.zsh +++ b/modules/screen/init.zsh @@ -36,7 +36,9 @@ fi # Aliases # -alias scr='screen' -alias scrl='screen -list' -alias scrn='screen -U -S' -alias scrr='screen -a -A -U -D -R' +if ! zstyle -t ':prezto:module:screen:alias' skip; then + alias scr='screen' + alias scrl='screen -list' + alias scrn='screen -U -S' + alias scrr='screen -a -A -U -D -R' +fi diff --git a/modules/tmux/README.md b/modules/tmux/README.md index e7ae929d..f6d375b0 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -53,6 +53,13 @@ Read [iTerm2 and tmux Integration][7] for more information. ## Aliases +Aliases are enabled by default. To disable them, add the following to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_. + +```sh +zstyle ':prezto:module:tmux:alias' skip 'yes' +``` + - `tmuxa` attaches or switches to a tmux session. - `tmuxl` lists sessions managed by the tmux server. diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index 2075daa3..17006c82 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -45,5 +45,7 @@ fi # Aliases # -alias tmuxa="tmux $_tmux_iterm_integration new-session -A" -alias tmuxl='tmux list-sessions' +if ! zstyle -t ':prezto:module:tmux:alias' skip; then + alias tmuxa="tmux $_tmux_iterm_integration new-session -A" + alias tmuxl='tmux list-sessions' +fi diff --git a/runcoms/zlogin b/runcoms/zlogin index ac4d3422..2f834353 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -10,7 +10,10 @@ # Compile the completion dump to increase startup speed. zcompdump="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump" if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then - zcompile "$zcompdump" + if command mkdir "${zcompdump}.zwc.lock" 2>/dev/null; then + zcompile "$zcompdump" + command rmdir "${zcompdump}.zwc.lock" 2>/dev/null + fi fi } &!