Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
28dc8c58
Unverified
Commit
28dc8c58
authored
Feb 23, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(michelebologna): simplify and clean up code
parent
201e9dea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
michelebologna.zsh-theme
themes/michelebologna.zsh-theme
+21
-17
No files found.
themes/michelebologna.zsh-theme
View file @
28dc8c58
...
...
@@ -35,23 +35,17 @@ local reset="%{$reset_color%}"
local -a color_array
color_array=($green $red $cyan $yellow $blue $magenta $white)
local username_normal_color=$white
local username_root_color=$red
local hostname_root_color=$red
# calculating hostname color with hostname characters
for i in $HOST; local hostname_normal_color=$color_array[$[((#i))%7+1]]
local -a hostname_color
hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
local username_color=$white
local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character
local current_dir_color=$blue
local username_command="%n"
local hostname_command="%m"
local username="%n"
local hostname="%m"
local current_dir="%~"
local username_output="%(!..$
username_normal_color$username_command$reset
@)"
local hostname_output="$
hostname_color$hostname_command$reset
"
local current_dir_output="$
current_dir_color$current_dir$reset
"
local username_output="%(!..$
{username_color}${username}${reset}
@)"
local hostname_output="$
{hostname_color}${hostname}${reset}
"
local current_dir_output="$
{current_dir_color}${current_dir}${reset}
"
local jobs_bg="${red}fg: %j$reset"
local last_command_output="%(?.%(!.$red.$green).$yellow)"
...
...
@@ -68,8 +62,18 @@ ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
PROMPT+="$GIT_PROMPT"
function michelebologna_git_prompt {
local out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status)
[[ -n $out ]] || return
printf " %s(%s%s%s)%s" \
"%{$fg_bold[white]%}" \
"%{$fg_bold[green]%}" \
"$out" \
"%{$fg_bold[white]%}" \
"%{$reset_color%}"
}
PROMPT="$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)"
PROMPT+='$(michelebologna_git_prompt)'
PROMPT+=" $last_command_output%#$reset "
RPROMPT=''
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment