From 113f6763c22c31dff15a7f776c991596e150e4a1 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 4 Oct 2012 20:57:45 -0400 Subject: [PATCH] Add a function to define a style if not defined --- modules/helper/README.md | 1 + modules/helper/init.zsh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/modules/helper/README.md b/modules/helper/README.md index b010b005..96301881 100644 --- a/modules/helper/README.md +++ b/modules/helper/README.md @@ -13,6 +13,7 @@ Functions - `is-callable` checks if a name is a command, function, or alias. - `is-true` checks a boolean variable for "true". - `coalesce` prints the first non-empty string in the arguments array. + - `zstyle-` defines a style if it is already not defined. Authors ------- diff --git a/modules/helper/init.zsh b/modules/helper/init.zsh index 7e0f9d57..86d71361 100644 --- a/modules/helper/init.zsh +++ b/modules/helper/init.zsh @@ -30,3 +30,7 @@ function coalesce { return 1 } +# Defines a style if it is already not defined. +function zstyle- { + zstyle -T "$1" "$2" && zstyle "$@" +}