Permalink
Browse files

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

  • Loading branch information...
1 parent a3b92bb commit 6a9a4ea8d683cf50e76da1c788ef167e20aff7d2 @sorin-ionescu sorin-ionescu committed Mar 23, 2012
View
@@ -99,7 +99,7 @@ fi
# Diff/Make
if zstyle -t ':omz:alias:diff' color; then
- function diff() {
+ function diff {
if (( $+commands[colordiff] )); then
"$commands[diff]" --unified "$@" | colordiff --difftype diffu
elif (( $+commands[git] )); then
@@ -109,7 +109,7 @@ if zstyle -t ':omz:alias:diff' color; then
fi
}
- function wdiff() {
+ function wdiff {
if (( $+commands[wdiff] )); then
"$commands[wdiff]" \
--avoid-wraps \
View
@@ -6,7 +6,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
-function duh() {
+function duh {
(( $# == 0 )) && set -- *
if [[ "$OSTYPE" == linux* ]]; then
du -khsc "$@" | sort -h -r
View
@@ -6,17 +6,17 @@
#
# 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
}
# 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]|)) ]]
}
# Prints the first non-empty string in the arguments array.
-function coalesce() {
+function coalesce {
for arg in $argv; do
print "$arg"
return 0
@@ -33,7 +33,7 @@ TRAP_SIGNALS=(
)
# 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
print "usage: $0 type function" >&2
return 1
@@ -52,7 +52,7 @@ function add-zsh-trap() {
if (( ! $+functions[TRAP${1}] )); then
eval "
- function TRAP${1}() {
+ function TRAP${1} {
for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do
if (( \$+functions[\$trap_function] )); then
\"\$trap_function\" \"\$1\"
View
@@ -79,7 +79,7 @@ zle -N zle-line-finish
zle -N zle-keymap-select
# Expands .... to ../..
-function expand-dot-to-parent-directory-path() {
+function expand-dot-to-parent-directory-path {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+='/..'
else
@@ -89,7 +89,7 @@ function expand-dot-to-parent-directory-path() {
zle -N expand-dot-to-parent-directory-path
# Displays an indicator when completing.
-function expand-or-complete-with-indicator() {
+function expand-or-complete-with-indicator {
local indicator
zstyle -s ':omz:completion' indicator 'indicator'
print -Pn "$indicator"
@@ -99,7 +99,7 @@ function expand-or-complete-with-indicator() {
zle -N expand-or-complete-with-indicator
# Inserts 'sudo ' at the beginning of the line.
-function prepend-sudo() {
+function prepend-sudo {
if [[ "$BUFFER" != su(do|)\ * ]]; then
BUFFER="sudo $BUFFER"
(( CURSOR += 5 ))
View
@@ -86,7 +86,7 @@ alias giu='git add --update'
compdef _git giu=git-add
alias gid='git diff --no-ext-diff --cached'
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
alias gir='git reset'
compdef _git gir=git-reset
@@ -235,7 +235,7 @@ alias gwS='git status'
compdef _git gwS=git-status
alias gwd='git diff --no-ext-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
alias gwr='git reset --soft'
compdef _git gwr=git-reset
@@ -6,7 +6,7 @@
#
# Gets the path to the Git directory.
-function _git-dir() {
+function _git-dir {
local git_root="$(git-root)"
local git_dir_or_file="${git_root}/.git"
local git_dir
@@ -31,7 +31,7 @@ function _git-dir() {
# Gets the Git special action (am, merge, rebase, etc.).
# Borrowed from vcs_info and edited.
-function _git-action() {
+function _git-action {
local action=''
local action_dir
local git_dir="$(_git-dir)"
@@ -90,7 +90,7 @@ function _git-action() {
}
# Turns off git-info for the current repository.
-function _git-info-abort() {
+function _git-info-abort {
if ! is-true "$_git_info_executing"; then
return 1
fi
@@ -115,7 +115,7 @@ EOF
add-zsh-trap INT _git-info-abort
# Gets the Git status information.
-function git-info() {
+function git-info {
# Extended globbing is needed to parse repository status.
setopt LOCAL_OPTIONS
setopt EXTENDED_GLOB
View
@@ -7,7 +7,7 @@
#
if (( $+commands[hub] )); then
- function git() {
+ function git {
hub "$@"
}
fi
@@ -6,7 +6,7 @@
#
if (( $+commands[gdircolors] )); then
- function __gnu_utils() {
+ function __gnu_utils {
emulate -L zsh
local gcmds
local gcmd
@@ -46,7 +46,7 @@ if (( $+commands[gdircolors] )); then
}
__gnu_utils;
- function hash() {
+ function hash {
if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then
builtin hash "$@"
__gnu_utils
@@ -55,7 +55,7 @@ if (( $+commands[gdircolors] )); then
fi
}
- function rehash() {
+ function rehash {
hash -r "$@"
}
@@ -12,7 +12,7 @@ fi
_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
chmod 600 "${_gpg_env}"
source "${_gpg_env}" > /dev/null
@@ -49,7 +49,7 @@ HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
# the main ZLE widgets
#-----------------------------------------------------------------------------
-function history-substring-search-up() {
+function history-substring-search-up {
_history-substring-search-begin
_history-substring-search-up-history ||
@@ -59,7 +59,7 @@ function history-substring-search-up() {
_history-substring-search-end
}
-function history-substring-search-down() {
+function history-substring-search-down {
_history-substring-search-begin
_history-substring-search-down-history ||
@@ -93,7 +93,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
# simply removes any existing highlights when the
# user inserts printable characters into $BUFFER.
#
- function _zsh_highlight() {
+ function _zsh_highlight {
if [[ $KEYS == [[:print:]] ]]; then
region_highlight=()
fi
@@ -136,8 +136,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
#
#--------------8<-------------------8<-------------------8<-----------------
# 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.
zmodload zsh/zleparameter 2>/dev/null || {
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";;
# 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";;
# Default: unhandled case.
@@ -176,7 +175,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
_zsh_highlight_bind_widgets
fi
-function _history-substring-search-begin() {
+function _history-substring-search-begin {
setopt LOCAL_OPTIONS EXTENDED_GLOB
_history_substring_search_move_cursor_eol=false
@@ -244,7 +243,7 @@ function _history-substring-search-begin() {
fi
}
-function _history-substring-search-end() {
+function _history-substring-search-end {
setopt LOCAL_OPTIONS EXTENDED_GLOB
_history_substring_search_result=$BUFFER
@@ -278,7 +277,7 @@ function _history-substring-search-end() {
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
# buffer. This amounts to three tests:
@@ -307,7 +306,7 @@ function _history-substring-search-up-buffer() {
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
# buffer. This amounts to three tests:
@@ -336,7 +335,7 @@ function _history-substring-search-down-buffer() {
false
}
-function _history-substring-search-up-history() {
+function _history-substring-search-up-history {
#
# Behave like up in Zsh, except clear the $BUFFER
# when beginning of history is reached like in Fish.
@@ -358,7 +357,7 @@ function _history-substring-search-up-history() {
false
}
-function _history-substring-search-down-history() {
+function _history-substring-search-down-history {
#
# Behave like down-history in Zsh, except clear the
# $BUFFER when end of history is reached like in Fish.
@@ -381,7 +380,7 @@ function _history-substring-search-down-history() {
false
}
-function _history-substring-search-up-search() {
+function _history-substring-search-up-search {
_history_substring_search_move_cursor_eol=true
#
@@ -460,7 +459,7 @@ function _history-substring-search-up-search() {
fi
}
-function _history-substring-search-down-search() {
+function _history-substring-search-down-search {
_history_substring_search_move_cursor_eol=true
#
@@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
-function manb() {
+function manb {
local page
if (( $# > 0 )); then
for page in "$@"; do
@@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
-function manp() {
+function manp {
local page
if (( $# > 0 )); then
for page in "$@"; do
View
@@ -12,12 +12,12 @@ alias cdf='cd "$(pfd)"'
alias pushdf='pushd "$(pfd)"'
# Open files in Quick Look.
-function ql() {
+function ql {
(( $# > 0 )) && qlmanage -p "$@" &> /dev/null
}
# Delete .DS_Store and __MACOSX directories.
-function rm-osx-cruft() {
+function rm-osx-cruft {
find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \
View
@@ -20,7 +20,7 @@ alias rsd='_rails-command server --debugger'
alias devlog='tail -f log/development.log'
# Functions
-function _rails-command() {
+function _rails-command {
if [[ -e "script/server" ]]; then
ruby script/"$@"
else
@@ -27,7 +27,7 @@ fi
_ssh_agent_env="${HOME}/.ssh/environment-${HOST}"
_ssh_agent_forwarding=
-function _ssh-agent-start() {
+function _ssh-agent-start {
local -a identities
# Start ssh-agent and setup the environment.
View
@@ -16,7 +16,7 @@ fi
if (( $+functions[_z] )); then
alias z='nocorrect _z 2>&1'
alias j='z'
- function z-precmd () {
+ function z-precmd {
z --add "$(pwd -P)"
}
autoload -Uz add-zsh-hook
Oops, something went wrong.

0 comments on commit 6a9a4ea

Please sign in to comment.