mirror of
https://github.com/Matir/skel.git
synced 2026-05-25 21:19:09 -07:00
Drop more prezto deps.
This commit is contained in:
67
dotfiles/zshrc.d/matir_prompt/prompt_matir_setup
Normal file
67
dotfiles/zshrc.d/matir_prompt/prompt_matir_setup
Normal file
@@ -0,0 +1,67 @@
|
||||
# vim: syntax=zsh
|
||||
|
||||
function prompt_matir_setup {
|
||||
autoload -Uz add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
autoload -Uz colors
|
||||
|
||||
prompt_opts=(sp subst cr percent)
|
||||
|
||||
colors
|
||||
|
||||
add-zsh-hook precmd prompt_matir_precmd
|
||||
|
||||
# Git related styles
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:*' formats ' (%b%u%c)'
|
||||
zstyle ':vcs_info:*' stagedstr '*'
|
||||
zstyle ':vcs_info:*' unstagedstr '*'
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||
|
||||
# Virtualenv formatting
|
||||
zstyle ':prezto:module:python:info:virtualenv' format ' (py:%v)'
|
||||
|
||||
PROMPT='%{$fg[black]%}[%{$fg[yellow]%}%h%{$fg[black]%}] ' # History #
|
||||
PROMPT+='%{%(!.$fg[red].$fg[green])%}%8>..>%n%>>%{$fg[white]%}@' # username@
|
||||
PROMPT+='%{$fg[blue]%}%12>..>%m%>>%{$fg[white]%}:' # hostname
|
||||
PROMPT+='%{$fg[green]%}%32<...<%~%<<' # path
|
||||
PROMPT+='%{$fg[magenta]%}${python_info[virtualenv]}' # virtualenv
|
||||
PROMPT+='%{$fg[blue]%}${vcs_info_msg_0_}' # VCS info
|
||||
PROMPT+='%{$fg[white]%}%#%{$reset_color%} ' # prompt symbol
|
||||
|
||||
# Rprompt setup
|
||||
local show_return="✘ "
|
||||
RPROMPT='%(?:: %{$fg[red]%}'
|
||||
RPROMPT+=${show_return}
|
||||
RPROMPT+='%? '
|
||||
RPROMPT+='%{$reset_color%})'
|
||||
RPROMPT+='${PROMPT_VIMODE}'
|
||||
}
|
||||
|
||||
function zle-keymap-select {
|
||||
# Add prompt info
|
||||
PROMPT_VIMODE="${${KEYMAP/vicmd/ [VICMD]}/(main|viins)/}"
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
|
||||
function prompt_matir_precmd {
|
||||
vcs_info
|
||||
if (( $+functions[python-info] )); then
|
||||
python-info
|
||||
fi
|
||||
}
|
||||
|
||||
### git: Show marker (*) if there are untracked files in repository
|
||||
# Make sure you have added staged to your 'formats': %c
|
||||
|
||||
+vi-git-untracked(){
|
||||
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
|
||||
git status --porcelain | grep '??' &> /dev/null ; then
|
||||
hook_com[staged]+='*'
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_matir_setup "$@"
|
||||
Reference in New Issue
Block a user