From 3ca07679ca98a2d0b07f1caaa7308b68f9b930f0 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 26 Jun 2019 14:02:44 +0200 Subject: [PATCH] Add GO111MODULE status to prompt Signed-off-by: Knut Ahlers --- .zsh/oh-my-custom/luzifer.zsh-theme | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.zsh/oh-my-custom/luzifer.zsh-theme b/.zsh/oh-my-custom/luzifer.zsh-theme index 80cca12..6771bcd 100644 --- a/.zsh/oh-my-custom/luzifer.zsh-theme +++ b/.zsh/oh-my-custom/luzifer.zsh-theme @@ -94,6 +94,13 @@ function build_git_prompt() { echo -n "%{$reset_color%} ${bracket_close}" } +function prompt_gomod() { + local mod_default="auto" + local mod=${GO111MODULE:-${mod_default}} + + [[ ${mod} == ${mod_default} ]] || echo "${bracket_open} %{$fg[yellow]%}${mod} ${bracket_close}" +} + local current_dir='$(short_path)' local git_info='$(build_git_prompt)' @@ -106,9 +113,10 @@ local prompt_part_path="%{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color% local prompt_part_exit="%(?..${bracket_open} %{$fg[red]%}%?%{${reset_color}%} ${bracket_close})" local prompt_part_char='$(prompt_char)' local prompt_part_configgit='$(config-git_prompt)' +local prompt_part_gomod='$(prompt_gomod)' PROMPT=" -╭─ ${prompt_part_time}${prompt_part_user}${prompt_part_configgit}${prompt_part_exit} ${prompt_part_path} +╭─ ${prompt_part_time}${prompt_part_user}${prompt_part_configgit}${prompt_part_gomod}${prompt_part_exit} ${prompt_part_path} ╰─ " RPROMPT="${git_info}"