diff --git a/helper.zsh b/helper.zsh index cf28d076..dc25281e 100644 --- a/helper.zsh +++ b/helper.zsh @@ -4,7 +4,7 @@ function autoloadable() { } # Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). -function check-bool() { +function is-true() { [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] } diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 0d2f931a..c0854c4a 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -60,7 +60,7 @@ function _git-action() { # Turns off git-info for the current repository. function _git-info-abort() { - if ! check-bool "$_git_info_executing"; then + if ! is-true "$_git_info_executing"; then return 1 fi @@ -146,7 +146,7 @@ function git-info() { unset git_rprompt_info # Return if not inside a Git repository work tree. - if ! check-bool "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -162,7 +162,7 @@ function git-info() { fi # Return if git-info is disabled. - if ! check-bool "${$(git config --bool prompt.showinfo):-true}"; then + if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then return 1 fi diff --git a/plugins/screen/init.zsh b/plugins/screen/init.zsh index 9e45e2c2..e46283b8 100644 --- a/plugins/screen/init.zsh +++ b/plugins/screen/init.zsh @@ -11,7 +11,7 @@ alias sn="screen -U -S" alias sr="screen -a -A -U -D -R" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_SCREEN"; then (( SHLVL += 1 )) && export SHLVL session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" if [[ -n "$session" ]]; then diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index b92dcd78..3f7a5266 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -40,7 +40,7 @@ function _ssh-agent-start() { # Test if agent-forwarding is enabled. zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding' -if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then +if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding. [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_ssh_agent_env}" ]; then diff --git a/plugins/tmux/init.zsh b/plugins/tmux/init.zsh index 3e54acff..8e213358 100644 --- a/plugins/tmux/init.zsh +++ b/plugins/tmux/init.zsh @@ -10,7 +10,7 @@ alias ta="tmux attach-session" alias tl="tmux list-sessions" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_TMUX"; then (( SHLVL += 1 )) && export SHLVL session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" if [[ -n "$session" ]]; then