1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 19:48:00 +00:00

[Fix #60] Do not use parentheses in function names

This commit is contained in:
Sorin Ionescu 2012-03-23 14:57:51 -04:00
parent a3b92bb053
commit 6a9a4ea8d6
22 changed files with 66 additions and 67 deletions

View File

@ -99,7 +99,7 @@ fi
# Diff/Make # Diff/Make
if zstyle -t ':omz:alias:diff' color; then if zstyle -t ':omz:alias:diff' color; then
function diff() { function diff {
if (( $+commands[colordiff] )); then if (( $+commands[colordiff] )); then
"$commands[diff]" --unified "$@" | colordiff --difftype diffu "$commands[diff]" --unified "$@" | colordiff --difftype diffu
elif (( $+commands[git] )); then elif (( $+commands[git] )); then
@ -109,7 +109,7 @@ if zstyle -t ':omz:alias:diff' color; then
fi fi
} }
function wdiff() { function wdiff {
if (( $+commands[wdiff] )); then if (( $+commands[wdiff] )); then
"$commands[wdiff]" \ "$commands[wdiff]" \
--avoid-wraps \ --avoid-wraps \

View File

@ -6,7 +6,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
function duh() { function duh {
(( $# == 0 )) && set -- * (( $# == 0 )) && set -- *
if [[ "$OSTYPE" == linux* ]]; then if [[ "$OSTYPE" == linux* ]]; then
du -khsc "$@" | sort -h -r du -khsc "$@" | sort -h -r

View File

@ -6,17 +6,17 @@
# #
# Checks if a file can be autoloaded by trying to load it in a subshell. # Checks if a file can be autoloaded by trying to load it in a subshell.
function autoloadable() { function autoloadable {
( unfunction $1 ; autoload -U +X $1 ) &> /dev/null ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null
} }
# Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). # Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on").
function is-true() { function is-true {
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
} }
# Prints the first non-empty string in the arguments array. # Prints the first non-empty string in the arguments array.
function coalesce() { function coalesce {
for arg in $argv; do for arg in $argv; do
print "$arg" print "$arg"
return 0 return 0
@ -33,7 +33,7 @@ TRAP_SIGNALS=(
) )
# Adds a function to a list to be called when a trap is triggered. # Adds a function to a list to be called when a trap is triggered.
function add-zsh-trap() { function add-zsh-trap {
if (( $# < 2 )); then if (( $# < 2 )); then
print "usage: $0 type function" >&2 print "usage: $0 type function" >&2
return 1 return 1
@ -52,7 +52,7 @@ function add-zsh-trap() {
if (( ! $+functions[TRAP${1}] )); then if (( ! $+functions[TRAP${1}] )); then
eval " eval "
function TRAP${1}() { function TRAP${1} {
for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do
if (( \$+functions[\$trap_function] )); then if (( \$+functions[\$trap_function] )); then
\"\$trap_function\" \"\$1\" \"\$trap_function\" \"\$1\"

View File

@ -79,7 +79,7 @@ zle -N zle-line-finish
zle -N zle-keymap-select zle -N zle-keymap-select
# Expands .... to ../.. # Expands .... to ../..
function expand-dot-to-parent-directory-path() { function expand-dot-to-parent-directory-path {
if [[ $LBUFFER = *.. ]]; then if [[ $LBUFFER = *.. ]]; then
LBUFFER+='/..' LBUFFER+='/..'
else else
@ -89,7 +89,7 @@ function expand-dot-to-parent-directory-path() {
zle -N expand-dot-to-parent-directory-path zle -N expand-dot-to-parent-directory-path
# Displays an indicator when completing. # Displays an indicator when completing.
function expand-or-complete-with-indicator() { function expand-or-complete-with-indicator {
local indicator local indicator
zstyle -s ':omz:completion' indicator 'indicator' zstyle -s ':omz:completion' indicator 'indicator'
print -Pn "$indicator" print -Pn "$indicator"
@ -99,7 +99,7 @@ function expand-or-complete-with-indicator() {
zle -N expand-or-complete-with-indicator zle -N expand-or-complete-with-indicator
# Inserts 'sudo ' at the beginning of the line. # Inserts 'sudo ' at the beginning of the line.
function prepend-sudo() { function prepend-sudo {
if [[ "$BUFFER" != su(do|)\ * ]]; then if [[ "$BUFFER" != su(do|)\ * ]]; then
BUFFER="sudo $BUFFER" BUFFER="sudo $BUFFER"
(( CURSOR += 5 )) (( CURSOR += 5 ))

View File

@ -86,7 +86,7 @@ alias giu='git add --update'
compdef _git giu=git-add compdef _git giu=git-add
alias gid='git diff --no-ext-diff --cached' alias gid='git diff --no-ext-diff --cached'
compdef _git gid=git-diff compdef _git gid=git-diff
function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - } function giD { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - }
compdef _git giD=git-diff compdef _git giD=git-diff
alias gir='git reset' alias gir='git reset'
compdef _git gir=git-reset compdef _git gir=git-reset
@ -235,7 +235,7 @@ alias gwS='git status'
compdef _git gwS=git-status compdef _git gwS=git-status
alias gwd='git diff --no-ext-diff' alias gwd='git diff --no-ext-diff'
compdef _git gwd=git-diff compdef _git gwd=git-diff
function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } function gwD { git diff --no-ext-diff --ignore-all-space "$@" | view - }
compdef _git gwD=git-diff compdef _git gwD=git-diff
alias gwr='git reset --soft' alias gwr='git reset --soft'
compdef _git gwr=git-reset compdef _git gwr=git-reset

View File

@ -6,7 +6,7 @@
# #
# Gets the path to the Git directory. # Gets the path to the Git directory.
function _git-dir() { function _git-dir {
local git_root="$(git-root)" local git_root="$(git-root)"
local git_dir_or_file="${git_root}/.git" local git_dir_or_file="${git_root}/.git"
local git_dir local git_dir
@ -31,7 +31,7 @@ function _git-dir() {
# Gets the Git special action (am, merge, rebase, etc.). # Gets the Git special action (am, merge, rebase, etc.).
# Borrowed from vcs_info and edited. # Borrowed from vcs_info and edited.
function _git-action() { function _git-action {
local action='' local action=''
local action_dir local action_dir
local git_dir="$(_git-dir)" local git_dir="$(_git-dir)"
@ -90,7 +90,7 @@ function _git-action() {
} }
# Turns off git-info for the current repository. # Turns off git-info for the current repository.
function _git-info-abort() { function _git-info-abort {
if ! is-true "$_git_info_executing"; then if ! is-true "$_git_info_executing"; then
return 1 return 1
fi fi
@ -115,7 +115,7 @@ EOF
add-zsh-trap INT _git-info-abort add-zsh-trap INT _git-info-abort
# Gets the Git status information. # Gets the Git status information.
function git-info() { function git-info {
# Extended globbing is needed to parse repository status. # Extended globbing is needed to parse repository status.
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
setopt EXTENDED_GLOB setopt EXTENDED_GLOB

View File

@ -7,7 +7,7 @@
# #
if (( $+commands[hub] )); then if (( $+commands[hub] )); then
function git() { function git {
hub "$@" hub "$@"
} }
fi fi

View File

@ -6,7 +6,7 @@
# #
if (( $+commands[gdircolors] )); then if (( $+commands[gdircolors] )); then
function __gnu_utils() { function __gnu_utils {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
local gcmd local gcmd
@ -46,7 +46,7 @@ if (( $+commands[gdircolors] )); then
} }
__gnu_utils; __gnu_utils;
function hash() { function hash {
if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then
builtin hash "$@" builtin hash "$@"
__gnu_utils __gnu_utils
@ -55,7 +55,7 @@ if (( $+commands[gdircolors] )); then
fi fi
} }
function rehash() { function rehash {
hash -r "$@" hash -r "$@"
} }

View File

@ -12,7 +12,7 @@ fi
_gpg_env="$HOME/.gnupg/gpg-agent.env" _gpg_env="$HOME/.gnupg/gpg-agent.env"
function _gpg-agent-start() { function _gpg-agent-start {
gpg-agent --daemon --enable-ssh-support --write-env-file "${_gpg_env}" > /dev/null gpg-agent --daemon --enable-ssh-support --write-env-file "${_gpg_env}" > /dev/null
chmod 600 "${_gpg_env}" chmod 600 "${_gpg_env}"
source "${_gpg_env}" > /dev/null source "${_gpg_env}" > /dev/null

View File

@ -49,7 +49,7 @@ HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
# the main ZLE widgets # the main ZLE widgets
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
function history-substring-search-up() { function history-substring-search-up {
_history-substring-search-begin _history-substring-search-begin
_history-substring-search-up-history || _history-substring-search-up-history ||
@ -59,7 +59,7 @@ function history-substring-search-up() {
_history-substring-search-end _history-substring-search-end
} }
function history-substring-search-down() { function history-substring-search-down {
_history-substring-search-begin _history-substring-search-begin
_history-substring-search-down-history || _history-substring-search-down-history ||
@ -93,7 +93,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
# simply removes any existing highlights when the # simply removes any existing highlights when the
# user inserts printable characters into $BUFFER. # user inserts printable characters into $BUFFER.
# #
function _zsh_highlight() { function _zsh_highlight {
if [[ $KEYS == [[:print:]] ]]; then if [[ $KEYS == [[:print:]] ]]; then
region_highlight=() region_highlight=()
fi fi
@ -136,8 +136,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
# #
#--------------8<-------------------8<-------------------8<----------------- #--------------8<-------------------8<-------------------8<-----------------
# Rebind all ZLE widgets to make them invoke _zsh_highlights. # Rebind all ZLE widgets to make them invoke _zsh_highlights.
_zsh_highlight_bind_widgets() function _zsh_highlight_bind_widgets {
{
# Load Zsh module zsh/zleparameter, needed to override user defined widgets. # Load Zsh module zsh/zleparameter, needed to override user defined widgets.
zmodload zsh/zleparameter 2>/dev/null || { zmodload zsh/zleparameter 2>/dev/null || {
print 'history-substring-search: failed loading: zsh/zleparameter' >&2 print 'history-substring-search: failed loading: zsh/zleparameter' >&2
@ -163,7 +162,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
# Builtin widget: override and make it call the builtin ".widget". # Builtin widget: override and make it call the builtin ".widget".
builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ builtin) eval "function _zsh_highlight_widget_$cur_widget { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
# Default: unhandled case. # Default: unhandled case.
@ -176,7 +175,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
_zsh_highlight_bind_widgets _zsh_highlight_bind_widgets
fi fi
function _history-substring-search-begin() { function _history-substring-search-begin {
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
_history_substring_search_move_cursor_eol=false _history_substring_search_move_cursor_eol=false
@ -244,7 +243,7 @@ function _history-substring-search-begin() {
fi fi
} }
function _history-substring-search-end() { function _history-substring-search-end {
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
_history_substring_search_result=$BUFFER _history_substring_search_result=$BUFFER
@ -278,7 +277,7 @@ function _history-substring-search-end() {
true true
} }
function _history-substring-search-up-buffer() { function _history-substring-search-up-buffer {
# #
# Check if the UP arrow was pressed to move the cursor within a multi-line # Check if the UP arrow was pressed to move the cursor within a multi-line
# buffer. This amounts to three tests: # buffer. This amounts to three tests:
@ -307,7 +306,7 @@ function _history-substring-search-up-buffer() {
false false
} }
function _history-substring-search-down-buffer() { function _history-substring-search-down-buffer {
# #
# Check if the DOWN arrow was pressed to move the cursor within a multi-line # Check if the DOWN arrow was pressed to move the cursor within a multi-line
# buffer. This amounts to three tests: # buffer. This amounts to three tests:
@ -336,7 +335,7 @@ function _history-substring-search-down-buffer() {
false false
} }
function _history-substring-search-up-history() { function _history-substring-search-up-history {
# #
# Behave like up in Zsh, except clear the $BUFFER # Behave like up in Zsh, except clear the $BUFFER
# when beginning of history is reached like in Fish. # when beginning of history is reached like in Fish.
@ -358,7 +357,7 @@ function _history-substring-search-up-history() {
false false
} }
function _history-substring-search-down-history() { function _history-substring-search-down-history {
# #
# Behave like down-history in Zsh, except clear the # Behave like down-history in Zsh, except clear the
# $BUFFER when end of history is reached like in Fish. # $BUFFER when end of history is reached like in Fish.
@ -381,7 +380,7 @@ function _history-substring-search-down-history() {
false false
} }
function _history-substring-search-up-search() { function _history-substring-search-up-search {
_history_substring_search_move_cursor_eol=true _history_substring_search_move_cursor_eol=true
# #
@ -460,7 +459,7 @@ function _history-substring-search-up-search() {
fi fi
} }
function _history-substring-search-down-search() { function _history-substring-search-down-search {
_history_substring_search_move_cursor_eol=true _history_substring_search_move_cursor_eol=true
# #

View File

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
function manb() { function manb {
local page local page
if (( $# > 0 )); then if (( $# > 0 )); then
for page in "$@"; do for page in "$@"; do

View File

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
function manp() { function manp {
local page local page
if (( $# > 0 )); then if (( $# > 0 )); then
for page in "$@"; do for page in "$@"; do

View File

@ -12,12 +12,12 @@ alias cdf='cd "$(pfd)"'
alias pushdf='pushd "$(pfd)"' alias pushdf='pushd "$(pfd)"'
# Open files in Quick Look. # Open files in Quick Look.
function ql() { function ql {
(( $# > 0 )) && qlmanage -p "$@" &> /dev/null (( $# > 0 )) && qlmanage -p "$@" &> /dev/null
} }
# Delete .DS_Store and __MACOSX directories. # Delete .DS_Store and __MACOSX directories.
function rm-osx-cruft() { function rm-osx-cruft {
find "${@:-$PWD}" \( \ find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \ -type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \ -type d -name '__MACOSX' \

View File

@ -20,7 +20,7 @@ alias rsd='_rails-command server --debugger'
alias devlog='tail -f log/development.log' alias devlog='tail -f log/development.log'
# Functions # Functions
function _rails-command() { function _rails-command {
if [[ -e "script/server" ]]; then if [[ -e "script/server" ]]; then
ruby script/"$@" ruby script/"$@"
else else

View File

@ -27,7 +27,7 @@ fi
_ssh_agent_env="${HOME}/.ssh/environment-${HOST}" _ssh_agent_env="${HOME}/.ssh/environment-${HOST}"
_ssh_agent_forwarding= _ssh_agent_forwarding=
function _ssh-agent-start() { function _ssh-agent-start {
local -a identities local -a identities
# Start ssh-agent and setup the environment. # Start ssh-agent and setup the environment.

View File

@ -16,7 +16,7 @@ fi
if (( $+functions[_z] )); then if (( $+functions[_z] )); then
alias z='nocorrect _z 2>&1' alias z='nocorrect _z 2>&1'
alias j='z' alias j='z'
function z-precmd () { function z-precmd {
z --add "$(pwd -P)" z --add "$(pwd -P)"
} }
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook

View File

@ -19,28 +19,28 @@ else
fi fi
# Sets the GNU Screen title. # Sets the GNU Screen title.
function set-screen-title() { function set-screen-title {
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
printf "\ek%s\e\\" ${(V)argv} printf "\ek%s\e\\" ${(V)argv}
fi fi
} }
# Sets the terminal window title. # Sets the terminal window title.
function set-window-title() { function set-window-title {
if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then
printf "\e]2;%s\a" ${(V)argv} printf "\e]2;%s\a" ${(V)argv}
fi fi
} }
# Sets the terminal tab title. # Sets the terminal tab title.
function set-tab-title() { function set-tab-title {
if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then
printf "\e]1;%s\a" ${(V)argv} printf "\e]1;%s\a" ${(V)argv}
fi fi
} }
# Sets the tab and window titles with the command name. # Sets the tab and window titles with the command name.
function set-title-by-command() { function set-title-by-command {
emulate -L zsh emulate -L zsh
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
@ -77,7 +77,7 @@ function set-title-by-command() {
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
# Sets the tab and window titles before the prompt is displayed. # Sets the tab and window titles before the prompt is displayed.
function set-title-precmd() { function set-title-precmd {
if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then
set-window-title "${(%):-%~}" set-window-title "${(%):-%~}"
for kind in tab screen; do for kind in tab screen; do
@ -92,7 +92,7 @@ function set-title-precmd() {
add-zsh-hook precmd set-title-precmd add-zsh-hook precmd set-title-precmd
# Sets the tab and window titles before command execution. # Sets the tab and window titles before command execution.
function set-title-preexec() { function set-title-preexec {
if zstyle -t ':omz:terminal' auto-title; then if zstyle -t ':omz:terminal' auto-title; then
set-title-by-command "$2" set-title-by-command "$2"
fi fi

View File

@ -13,11 +13,11 @@ function +vi-git-status() {
fi fi
} }
function prompt_minimal_precmd () { function prompt_minimal_precmd {
vcs_info vcs_info
} }
function prompt_minimal_setup() { function prompt_minimal_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)

View File

@ -16,11 +16,11 @@
# - Shows if logged in as root or not. # - Shows if logged in as root or not.
# #
function prompt_nicoulaj_precmd() { function prompt_nicoulaj_precmd {
vcs_info vcs_info
} }
function prompt_nicoulaj_setup() { function prompt_nicoulaj_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)

View File

@ -8,7 +8,7 @@
# http://i.imgur.com/aipDQ.png # http://i.imgur.com/aipDQ.png
# #
function prompt_sorin_precmd () { function prompt_sorin_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
@ -17,7 +17,7 @@ function prompt_sorin_precmd () {
fi fi
} }
function prompt_sorin_setup() { function prompt_sorin_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)

View File

@ -9,13 +9,13 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
function virtualenv_info() { function virtualenv_info {
if [[ -n "$VIRTUAL_ENV" ]]; then if [[ -n "$VIRTUAL_ENV" ]]; then
print "(${VIRTUAL_ENV:t}) " print "(${VIRTUAL_ENV:t}) "
fi fi
} }
function prompt_steeef_precmd() { function prompt_steeef_precmd {
if [[ -n "$__PROMPT_STEEEF_VCS_UPDATE" ]] ; then if [[ -n "$__PROMPT_STEEEF_VCS_UPDATE" ]] ; then
# Check for untracked files or updated submodules since vcs_info doesn't. # Check for untracked files or updated submodules since vcs_info doesn't.
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
@ -31,7 +31,7 @@ function prompt_steeef_precmd() {
fi fi
} }
function prompt_steeef_preexec() { function prompt_steeef_preexec {
case "$(history $HISTCMD)" in case "$(history $HISTCMD)" in
(*git*) (*git*)
__PROMPT_STEEEF_VCS_UPDATE=1 __PROMPT_STEEEF_VCS_UPDATE=1
@ -42,11 +42,11 @@ function prompt_steeef_preexec() {
esac esac
} }
function prompt_steeef_chpwd() { function prompt_steeef_chpwd {
__PROMPT_STEEEF_VCS_UPDATE=1 __PROMPT_STEEEF_VCS_UPDATE=1
} }
function prompt_steeef_setup() { function prompt_steeef_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)

View File

@ -14,42 +14,42 @@ alias history-stat="history | awk '{print \$2}' | sort | uniq -c | sort -n -r |
alias http-serve='python -m SimpleHTTPServer' alias http-serve='python -m SimpleHTTPServer'
# Makes a directory and changes to it. # Makes a directory and changes to it.
function mkdcd() { function mkdcd {
[[ -n "$1" ]] && mkdir -p "$1" && cd "$1" [[ -n "$1" ]] && mkdir -p "$1" && cd "$1"
} }
compdef _mkdir mkdcd compdef _mkdir mkdcd
# Changes to a directory and lists its contents. # Changes to a directory and lists its contents.
function cdll() { function cdll {
builtin cd "$1" && ll builtin cd "$1" && ll
} }
compdef _cd cdll compdef _cd cdll
# Pushes an entry onto the directory stack and lists its contents. # Pushes an entry onto the directory stack and lists its contents.
function pushdll() { function pushdll {
builtin pushd "$1" && ll builtin pushd "$1" && ll
} }
compdef _cd pushdll compdef _cd pushdll
# Pops an entry off the directory stack and lists its contents. # Pops an entry off the directory stack and lists its contents.
function popdll() { function popdll {
builtin popd "$1" && ll builtin popd "$1" && ll
} }
compdef _cd popdll compdef _cd popdll
# Prints columns 1 2 3 ... n. # Prints columns 1 2 3 ... n.
function slit() { function slit {
awk "{ print $(for n; do print -n "\$$n,"; done | sed 's/,$//') }" awk "{ print $(for n; do print -n "\$$n,"; done | sed 's/,$//') }"
} }
# Displays user owned process status. # Displays user owned process status.
function pmine() { function pmine {
ps "$@" -U "$USER" -o pid,%cpu,%mem,command ps "$@" -U "$USER" -o pid,%cpu,%mem,command
} }
compdef _ps pmine compdef _ps pmine
# Finds files and executes a command on them. # Finds files and executes a command on them.
function find-exec() { function find-exec {
find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \;
} }