abra zsh config 2.0

This commit is contained in:
Andrey Anurin
2018-08-12 15:26:21 +03:00
parent 201abd09c4
commit 6b114440e2
1195 changed files with 68948 additions and 10539 deletions

View File

@@ -8,6 +8,7 @@
# Isaac Wolkerstorfer <i@agnoster.net>
# Jeff Sandberg <paradox460@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
# Patrick Bos <egpbos@gmail.com>
#
# Screenshots:
# http://i.imgur.com/0XIWX.png
@@ -52,21 +53,14 @@ function prompt_paradox_build_prompt {
prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}'
fi
if [[ -n "$python_info" ]]; then
prompt_paradox_start_segment white black '${(e)python_info[virtualenv]}'
fi
prompt_paradox_end_segment
}
function prompt_paradox_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_paradox_pwd="$MATCH"
unset MATCH
else
_prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
fi
}
function prompt_paradox_print_elapsed_time {
prompt_paradox_print_elapsed_time() {
local end_time=$(( SECONDS - _prompt_paradox_start_time ))
local hours minutes seconds remainder
@@ -90,13 +84,18 @@ function prompt_paradox_precmd {
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_paradox_pwd
_prompt_paradox_pwd=$(prompt-pwd)
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
# Get Python environment information.
if (( $+functions[python-info] )); then
python-info
fi
# Calculate and print the elapsed time.
prompt_paradox_print_elapsed_time
}
@@ -108,7 +107,7 @@ function prompt_paradox_preexec {
function prompt_paradox_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
prompt_opts=(cr percent sp subst)
# Load required functions.
autoload -Uz add-zsh-hook
@@ -143,6 +142,9 @@ function prompt_paradox_setup {
'ref' '$(coalesce "%b" "%p" "%c")' \
'status' '%s%D%A%B%S%a%d%m%r%U%u'
# %v - virtualenv name.
zstyle ':prezto:module:python:info:virtualenv' format 'virtualenv:%v'
# Define prompts.
PROMPT='
${(e)$(prompt_paradox_build_prompt)}