-
Notifications
You must be signed in to change notification settings - Fork 2
/
via.zsh-theme
85 lines (65 loc) · 3.2 KB
/
via.zsh-theme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Oh-My-VIA ZSH Theme
# Fork from the historical VIA Centrale Réseaux ZSH Theme
#
# This work is free. You can redistribute it and/or modify it under the terms of
# the Do What The Fuck You Want To Public License, Version 2, as published by Sam
# Hocevar. See the COPYING file or http://www.wtfpl.net/ for more details.
#
#################################################################################
# Source functions
#################################################################################
OHMYVIA_INSTALLATION_PATH="$(dirname $0)"
source $OHMYVIA_INSTALLATION_PATH/functions/prompt_utils.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/utils.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/vcs_themes.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/vcs_utils.zsh
#################################################################################
# Variables initialization
#################################################################################
## Context properties
set_default OHMYVIA_CONTEXT_HOSTNAME "full"
set_default OHMYVIA_CONTEXT_HOSTNAME_COLOR "%B%F{white}"
set_default OHMYVIA_CONTEXT_HOSTNAME_COLOR_SSH "$OHMYVIA_CONTEXT_HOSTNAME_COLOR"
set_default OHMYVIA_CONTEXT_SEPARATOR_COLOR "%B%F{yellow}"
set_default OHMYVIA_CONTEXT_ROOT_COLOR "%B%F{blue}"
set_default OHMYVIA_CONTEXT_USER_COLOR "%B%F{red}"
# Dir properties
set_default OHMYVIA_DIR_COLOR "%B%F{green}"
set_default OHMYVIA_DIR_SIZE "0"
# Status properties
set_default OHMYVIA_STATUS_OK_COLOR "%B%F{yellow}"
set_default OHMYVIA_STATUS_ERROR_COLOR "%B%F{red}"
# Time properties
set_default OHMYVIA_TIME_COLOR "%B%F{cyan}"
set_default OHMYVIA_TIME_FORMAT "%D{%H:%M}"
# VCS properties
set_default OHMYVIA_VCS_COLOR_UNSTAGED "red"
set_default OHMYVIA_VCS_COLOR_STAGED "yellow"
set_default OHMYVIA_VCS_COLOR_UNTRACKED "blue"
set_default OHMYVIA_VCS_COLOR_STASH "cyan"
set_default OHMYVIA_VCS_COLOR_CLEAN "green"
set_default OHMYVIA_VCS_THEME "default"
#################################################################################
# Build left & right prompts
#################################################################################
OHMYVIA_EOL="%(?.$OHMYVIA_STATUS_OK_COLOR.$OHMYVIA_STATUS_ERROR_COLOR)%#%f%b"
PROMPT="$(prompt_time) $(prompt_context) $(prompt_dir)${OHMYVIA_EOL} "
# Display vcs info
# http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information
autoload -Uz vcs_info
zstyle ':vcs_info:*' max-exports 1 # vcs_info only sets vcs_info_msg_0_
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true # enable %c and %u sequences usage
zstyle ':vcs_info:*' unstagedstr $OHMYVIA_VCS_COLOR_UNSTAGED
zstyle ':vcs_info:*' stagedstr $OHMYVIA_VCS_COLOR_STAGED
zstyle ':vcs_info:git*+set-message:*' hooks misc-init git-stash git-untracked
# Load VCS theme
eval +vi-theme-$OHMYVIA_VCS_THEME
zstyle ':vcs_info:*' formats " $OHMYVIA_VCS_PROMPT_NORMAL"
zstyle ':vcs_info:*' actionformats " $OHMYVIA_VCS_PROMPT_ACTION"
# Override precmd to update vcs_info_msg_0_ before prompt.
# See http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions
precmd () { vcs_info }
RPROMPT='${vcs_info_msg_0_}'
# vim: ft=zsh noet