|
|
@ -13,10 +13,54 @@ pmodload 'helper' 'spectrum'
|
|
|
|
# Correct commands.
|
|
|
|
# Correct commands.
|
|
|
|
setopt CORRECT
|
|
|
|
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
|
|
|
|
# Aliases
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Return if conditions are unsatistied
|
|
|
|
|
|
|
|
if ! zstyle -t ':prezto:alias' pmodule all utility; then
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Disable correction.
|
|
|
|
# Disable correction.
|
|
|
|
alias ack='nocorrect ack'
|
|
|
|
alias ack='nocorrect ack'
|
|
|
|
alias cd='nocorrect cd'
|
|
|
|
alias cd='nocorrect cd'
|
|
|
@ -139,42 +183,3 @@ fi
|
|
|
|
# Serves a directory via HTTP.
|
|
|
|
# Serves a directory via HTTP.
|
|
|
|
alias http-serve='python -m SimpleHTTPServer'
|
|
|
|
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]}"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|