Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes and new theme #131

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ version is 4.3.10.

### Mac OS X

If you have administrator privileges, you must fix an Apple miss configuration
in Mac OS X 10.7 Lion by renaming `/etc/zshenv` to `/etc/zprofile`, or Zsh will
If you have administrator privileges, you must fix an Apple mis-configuration
in Mac OS X 10.7 Lion by symlinking `/etc/zshenv` to `/etc/zprofile`, or Zsh will
have the wrong `PATH` when executed non-interactively by scripts.

### Troubleshooting
Expand All @@ -57,6 +57,7 @@ accompanying README files to learn of what is available.
3. Load the theme you like in `~/.zshrc` then open a new Zsh terminal window or
tab.
![sorin theme](http://i.imgur.com/aipDQ.png "sorin theme")
![quack theme](http://i.imgur.com/vevSn.png "quack theme")

## Customization

Expand Down
12 changes: 12 additions & 0 deletions modules/git/functions/git-info
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
# # %d - Indicator to notify of deleted files.
# zstyle ':omz:module:git' deleted 'deleted:%d'
#
# # %C - Indicator to notify of no dirty files.
# zstyle ':omz:module:git' clean 'clean:%C'
#
# # %D - Indicator to notify of dirty files.
# zstyle ':omz:module:git' dirty 'dirty:%D'
#
Expand Down Expand Up @@ -195,6 +198,8 @@ function git-info {
local dirty=0
local dirty_format
local dirty_formatted
local clean_format
local clean_formatted
local ignore_submodule
local -A info_formats
local info_format
Expand Down Expand Up @@ -381,12 +386,19 @@ function git-info {
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
fi

# Format clean.
if (( $dirty == 0 )); then
zstyle -s ':omz:module:git' clean 'clean_format'
zformat -f clean_formatted "$clean_format" "C:$dirty"
fi

# Format info.
zstyle -a ':omz:module:git' info 'info_formats'
for info_format in ${(k)info_formats}; do
zformat -f REPLY "$info_formats[$info_format]" \
"A:$ahead_formatted" \
"B:$behind_formatted" \
"C:$clean_formatted" \
"D:$dirty_formatted" \
"R:$remote_formatted" \
"S:$stashed_formatted" \
Expand Down
40 changes: 40 additions & 0 deletions modules/prompt/functions/prompt_quack_setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function prompt_quack_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS

function directory_list() {
if [[ $PWD = $HOME ]]
then
echo "%{$fg[green]%}~%{$reset_color%} ${return_code} "
else
echo "%{$fg_bold[green]%}${PWD%/*}/%{$reset_color%}%{$fg[green]%}${PWD##*/}%{$reset_color%} ${return_code} "
fi
}

if (( $+functions[git-info] )); then
git-info
fi
}

function prompt_quack_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)

autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_quack_precmd

zstyle ':omz:module:editor' completing '%B%F{red}...%f%b'
zstyle ':omz:module:editor:keymap' primary '%B%F{yellow}$%f%b'
zstyle ':omz:module:editor:keymap' alternate '%F{yellow}#%f'
zstyle ':omz:module:git' branch '%%B%F{yellow}%b%f%%b'
zstyle ':omz:module:git' dirty ' %B%F{magenta}∆%f%b'
zstyle ':omz:module:git' clean ' %B%F{magenta}•%f%b'
zstyle ':omz:module:git' info \
'prompt' '%b%D%C '
PROMPT='${(e)git_info[prompt]}${editor_info[keymap]} '
PROMPT2='%F{red}%f\ %{$reset_color%}'
RPS1='$(directory_list)'
}

prompt_quack_setup "$@"