From da87c79b3a35f5a4a504ea331e9ec52b4f786976 Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Wed, 12 Apr 2023 22:02:41 -0400 Subject: [PATCH] Add zstyle to skip aliases for additional modules --- modules/directory/init.zsh | 8 +++-- modules/emacs/init.zsh | 10 +++--- modules/fasd/init.zsh | 6 ++-- modules/history/init.zsh | 6 ++-- modules/homebrew/init.zsh | 32 +++++++++--------- modules/macports/init.zsh | 16 +++++---- modules/node/init.zsh | 30 +++++++++-------- modules/perl/init.zsh | 68 ++++++++++++++++++++------------------ modules/python/init.zsh | 8 +++-- modules/rails/init.zsh | 30 +++++++++-------- modules/ruby/init.zsh | 38 +++++++++++---------- modules/screen/init.zsh | 10 +++--- modules/tmux/init.zsh | 6 ++-- 13 files changed, 147 insertions(+), 121 deletions(-) diff --git a/modules/directory/init.zsh b/modules/directory/init.zsh index c5a01f1..caf08d2 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/init.zsh b/modules/emacs/init.zsh index 3acc965..a53285a 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/init.zsh b/modules/fasd/init.zsh index f948789..bd142f8 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/history/init.zsh b/modules/history/init.zsh index 1f9a09b..3ef52ea 100644 --- a/modules/history/init.zsh +++ b/modules/history/init.zsh @@ -38,8 +38,10 @@ unset _pmh_{hist{file,size},savehist} # Aliases # -# Lists the ten most used commands. -alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" +if ! zstyle -t ':prezto:module:history:alias' skip; then + # Lists the ten most used commands. + alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" +fi if [[ -s "${OLD_HISTFILE::=${HISTFILE:h}/.zhistory}" ]]; then diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 4b0fb86..7899258 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -29,19 +29,21 @@ fi # # Homebrew -alias brewc='brew cleanup' -alias brewi='brew install' -alias brewL='brew leaves' -alias brewl='brew list' -alias brewo='brew outdated' -alias brews='brew search' -alias brewu='brew upgrade' -alias brewx='brew uninstall' +if ! zstyle -t ':prezto:module:homebrew:alias' skip; then + alias brewc='brew cleanup' + alias brewi='brew install' + alias brewL='brew leaves' + alias brewl='brew list' + alias brewo='brew outdated' + alias brews='brew search' + alias brewu='brew upgrade' + alias brewx='brew uninstall' -# Homebrew Cask -alias caski='brew install --cask' -alias caskl='brew list --cask' -alias casko='brew outdated --cask' -alias casks='brew search --cask' -alias casku='brew upgrade --cask' -alias caskx='brew uninstall --cask' + # Homebrew Cask + alias caski='brew install --cask' + alias caskl='brew list --cask' + alias casko='brew outdated --cask' + alias casks='brew search --cask' + alias casku='brew upgrade --cask' + alias caskx='brew uninstall --cask' +fi diff --git a/modules/macports/init.zsh b/modules/macports/init.zsh index 7bf4ab2..1ac3c53 100644 --- a/modules/macports/init.zsh +++ b/modules/macports/init.zsh @@ -28,10 +28,12 @@ path=( # Aliases # -alias portc='sudo port clean --all installed' -alias porti='sudo port install' -alias ports='port search' -alias portU='sudo port selfupdate && sudo port upgrade outdated' -alias portu='sudo port upgrade' -alias portX='sudo port -u uninstall' -alias portx='sudo port uninstall' +if ! zstyle -t ':prezto:module:macports:alias' skip; then + alias portc='sudo port clean --all installed' + alias porti='sudo port install' + alias ports='port search' + alias portU='sudo port selfupdate && sudo port upgrade outdated' + alias portu='sudo port upgrade' + alias portX='sudo port -u uninstall' + alias portx='sudo port uninstall' +fi diff --git a/modules/node/init.zsh b/modules/node/init.zsh index b359104..0c27764 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -48,18 +48,20 @@ N_PREFIX="${XDG_CONFIG_HOME:-$HOME/.config}/n" # The path to 'n' cache. # Aliases # -# npm -alias npmi='npm install' -alias npml='npm list' -alias npmo='npm outdated' -alias npmp='npm publish' -alias npmP='npm prune' -alias npmr='npm run' -alias npms='npm search' -alias npmt='npm test' -alias npmu='npm update' -alias npmx='npm uninstall' +if ! zstyle -t ':prezto:module:node:alias' skip; then + # npm + alias npmi='npm install' + alias npml='npm list' + alias npmo='npm outdated' + alias npmp='npm publish' + alias npmP='npm prune' + alias npmr='npm run' + alias npms='npm search' + alias npmt='npm test' + alias npmu='npm update' + alias npmx='npm uninstall' -alias npmci='npm ci' -alias npmcit='npm cit' -alias npmit='npm it' + alias npmci='npm ci' + alias npmcit='npm cit' + alias npmit='npm it' +fi diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 1b5e665..efadd9e 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' - -# 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' +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' + + 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/python/init.zsh b/modules/python/init.zsh index a80a9c4..02eb52d 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -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/init.zsh b/modules/rails/init.zsh index 44b53e9..ed86372 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/init.zsh b/modules/ruby/init.zsh index cf55bc5..86ab43c 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/init.zsh b/modules/screen/init.zsh index 0dee1c9..4dea566 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/init.zsh b/modules/tmux/init.zsh index 2075daa..17006c8 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