mirror of https://github.com/bjeanes/dotfiles.git
Ported the fish-style PWD function for bash/zsh prompt
parent
3bad87fac8
commit
58769a6faa
25
bash/aliases
25
bash/aliases
|
@ -75,6 +75,31 @@ function extract() {
|
|||
fi
|
||||
}
|
||||
|
||||
if [ `uname` = "Darwin" ]; then
|
||||
function prompt_pwd() {
|
||||
if [ "$PWD" != "$HOME" ]; then
|
||||
printf "%s" `echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
||||
echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-'
|
||||
else
|
||||
echo '~'
|
||||
fi
|
||||
}
|
||||
else # defined two for diff systems because Fish did (not entirely sure why)
|
||||
function prompt_pwd() {
|
||||
case "$PWD" in
|
||||
$HOME)
|
||||
echo '~'
|
||||
;;
|
||||
*)
|
||||
printf "%s" `echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
||||
echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $system_name = 'Darwin' ]; then
|
||||
function manpdf() { man -t $@ | open -f -a Preview; }
|
||||
function osinfo() {
|
||||
|
|
10
zsh/theme
10
zsh/theme
|
@ -1,17 +1,15 @@
|
|||
function prompt_color() {
|
||||
if [ "$(whoami)" = "root" ]; then
|
||||
if [ "$USER" = "root" ]; then
|
||||
echo "red"
|
||||
else
|
||||
echo "green"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompts
|
||||
ZSH_THEME_VCS_PROMPT_PREFIX="%{$fg[red]%}‹"
|
||||
ZSH_THEME_VCS_PROMPT_SUFFIX="›%{$reset_color%}"
|
||||
ZSH_THEME_VCS_PROMPT_FORMAT="${ZSH_THEME_VCS_PROMPT_PREFIX}%b:%h${ZSH_THEME_VCS_PROMPT_SUFFIX}"
|
||||
|
||||
# Prompts
|
||||
# PS1='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ %{$reset_color%}%(!.#.$) '
|
||||
|
||||
PS1='%~ %{$fg[$(prompt_color)]%}♪%{$reset_color%} '
|
||||
RPS1='$(${VCPROMPT} -f ${ZSH_THEME_VCS_PROMPT_FORMAT})'
|
||||
PS1='%{$fg[blue]%}$(prompt_pwd)%{$reset_color%} %{$fg[$(prompt_color)]%}♪%{$reset_color%} '
|
||||
RPS1='$(${VCPROMPT} -f ${ZSH_THEME_VCS_PROMPT_FORMAT})'
|
Loading…
Reference in New Issue