Skip to content
Snippets Groups Projects
Commit 3c89d4ed authored by Ayaz Badouraly's avatar Ayaz Badouraly
Browse files

Using POSIX-compliant definition of functions

parent ad479d17
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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"
......
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment