mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Improve my prompt theme
* Display username@hostname when ssh * Change git style, using ASCII characters * Combine status code with the prompt character
This commit is contained in:
parent
d94006225f
commit
3087fc8d7d
1 changed files with 14 additions and 6 deletions
|
|
@ -1,7 +1,15 @@
|
|||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
||||
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%# %{$reset_color%}'
|
||||
function ssh_username_hostname() {
|
||||
if [[ -n "$SSH_CONNECTION" ]]; then
|
||||
echo "%{$fg_bold[green]%}%n@%m "
|
||||
fi
|
||||
}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}X%{$fg[cyan]%})"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%})"
|
||||
|
||||
local current_dir="%{$fg[blue]%}%~ "
|
||||
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%}%? )%# "
|
||||
|
||||
PROMPT='$(ssh_username_hostname)${current_dir}$(git_prompt_info)${ret_status}%{$reset_color%}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue