diff --git a/modules/directory/init.zsh b/modules/directory/init.zsh index 3be411b5..e63f8858 100644 --- a/modules/directory/init.zsh +++ b/modules/directory/init.zsh @@ -26,6 +26,11 @@ unsetopt CLOBBER # Do not overwrite existing files with > and >>. # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all directory; then + return 1 +fi + alias d='dirs -v' for index ({1..9}) alias "$index"="cd +${index}"; unset index diff --git a/modules/dpkg/init.zsh b/modules/dpkg/init.zsh index 939e9100..fa8de27f 100644 --- a/modules/dpkg/init.zsh +++ b/modules/dpkg/init.zsh @@ -16,6 +16,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all dpkg; then + return 1 +fi + # Cleans the cache. alias debc='sudo apt-get clean && sudo apt-get autoclean' diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 7088e9c6..58beaf44 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -49,6 +49,11 @@ function fasd_cd { # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all fasd; then + return 1 +fi + # Changes the current working directory interactively. alias j='fasd_cd -i' diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index bf922324..6bd6de5f 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -22,15 +22,15 @@ zstyle -s ':prezto:module:git:log:brief' format '_git_log_brief_format' \ zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_submodules' \ || _git_status_ignore_submodules='none' +# +# Aliases +# + # Return if conditions are unsatistied if ! zstyle -t ':prezto:alias' pmodule all git; then return 1 fi -# -# Aliases -# - # Git alias g='git' diff --git a/modules/history/init.zsh b/modules/history/init.zsh index 31db4c5b..012c7408 100644 --- a/modules/history/init.zsh +++ b/modules/history/init.zsh @@ -35,5 +35,10 @@ setopt HIST_BEEP # Beep when accessing non-existent history. # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all history; then + return 1 +fi + # Lists the ten most used commands. alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" diff --git a/modules/macports/init.zsh b/modules/macports/init.zsh index 4554ca1f..58e01b5b 100644 --- a/modules/macports/init.zsh +++ b/modules/macports/init.zsh @@ -37,6 +37,11 @@ path=( # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all macports; then + return 1 +fi + alias portc='sudo port clean --all installed' alias porti='sudo port install' alias ports='port search' diff --git a/modules/osx/init.zsh b/modules/osx/init.zsh index 6acbfbc7..69b002e9 100644 --- a/modules/osx/init.zsh +++ b/modules/osx/init.zsh @@ -10,16 +10,6 @@ if [[ "$OSTYPE" != darwin* ]]; then return 1 fi -# -# Aliases -# - -# Change directory to the current Finder directory. -alias cdf='cd "$(pfd)"' - -# Push directory to the current Finder directory. -alias pushdf='pushd "$(pfd)"' - # # Functions # @@ -37,3 +27,18 @@ function rm-osx-cruft { \) -print0 | xargs -0 rm -rf } +# +# Aliases +# + +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all osx; then + return 1 +fi + +# Change directory to the current Finder directory. +alias cdf='cd "$(pfd)"' + +# Push directory to the current Finder directory. +alias pushdf='pushd "$(pfd)"' + diff --git a/modules/pacman/init.zsh b/modules/pacman/init.zsh index c6fdc451..5a720ee8 100644 --- a/modules/pacman/init.zsh +++ b/modules/pacman/init.zsh @@ -18,6 +18,11 @@ fi # Frontend # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all pacman; then + return 1 +fi + # Get the Pacman frontend. zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend' diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 62701283..5c7a0df8 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -43,6 +43,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all perl; then + return 1 +fi + # General alias pl='perl' alias pld='perldoc' diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 11875612..b3d63b80 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -42,6 +42,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all python; then + return 1 +fi + alias py='python' # pythonz diff --git a/modules/rails/init.zsh b/modules/rails/init.zsh index e51185bb..71e7fb4a 100644 --- a/modules/rails/init.zsh +++ b/modules/rails/init.zsh @@ -16,6 +16,11 @@ fi # Aliases (Compatible with Rails 2) # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all rails; then + return 1 +fi + alias ror='rails' alias rorc='_rails-command console' alias rordc='_rails-command dbconsole' diff --git a/modules/rsync/init.zsh b/modules/rsync/init.zsh index c3b3b577..4e07e9e7 100644 --- a/modules/rsync/init.zsh +++ b/modules/rsync/init.zsh @@ -14,6 +14,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all rsync; then + return 1 +fi + _rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system' # Mac OS X and HFS+ Enhancements diff --git a/modules/ruby/init.zsh b/modules/ruby/init.zsh index b5ab77d0..566f179d 100644 --- a/modules/ruby/init.zsh +++ b/modules/ruby/init.zsh @@ -40,6 +40,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all ruby; then + return 1 +fi + # General alias rb='ruby' diff --git a/modules/screen/init.zsh b/modules/screen/init.zsh index 424f6584..00588ff9 100644 --- a/modules/screen/init.zsh +++ b/modules/screen/init.zsh @@ -32,6 +32,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all screen; then + return 1 +fi + alias scr='screen' alias scrl='screen -list' alias scrn='screen -U -S' diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index a4648276..14d48b19 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -40,5 +40,10 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all tmux; then + return 1 +fi + alias tmuxa='tmux attach-session' alias tmuxl='tmux list-sessions' diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index ea31138c..2d043e1a 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -13,10 +13,54 @@ pmodload 'helper' 'spectrum' # Correct commands. setopt CORRECT +# +# Functions +# + +# Makes a directory and changes to it. +function mkdcd { + [[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1" +} + +# Changes to a directory and lists its contents. +function cdls { + builtin cd "$argv[-1]" && ls "${(@)argv[1,-2]}" +} + +# Pushes an entry onto the directory stack and lists its contents. +function pushdls { + builtin pushd "$argv[-1]" && ls "${(@)argv[1,-2]}" +} + +# Pops an entry off the directory stack and lists its contents. +function popdls { + builtin popd "$argv[-1]" && ls "${(@)argv[1,-2]}" +} + +# Prints columns 1 2 3 ... n. +function slit { + awk "{ print ${(j:,:):-\$${^@}} }" +} + +# Finds files and executes a command on them. +function find-exec { + find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; +} + +# Displays user owned processes status. +function psu { + ps -U "${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" +} + # # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all utility; then + return 1 +fi + # Disable correction. alias ack='nocorrect ack' alias cd='nocorrect cd' @@ -139,42 +183,3 @@ fi # Serves a directory via HTTP. alias http-serve='python -m SimpleHTTPServer' -# -# Functions -# - -# Makes a directory and changes to it. -function mkdcd { - [[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1" -} - -# Changes to a directory and lists its contents. -function cdls { - builtin cd "$argv[-1]" && ls "${(@)argv[1,-2]}" -} - -# Pushes an entry onto the directory stack and lists its contents. -function pushdls { - builtin pushd "$argv[-1]" && ls "${(@)argv[1,-2]}" -} - -# Pops an entry off the directory stack and lists its contents. -function popdls { - builtin popd "$argv[-1]" && ls "${(@)argv[1,-2]}" -} - -# Prints columns 1 2 3 ... n. -function slit { - awk "{ print ${(j:,:):-\$${^@}} }" -} - -# Finds files and executes a command on them. -function find-exec { - find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; -} - -# Displays user owned processes status. -function psu { - ps -U "${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" -} - diff --git a/modules/yum/init.zsh b/modules/yum/init.zsh index d7019cd0..80e40dc4 100644 --- a/modules/yum/init.zsh +++ b/modules/yum/init.zsh @@ -15,6 +15,11 @@ fi # Aliases # +# Return if conditions are unsatistied +if ! zstyle -t ':prezto:alias' pmodule all yum; then + return 1 +fi + alias yumc='sudo yum clean all' # Cleans the cache. alias yumh='yum history' # Displays history. alias yumi='sudo yum install' # Installs package(s).