From 47467a1b0eb223878a783bf5367fe4b818b2118a Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 5 Jul 2017 23:21:38 -0700 Subject: [PATCH] Update functions to all use POSIX syntax I'm not a huge fan of this change, as I've made it known. However, this is semi-recommended by the style guide we've chosen to use and is a more common syntax. Fixes #692. --- init.zsh | 8 +++--- modules/docker/init.zsh | 4 +-- modules/editor/init.zsh | 26 +++++++++---------- modules/fasd/init.zsh | 2 +- modules/git/functions/git-info | 4 +-- modules/gnu-utility/init.zsh | 2 +- modules/gpg/init.zsh | 2 +- modules/helper/functions/add-zsh-trap | 4 +-- modules/helper/init.zsh | 8 +++--- modules/osx/functions/mand | 2 +- modules/osx/functions/manp | 2 +- modules/prompt/README.md | 8 +++--- modules/prompt/functions/prompt_cloud_setup | 8 +++--- .../prompt/functions/prompt_damoekri_setup | 2 +- modules/prompt/functions/prompt_giddie_setup | 10 +++---- .../prompt/functions/prompt_kylewest_setup | 4 +-- modules/prompt/functions/prompt_minimal_setup | 6 ++--- .../prompt/functions/prompt_nicoulaj_setup | 4 +-- modules/prompt/functions/prompt_paradox_setup | 12 ++++----- .../prompt/functions/prompt_peepcode_setup | 8 +++--- modules/prompt/functions/prompt_skwp_setup | 4 +-- modules/prompt/functions/prompt_smiley_setup | 4 +-- modules/prompt/functions/prompt_sorin_setup | 8 +++--- modules/prompt/functions/prompt_steeef_setup | 4 +-- modules/python/init.zsh | 2 +- modules/terminal/init.zsh | 14 +++++----- modules/utility/functions/diff | 2 +- modules/utility/functions/dut | 2 +- modules/utility/functions/make | 2 +- modules/utility/functions/wdiff | 2 +- modules/utility/init.zsh | 16 ++++++------ 31 files changed, 93 insertions(+), 93 deletions(-) diff --git a/init.zsh b/init.zsh index eb160913..8ff31b9c 100644 --- a/init.zsh +++ b/init.zsh @@ -18,10 +18,10 @@ fi unset min_zsh_version # zprezto convenience updater -# The function is surrounded by ( ) instead of { } so it starts in a subshell +# The function is surrounded by ( ) instead of() { } so it starts in a subshell # and won't affect the environment of the calling shell -function zprezto-update () ( - function cannot-fast-forward { +zprezto-update() ( + cannot-fast-forward() { local STATUS="$1" [[ -n "${STATUS}" ]] && printf "%s\n" "${STATUS}" printf "Unable to fast-forward the changes. You can fix this by " @@ -68,7 +68,7 @@ function zprezto-update () ( # # Loads Prezto modules. -function pmodload { +pmodload() { local -a pmodules local pmodule local pfunction_glob='^([_.]*|prompt_*_setup|README*|*~)(-.N:t)' diff --git a/modules/docker/init.zsh b/modules/docker/init.zsh index 8ad6bfdd..acc9e770 100644 --- a/modules/docker/init.zsh +++ b/modules/docker/init.zsh @@ -15,7 +15,7 @@ fi # # Set Docker Machine environment -function dkme { +dkme() { if (( ! $+commands[docker-machine] )); then return 1 fi @@ -24,7 +24,7 @@ function dkme { } # Set Docker Machine default machine -function dkmd { +dkmd() { if (( ! $+commands[docker-machine] )); then return 1 fi diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 93a7735a..b4536223 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -80,7 +80,7 @@ zle -N edit-command-line # # Runs bindkey but for all of the keymaps. Running it with no arguments will # print out the mappings for all of the keymaps. -function bindkey-all { +bindkey-all() { local keymap='' for keymap in $(bindkey -l); do [[ "$#" -eq 0 ]] && printf "#### %s\n" "${keymap}" 1>&2 @@ -89,7 +89,7 @@ function bindkey-all { } # Exposes information about the Zsh Line Editor via the $editor_info associative # array. -function editor-info { +editor-info() { # Clean up previous $editor_info. unset editor_info typeset -gA editor_info @@ -117,7 +117,7 @@ zle -N editor-info # Reset the prompt based on the current context and # the ps-context option. -function zle-reset-prompt { +zle-reset-prompt() { if zstyle -t ':prezto:module:editor' ps-context; then # If we aren't within one of the specified contexts, then we want to reset # the prompt with the appropriate editor_info[keymap] if there is one. @@ -133,13 +133,13 @@ function zle-reset-prompt { zle -N zle-reset-prompt # Updates editor information when the keymap changes. -function zle-keymap-select { +zle-keymap-select() { zle editor-info } zle -N zle-keymap-select # Enables terminal application mode and updates editor information. -function zle-line-init { +zle-line-init() { # The terminal must be in application mode when ZLE is active for $terminfo # values to be valid. if (( $+terminfo[smkx] )); then @@ -153,7 +153,7 @@ function zle-line-init { zle -N zle-line-init # Disables terminal application mode and updates editor information. -function zle-line-finish { +zle-line-finish() { # The terminal must be in application mode when ZLE is active for $terminfo # values to be valid. if (( $+terminfo[rmkx] )); then @@ -167,14 +167,14 @@ function zle-line-finish { zle -N zle-line-finish # Toggles emacs overwrite mode and updates editor information. -function overwrite-mode { +overwrite-mode() { zle .overwrite-mode zle editor-info } zle -N overwrite-mode # Enters vi insert mode and updates editor information. -function vi-insert { +vi-insert() { zle .vi-insert zle editor-info } @@ -182,21 +182,21 @@ zle -N vi-insert # Moves to the first non-blank character then enters vi insert mode and updates # editor information. -function vi-insert-bol { +vi-insert-bol() { zle .vi-insert-bol zle editor-info } zle -N vi-insert-bol # Enters vi replace mode and updates editor information. -function vi-replace { +vi-replace () { zle .vi-replace zle editor-info } zle -N vi-replace # Expands .... to ../.. -function expand-dot-to-parent-directory-path { +expand-dot-to-parent-directory-path() { if [[ $LBUFFER = *.. ]]; then LBUFFER+='/..' else @@ -206,7 +206,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 { +expand-or-complete-with-indicator() { local indicator zstyle -s ':prezto:module:editor:info:completing' format 'indicator' print -Pn "$indicator" @@ -216,7 +216,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 { +prepend-sudo() { if [[ "$BUFFER" != su(do|)\ * ]]; then BUFFER="sudo $BUFFER" (( CURSOR += 5 )) diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index fc214251..a282007d 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -36,7 +36,7 @@ source "$cache_file" unset cache_file init_args -function fasd_cd { +fasd_cd() { local fasd_ret="$(fasd -d "$@")" if [[ -d "$fasd_ret" ]]; then cd "$fasd_ret" diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 8aaa4c32..db63873c 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -7,7 +7,7 @@ # Gets the Git special action (am, bisect, cherry, merge, rebase). # Borrowed from vcs_info and edited. -function _git-action { +_git-action() { local action_dir local git_dir="$(git-dir)" local apply_formatted @@ -90,7 +90,7 @@ function _git-action { } # Gets the Git status information. -function git-info { +git-info() { # Extended globbing is needed to parse repository status. setopt LOCAL_OPTIONS setopt EXTENDED_GLOB diff --git a/modules/gnu-utility/init.zsh b/modules/gnu-utility/init.zsh index 65560324..2481ddc3 100644 --- a/modules/gnu-utility/init.zsh +++ b/modules/gnu-utility/init.zsh @@ -50,7 +50,7 @@ for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do _gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}" if (( ${+commands[${_gnu_utility_pcmd}]} )); then eval " - function ${_gnu_utility_cmd} { + ${_gnu_utility_cmd}() { '${commands[${_gnu_utility_pcmd}]}' \"\$@\" } " diff --git a/modules/gpg/init.zsh b/modules/gpg/init.zsh index b969c7a5..8a4a3210 100644 --- a/modules/gpg/init.zsh +++ b/modules/gpg/init.zsh @@ -40,7 +40,7 @@ if grep 'enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then pmodload 'ssh' # Updates the GPG-Agent TTY before every command since SSH does not set it. - function _gpg-agent-update-tty { + _gpg-agent-update-tty() { gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null } add-zsh-hook preexec _gpg-agent-update-tty diff --git a/modules/helper/functions/add-zsh-trap b/modules/helper/functions/add-zsh-trap index 07663e9d..6a306963 100644 --- a/modules/helper/functions/add-zsh-trap +++ b/modules/helper/functions/add-zsh-trap @@ -7,7 +7,7 @@ # # Adds a function name to a list to be called when a trap is triggered. -function add-zsh-trap { +add-zsh-trap() { if (( $# < 2 )); then print "usage: $0 type function" >&2 return 1 @@ -26,7 +26,7 @@ function add-zsh-trap { if (( ! $+functions[TRAP${1}] )); then eval " - function TRAP${1} { + TRAP${1}() { for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do if (( \$+functions[\$trap_function] )); then \"\$trap_function\" \"\$1\" diff --git a/modules/helper/init.zsh b/modules/helper/init.zsh index 328bed4f..3e39c74e 100644 --- a/modules/helper/init.zsh +++ b/modules/helper/init.zsh @@ -6,23 +6,23 @@ # # Checks if a file can be autoloaded by trying to load it in a subshell. -function is-autoloadable { +is-autoloadable() { ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null } # Checks if a name is a command, function, or alias. -function is-callable { +is-callable() { (( $+commands[$1] || $+functions[$1] || $+aliases[$1] || $+builtins[$1] )) } # Checks a boolean variable for "true". # Case insensitive: "1", "y", "yes", "t", "true", "o", and "on". -function is-true { +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 { +coalesce() { for arg in $argv; do print "$arg" return 0 diff --git a/modules/osx/functions/mand b/modules/osx/functions/mand index 7a9653a1..004dcd1a 100644 --- a/modules/osx/functions/mand +++ b/modules/osx/functions/mand @@ -5,7 +5,7 @@ # Sorin Ionescu # -function mand { +mand() { if (( $# > 0 )); then open "dash://manpages:$1" 2>/dev/null if (( $? != 0 )); then diff --git a/modules/osx/functions/manp b/modules/osx/functions/manp index fcb2a026..06e9aa62 100644 --- a/modules/osx/functions/manp +++ b/modules/osx/functions/manp @@ -5,7 +5,7 @@ # Sorin Ionescu # -function manp { +manp() { local page if (( $# > 0 )); then for page in "$@"; do diff --git a/modules/prompt/README.md b/modules/prompt/README.md index dc024977..8ffdf3d1 100644 --- a/modules/prompt/README.md +++ b/modules/prompt/README.md @@ -36,7 +36,7 @@ including a function that displays help or a function used to preview it. The most basic example of this function can be seen below. - function prompt_name_setup { + prompt_name_setup() { PROMPT='%m%# ' RPROMPT='' } @@ -48,7 +48,7 @@ function **should** be defined. The user will access it via `prompt -h name`. The most basic example of this function can be seen below. - function prompt_name_help { + prompt_name_help() { cat < 0 )); then prompt_preview_theme theme "$@" else @@ -93,7 +93,7 @@ a function before you calling it. The most basic example of this function can be seen below. - function prompt_name_precmd { + prompt_name_precmd() { if (( $+functions[git-info] )); then git-info fi diff --git a/modules/prompt/functions/prompt_cloud_setup b/modules/prompt/functions/prompt_cloud_setup index 3b048df1..9479e28d 100644 --- a/modules/prompt/functions/prompt_cloud_setup +++ b/modules/prompt/functions/prompt_cloud_setup @@ -37,7 +37,7 @@ # Load dependencies. pmodload 'helper' -function prompt_cloud_precmd { +prompt_cloud_precmd() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -47,7 +47,7 @@ function prompt_cloud_precmd { fi } -function prompt_cloud_help { +prompt_cloud_help() { cat < 0 )); then prompt_preview_theme 'cloud' "$@" else @@ -73,7 +73,7 @@ function prompt_cloud_preview { fi } -function prompt_cloud_setup { +prompt_cloud_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_damoekri_setup b/modules/prompt/functions/prompt_damoekri_setup index 89e4d758..de0dbe52 100644 --- a/modules/prompt/functions/prompt_damoekri_setup +++ b/modules/prompt/functions/prompt_damoekri_setup @@ -29,7 +29,7 @@ prompt_damoekri_precmd() { fi } -function prompt_damoekri_setup { +prompt_damoekri_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_giddie_setup b/modules/prompt/functions/prompt_giddie_setup index 5a14ffe0..f3b14157 100644 --- a/modules/prompt/functions/prompt_giddie_setup +++ b/modules/prompt/functions/prompt_giddie_setup @@ -14,28 +14,28 @@ # http://i.imgur.com/rCo3S.png # -function +vi-set_novcs_prompt_symbol { ++vi-set_novcs_prompt_symbol() { _prompt_giddie_symbol=')' } -function +vi-set_vcs_prompt_symbol { ++vi-set_vcs_prompt_symbol() { _prompt_giddie_symbol='±' } -function +vi-git_precmd { ++vi-git_precmd() { # Check for untracked files, since vcs_info does not. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then hook_com[unstaged]+='%F{green}?%f' fi } -function prompt_giddie_precmd { +prompt_giddie_precmd() { # Replace '/home/' with '~'. _prompt_giddie_pwd="${PWD/#$HOME/~}" vcs_info } -function prompt_giddie_setup { +prompt_giddie_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_kylewest_setup b/modules/prompt/functions/prompt_kylewest_setup index e4ee0c0e..3082989e 100644 --- a/modules/prompt/functions/prompt_kylewest_setup +++ b/modules/prompt/functions/prompt_kylewest_setup @@ -14,7 +14,7 @@ # http://i.imgur.com/dCwhynn.png # -function prompt_kylewest_precmd { +prompt_kylewest_precmd() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -29,7 +29,7 @@ function prompt_kylewest_precmd { fi } -function prompt_kylewest_setup { +prompt_kylewest_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_minimal_setup b/modules/prompt/functions/prompt_minimal_setup index 8c07e70e..a9d23b7a 100644 --- a/modules/prompt/functions/prompt_minimal_setup +++ b/modules/prompt/functions/prompt_minimal_setup @@ -9,18 +9,18 @@ # http://i.imgur.com/zLZNK.png # -function +vi-git_status { ++vi-git_status() { # Check for untracked files or updated submodules since vcs_info does not. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then hook_com[unstaged]='%F{red}●%f' fi } -function prompt_minimal_precmd { +prompt_minimal_precmd() { vcs_info } -function prompt_minimal_setup { +prompt_minimal_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_nicoulaj_setup b/modules/prompt/functions/prompt_nicoulaj_setup index 241c8b6e..b396dc1f 100644 --- a/modules/prompt/functions/prompt_nicoulaj_setup +++ b/modules/prompt/functions/prompt_nicoulaj_setup @@ -19,11 +19,11 @@ # http://i.imgur.com/Xe1bu.png # -function prompt_nicoulaj_precmd { +prompt_nicoulaj_precmd() { vcs_info } -function prompt_nicoulaj_setup { +prompt_nicoulaj_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_paradox_setup b/modules/prompt/functions/prompt_paradox_setup index c5a87515..91abab01 100644 --- a/modules/prompt/functions/prompt_paradox_setup +++ b/modules/prompt/functions/prompt_paradox_setup @@ -22,7 +22,7 @@ _prompt_paradox_current_bg='NONE' _prompt_paradox_segment_separator='' _prompt_paradox_start_time=$SECONDS -function prompt_paradox_start_segment { +prompt_paradox_start_segment() { local bg fg [[ -n "$1" ]] && bg="%K{$1}" || bg="%k" [[ -n "$2" ]] && fg="%F{$2}" || fg="%f" @@ -35,7 +35,7 @@ function prompt_paradox_start_segment { [[ -n "$3" ]] && print -n "$3" } -function prompt_paradox_end_segment { +prompt_paradox_end_segment() { if [[ -n "$_prompt_paradox_current_bg" ]]; then print -n " %k%F{$_prompt_paradox_current_bg}$_prompt_paradox_segment_separator" else @@ -45,7 +45,7 @@ function prompt_paradox_end_segment { _prompt_paradox_current_bg='' } -function prompt_paradox_build_prompt { +prompt_paradox_build_prompt() { prompt_paradox_start_segment black default '%(?::%F{red}✘ )%(!:%F{yellow}⚡ :)%(1j:%F{cyan}⚙ :)%F{blue}%n%F{red}@%F{green}%m%f' prompt_paradox_start_segment blue black '$_prompt_paradox_pwd' @@ -79,7 +79,7 @@ prompt_paradox_print_elapsed_time() { fi } -function prompt_paradox_precmd { +prompt_paradox_precmd() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -100,11 +100,11 @@ function prompt_paradox_precmd { prompt_paradox_print_elapsed_time } -function prompt_paradox_preexec { +prompt_paradox_preexec() { _prompt_paradox_start_time="$SECONDS" } -function prompt_paradox_setup { +prompt_paradox_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/prompt/functions/prompt_peepcode_setup b/modules/prompt/functions/prompt_peepcode_setup index c70fb9a7..cbadcca3 100644 --- a/modules/prompt/functions/prompt_peepcode_setup +++ b/modules/prompt/functions/prompt_peepcode_setup @@ -10,7 +10,7 @@ # http://i.imgur.com/LhgmW.png # -function prompt_peepcode_precmd { +prompt_peepcode_precmd() { # Get Git repository information. if (( $+functions[git-info] )); then git-info @@ -22,7 +22,7 @@ function prompt_peepcode_precmd { fi } -function prompt_peepcode_setup { +prompt_peepcode_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) @@ -56,7 +56,7 @@ RPROMPT='${ruby_info[version]}${git_info[rprompt]}' } -function prompt_peepcode_help { +prompt_peepcode_help() { cat < /dev/null) ]]; then branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c${_prompt_steeef_colors[4]}●%f)" @@ -29,7 +29,7 @@ function prompt_steeef_precmd { fi } -function prompt_steeef_setup { +prompt_steeef_setup() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 859569d6..3a2f7ded 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -34,7 +34,7 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then return 1 fi -function _python-workon-cwd { +_python-workon-cwd() { # Check if this is a Git repo local GIT_REPO_ROOT="" local GIT_TOPLEVEL="$(git rev-parse --show-toplevel 2> /dev/null)" diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index c7b22b7a..df29ebdb 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -12,7 +12,7 @@ if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then fi # Sets the terminal window title. -function set-window-title { +set-window-title() { local title_format{,ted} zstyle -s ':prezto:module:terminal:window-title' format 'title_format' || title_format="%s" zformat -f title_formatted "$title_format" "s:$argv" @@ -20,7 +20,7 @@ function set-window-title { } # Sets the terminal tab title. -function set-tab-title { +set-tab-title() { local title_format{,ted} zstyle -s ':prezto:module:terminal:tab-title' format 'title_format' || title_format="%s" zformat -f title_formatted "$title_format" "s:$argv" @@ -28,7 +28,7 @@ function set-tab-title { } # Sets the terminal multiplexer tab title. -function set-multiplexer-title { +set-multiplexer-title() { local title_format{,ted} zstyle -s ':prezto:module:terminal:multiplexer-title' format 'title_format' || title_format="%s" zformat -f title_formatted "$title_format" "s:$argv" @@ -36,7 +36,7 @@ function set-multiplexer-title { } # Sets the tab and window titles with a given command. -function _terminal-set-titles-with-command { +_terminal-set-titles-with-command() { emulate -L zsh setopt EXTENDED_GLOB @@ -69,7 +69,7 @@ function _terminal-set-titles-with-command { } # Sets the tab and window titles with a given path. -function _terminal-set-titles-with-path { +_terminal-set-titles-with-path() { emulate -L zsh setopt EXTENDED_GLOB @@ -94,7 +94,7 @@ if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] \ then # Sets the Terminal.app current working directory before the prompt is # displayed. - function _terminal-set-terminal-app-proxy-icon { + _terminal-set-terminal-app-proxy-icon() { printf '\e]7;%s\a' "file://${HOST}${PWD// /%20}" } add-zsh-hook precmd _terminal-set-terminal-app-proxy-icon @@ -103,7 +103,7 @@ then # multiplexer or remote connection is started since it can no longer be # updated, and it becomes confusing when the directory displayed in the title # bar is no longer synchronized with real current working directory. - function _terminal-unset-terminal-app-proxy-icon { + _terminal-unset-terminal-app-proxy-icon() { if [[ "${2[(w)1]:t}" == (screen|tmux|dvtm|ssh|mosh) ]]; then print '\e]7;\a' fi diff --git a/modules/utility/functions/diff b/modules/utility/functions/diff index 51806e81..799e2e72 100644 --- a/modules/utility/functions/diff +++ b/modules/utility/functions/diff @@ -5,7 +5,7 @@ # Sorin Ionescu # -function diff { +diff() { if zstyle -t ':prezto:module:utility:diff' color; then if (( $+commands[colordiff] )); then command colordiff "$@" diff --git a/modules/utility/functions/dut b/modules/utility/functions/dut index 65922805..d38ca910 100644 --- a/modules/utility/functions/dut +++ b/modules/utility/functions/dut @@ -6,7 +6,7 @@ # Sorin Ionescu # -function dut { +dut() { (( $# == 0 )) && set -- * if grep -q -i 'GNU' < <(du --version 2>&1); then diff --git a/modules/utility/functions/make b/modules/utility/functions/make index 5ebab057..984442a8 100644 --- a/modules/utility/functions/make +++ b/modules/utility/functions/make @@ -5,7 +5,7 @@ # Sorin Ionescu # -function make { +make() { if zstyle -t ':prezto:module:utility:make' color; then if (( $+commands[colormake] )); then colormake "$@" diff --git a/modules/utility/functions/wdiff b/modules/utility/functions/wdiff index c93ead1c..5e6c17e1 100644 --- a/modules/utility/functions/wdiff +++ b/modules/utility/functions/wdiff @@ -5,7 +5,7 @@ # Sorin Ionescu # -function wdiff { +wdiff() { if zstyle -t ':prezto:module:utility:wdiff' color; then if (( $+commands[wdiff] )); then command wdiff \ diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index 8e319bbb..8b5fd733 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -48,7 +48,7 @@ alias scp='noglob rsync_scp_wrap scp' # globbing for remote paths. The wrap function globs args starting in / and ./ # and doesn't glob paths with : in it as these are interpreted as remote paths # by these programs unless the path starts with / or ./ -function rsync_scp_wrap { +rsync_scp_wrap() { local args=( ) local cmd="$1" shift @@ -190,36 +190,36 @@ fi # # Makes a directory and changes to it. -function mkdcd { +mkdcd() { [[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1" } # Changes to a directory and lists its contents. -function cdls { +cdls() { builtin cd "$argv[-1]" && ls "${(@)argv[1,-2]}" } # Pushes an entry onto the directory stack and lists its contents. -function pushdls { +pushdls() { builtin pushd "$argv[-1]" && ls "${(@)argv[1,-2]}" } # Pops an entry off the directory stack and lists its contents. -function popdls { +popdls() { builtin popd "$argv[-1]" && ls "${(@)argv[1,-2]}" } # Prints columns 1 2 3 ... n. -function slit { +slit() { awk "{ print ${(j:,:):-\$${^@}} }" } # Finds files and executes a command on them. -function find-exec { +find-exec() { find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; } # Displays user owned processes status. -function psu { +psu() { ps -U "${1:-$LOGNAME}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" }