diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-02-21 14:18:10 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-02-21 14:18:10 +0800 |
commit | 1428ae9601af08b58f9c25e9763b6af2bb899eae (patch) | |
tree | cd691a520e2a853c471a9769d0d3b9464caf27d9 /_zsh | |
parent | 0346431ba661f959ce7dff26b7a865553b90fa5d (diff) | |
download | dotfiles-1428ae9601af08b58f9c25e9763b6af2bb899eae.tar.bz2 |
zsh/functions.zsh: syntax updates
Diffstat (limited to '_zsh')
-rw-r--r-- | _zsh/functions.zsh | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/_zsh/functions.zsh b/_zsh/functions.zsh index 9b817c1..46da01c 100644 --- a/_zsh/functions.zsh +++ b/_zsh/functions.zsh @@ -1,8 +1,10 @@ # # zsh/functions.zsh # +# execute 'functions <func_name>' to show function details. +# -function zsh_recompile { +function zsh_recompile() { autoload -U zrecompile rm -f ~/.zsh/*.zwc [[ -f ~/.zshrc ]] && zrecompile -p ~/.zshrc @@ -20,7 +22,7 @@ function zsh_recompile { } -function extract { +function extract() { echo Extracting $1 ... if [ -f "$1" ] ; then case "$1" in @@ -55,25 +57,25 @@ function extract { } -function trash () { - local path - for path in "$@"; do - # ignore any arguments - if [[ "${path}" = -* ]]; then - : - else - local dst="${path##*/}" - # append the time if necessary - while [ -e ~/.trash/"${dst}" ]; do - dst="${dst} "$(date +%H-%M-%S) - done - \mv "${path}" ~/.trash/"${dst}" - fi - done +function trash() { + local path + for path in "$@"; do + # ignore any arguments + if [[ "${path}" = -* ]]; then + : + else + local dst="${path##*/}" + # append the time if necessary + while [ -e ~/.trash/"${dst}" ]; do + dst="${dst} "$(date +%H-%M-%S) + done + command mv "${path}" ~/.trash/"${dst}" + fi + done } -function strip_diff_leading_symbols { +function strip_diff_leading_symbols() { local color_code_regex="(\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K])" # simplify the unified patch diff header @@ -86,8 +88,8 @@ function strip_diff_leading_symbols { ## Print a horizontal rule -rule() { - printf "%$(tput cols)s\n" | tr ' ' '─' +function rule() { + printf "%$(tput cols)s\n" | tr ' ' '-' } # vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # |