From 3c89d4edc08e5c2ce093412f21b87829f465c980 Mon Sep 17 00:00:00 2001 From: Ayaz Badouraly <ayaz.badouraly@via.ecp.fr> Date: Tue, 20 Dec 2016 01:02:58 +0100 Subject: [PATCH] Using POSIX-compliant definition of functions --- functions/utils.zsh | 4 ++-- functions/vcs_themes.zsh | 10 +++++----- functions/vcs_utils.zsh | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/utils.zsh b/functions/utils.zsh index d9a2c6b..c9b3b8a 100644 --- a/functions/utils.zsh +++ b/functions/utils.zsh @@ -11,7 +11,7 @@ # # @param $1 : name of the variable to be filled # @param $2 : default value set if $1 is not already defined -function set_default() { +set_default () { # /!\ compute differently with color variables # TODO make the regex case-insensitive @@ -28,7 +28,7 @@ function set_default() { # # @param $1 : name of the variable to be filled # @param $2 : default value set if $1 is not already a visual effect or a color code -function set_default_color() { +set_default_color () { # See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects if [[ ! ${(P)1} =~ '%' ]]; then diff --git a/functions/vcs_themes.zsh b/functions/vcs_themes.zsh index 9004869..be2d3ab 100644 --- a/functions/vcs_themes.zsh +++ b/functions/vcs_themes.zsh @@ -18,7 +18,7 @@ # %S : A subdirectory within a repository. If $PWD is /foo/bar/repoXY/beer/tasty, %S is beer/tasty. # %m : A "misc" replacement. It is at the discretion of the backend to decide what this replacement expands to. -function +vi-theme-default() { ++vi-theme-default () { local vcs_prompt_prefix="%F{magenta}(%F{white}%s%F{magenta})%f" local vcs_prompt_hyphen="%F{yellow}-%f" local vcs_prompt_normal="%F{magenta}[%m%c%u%b%F{magenta}]%f" @@ -28,7 +28,7 @@ function +vi-theme-default() { OHMYVIA_VCS_PROMPT_ACTION=${OHMYVIA_VCS_PROMPT_ACTION:-"$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"} } -function +vi-theme-alphabet() { ++vi-theme-alphabet () { local vcs_prompt_prefix="%F{magenta}(%F{white}%s%F{magenta})%f" local vcs_prompt_hyphen="%F{yellow}-%f" local vcs_prompt_normal="%F{magenta}[%m%c%u%b%F{magenta}]%f" @@ -38,7 +38,7 @@ function +vi-theme-alphabet() { OHMYVIA_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action" } -function +vi-theme-djou() { ++vi-theme-djou () { local vcs_prompt_prefix="%F{white}%s%f" local vcs_prompt_hyphen=" %F{yellow}-%f " local vcs_prompt_normal="%m%c%u%b%f" @@ -48,7 +48,7 @@ function +vi-theme-djou() { OHMYVIA_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action" } -function +vi-theme-kiwi() { ++vi-theme-kiwi () { local vcs_prompt_prefix="%F{magenta}(%F{white}%s%F{magenta})%f" local vcs_prompt_hyphen="%F{yellow}-%f" local vcs_prompt_normal="%F{magenta}[%m%c%u%b%F{magenta}]%f" @@ -58,7 +58,7 @@ function +vi-theme-kiwi() { OHMYVIA_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action" } -function +vi-theme-jon() { ++vi-theme-jon () { local vcs_prompt_prefix="" local vcs_prompt_hyphen="" local vcs_prompt_normal="%F{magenta}[%m%c%u%b%F{magenta}]%f" diff --git a/functions/vcs_utils.zsh b/functions/vcs_utils.zsh index 192ad55..fec582b 100644 --- a/functions/vcs_utils.zsh +++ b/functions/vcs_utils.zsh @@ -7,14 +7,14 @@ # # Thanks to http://eseth.org/2010/git-in-zsh.html -function +vi-git-stash() { ++vi-git-stash () { if [[ -s ${hook_com[base]}/.git/refs/stash ]] ; then hook_com[misc]+=$OHMYVIA_VCS_COLOR_STASH fi } # Thanks to https://github.com/sunaku/home/ -function +vi-git-untracked() { ++vi-git-untracked () { if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ git status --porcelain | fgrep '??' &> /dev/null ; then # This will show the marker if there are any untracked files in repo. @@ -27,7 +27,7 @@ function +vi-git-untracked() { # Erase hook_com[misc] ( ie. %m ) to avoid dealing with backends info outputs # Add $vcs_clean_color to setup default %b coloring in vcs prompt -function +vi-misc-init() { ++vi-misc-init () { hook_com[misc]=$OHMYVIA_VCS_COLOR_CLEAN } -- GitLab