mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
more customizations
This commit is contained in:
parent
1076b6aa67
commit
64c6934f34
3 changed files with 19 additions and 9 deletions
|
|
@ -36,10 +36,12 @@ cdpath=(.)
|
||||||
|
|
||||||
# use /etc/hosts and known_hosts for hostname completion
|
# use /etc/hosts and known_hosts for hostname completion
|
||||||
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||||
|
[ -r ~/.host-completion ] && : ${(A)_host_completion:=${(s: :)${(ps:\t:)${${(f)~~"$(<~/.host-completion)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _host_completion=()
|
||||||
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
||||||
hosts=(
|
hosts=(
|
||||||
"$_ssh_hosts[@]"
|
"$_ssh_hosts[@]"
|
||||||
"$_etc_hosts[@]"
|
"$_etc_hosts[@]"
|
||||||
|
"$_host_completion[@]"
|
||||||
`hostname`
|
`hostname`
|
||||||
localhost
|
localhost
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,3 @@ alias mv='nocorrect mv'
|
||||||
alias mysql='nocorrect mysql'
|
alias mysql='nocorrect mysql'
|
||||||
alias mkdir='nocorrect mkdir'
|
alias mkdir='nocorrect mkdir'
|
||||||
alias gist='nocorrect gist'
|
alias gist='nocorrect gist'
|
||||||
alias heroku='nocorrect heroku'
|
|
||||||
alias ebuild='nocorrect ebuild'
|
|
||||||
alias hpodder='nocorrect hpodder'
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,35 @@
|
||||||
|
|
||||||
|
# setup basic prompt
|
||||||
local user="$(whoami)"
|
local user="$(whoami)"
|
||||||
|
|
||||||
if [ "$user" = "root" ]; then
|
if [ "$user" = "root" ]; then
|
||||||
local user_host="%{$fg[yellow]%}_ROOT_%{$reset_color%}@%{$fg[red]%}$(~/scripts/shorthost)"
|
local user_host="%{$fg[yellow]%}_ROOT_%{$reset_color%}@%{$fg[red]%}$(~/scripts/shorthost)%{$reset_color%}"
|
||||||
local prompt_color=red
|
local prompt_color=red
|
||||||
elif [ "$user" = "komitee" ] || [ "$user" = "mkomitee" ]; then
|
elif [ "$user" = "komitee" ] || [ "$user" = "mkomitee" ]; then
|
||||||
local user_host="%{$fg[red]%}%{$fg[yellow]%}@%{$fg[magenta]%}$(~/scripts/shorthost)"
|
local user_host="%{$fg[red]%}%{$fg[yellow]%}@%{$fg[magenta]%}$(~/scripts/shorthost)%{$reset_color%}"
|
||||||
local prompt_color=white
|
local prompt_color=white
|
||||||
else
|
else
|
||||||
local user_host="%{$fg[yellow]%}%n%{$fg[blue]%}@%{$fg[magenta]%}$(~/scripts/shorthost)"
|
local user_host="%{$fg[yellow]%}%n%{$fg[blue]%}@%{$fg[magenta]%}$(~/scripts/shorthost)%{$reset_color%}"
|
||||||
local prompt_color=green
|
local prompt_color=yellow
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROMPT="%{$fg[cyan]%}[${user_host} %{$fg[yellow]%}%~%{$fg[cyan]%}]%{$fg[$prompt_color]%}%%%{$reset_color%} "
|
local prompt_char="%{$fg[$prompt_color]%}%#%{$reset_color%}"
|
||||||
|
|
||||||
|
PROMPT="%{$fg[cyan]%}[${user_host} %{$fg[yellow]%}%~%{$fg[cyan]%}]${prompt_char} "
|
||||||
|
|
||||||
|
# Setup vi mode indicator
|
||||||
MODE_INDICATOR="%{$fg_bold[yellow]%}<N>%{$reset_color%}"
|
MODE_INDICATOR="%{$fg_bold[yellow]%}<N>%{$reset_color%}"
|
||||||
|
|
||||||
|
# Setup git prompt info
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}("
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}("
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}⚡%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}⚡%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||||
RPROMPT='$(git_prompt_info)$(vi_mode_prompt_info)'
|
|
||||||
|
# setup command result indicator
|
||||||
|
CMDRESULT="%(?, ,%{$fg[red]%}[$?]%{$reset_color%})"
|
||||||
|
|
||||||
|
# setup right prompt
|
||||||
|
RPROMPT='$(git_prompt_info)${CMDRESULT}$(vi_mode_prompt_info)'
|
||||||
|
|
||||||
# vim: set ft=zsh
|
# vim: set ft=zsh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue