Use zstyle instead of variables for configuration.
This commit is contained in:
parent
60f39d8d91
commit
f0499b76c3
13 changed files with 156 additions and 103 deletions
|
@ -2,9 +2,9 @@ setopt CORRECT # Correct commands.
|
||||||
setopt CORRECT_ALL # Correct all arguments.
|
setopt CORRECT_ALL # Correct all arguments.
|
||||||
|
|
||||||
# The 'ls' Family
|
# The 'ls' Family
|
||||||
if check-bool "$COLOR"; then
|
if zstyle -t ':omz:alias:ls' color; then
|
||||||
if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then
|
if [[ -f "$HOME/.dir_colors" ]] && (( $+commands[dircolors] )); then
|
||||||
eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors")
|
eval $(dircolors "$HOME/.dir_colors")
|
||||||
alias ls='ls -hF --group-directories-first --color=auto'
|
alias ls='ls -hF --group-directories-first --color=auto'
|
||||||
else
|
else
|
||||||
export CLICOLOR=1
|
export CLICOLOR=1
|
||||||
|
@ -80,7 +80,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Diff/Make
|
# Diff/Make
|
||||||
if check-bool "$COLOR"; then
|
if zstyle -t ':omz:alias:diff' color; then
|
||||||
if (( $+commands[colordiff] )); then
|
if (( $+commands[colordiff] )); then
|
||||||
alias diff='colordiff -u'
|
alias diff='colordiff -u'
|
||||||
compdef colordiff=diff
|
compdef colordiff=diff
|
||||||
|
|
|
@ -20,7 +20,7 @@ zstyle ':completion::complete:*' use-cache on
|
||||||
zstyle ':completion::complete:*' cache-path "$HOME/.zcache"
|
zstyle ':completion::complete:*' cache-path "$HOME/.zcache"
|
||||||
|
|
||||||
# Case-insensitive (all), partial-word, and then substring completion.
|
# Case-insensitive (all), partial-word, and then substring completion.
|
||||||
if check-bool "$CASE_SENSITIVE"; then
|
if zstyle -t ':omz:completion:*' case-sensitive; then
|
||||||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||||
setopt CASE_GLOB
|
setopt CASE_GLOB
|
||||||
else
|
else
|
||||||
|
|
|
@ -64,7 +64,7 @@ export VISUAL="vim"
|
||||||
export PAGER='less'
|
export PAGER='less'
|
||||||
|
|
||||||
# Grep
|
# Grep
|
||||||
if check-bool "$COLOR"; then
|
if zstyle -t ':omz:environment:grep' color; then
|
||||||
export GREP_COLOR='37;45'
|
export GREP_COLOR='37;45'
|
||||||
export GREP_OPTIONS='--color=auto'
|
export GREP_OPTIONS='--color=auto'
|
||||||
fi
|
fi
|
||||||
|
@ -89,7 +89,7 @@ if (( $+commands[lesspipe.sh] )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Termcap
|
# Termcap
|
||||||
if check-bool "$COLOR"; then
|
if zstyle -t ':omz:environment:termcap' color; then
|
||||||
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
|
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
|
||||||
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
|
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
|
||||||
export LESS_TERMCAP_me=$'\E[0m' # end mode
|
export LESS_TERMCAP_me=$'\E[0m' # end mode
|
||||||
|
|
16
init.zsh
16
init.zsh
|
@ -3,15 +3,19 @@
|
||||||
# Check for the minimum supported version.
|
# Check for the minimum supported version.
|
||||||
min_zsh_version=4.3.9
|
min_zsh_version=4.3.9
|
||||||
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
|
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
|
||||||
print "oh-my-zsh: The minimum supported Zsh version is $min_zsh_version."
|
print "omz: The minimum supported Zsh version is $min_zsh_version."
|
||||||
fi
|
fi
|
||||||
unset min_zsh_version
|
unset min_zsh_version
|
||||||
|
|
||||||
# Disable color in dumb terminals.
|
# Disable color and theme in dumb terminals.
|
||||||
if [[ "$TERM" == 'dumb' ]]; then
|
if [[ "$TERM" == 'dumb' ]]; then
|
||||||
COLOR='false'
|
zstyle ':omz:*:*' color 'no'
|
||||||
|
zstyle ':omz:prompt' theme 'off'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get enabled plugins.
|
||||||
|
zstyle -a ':omz:load' plugin 'plugins'
|
||||||
|
|
||||||
# Add functions to fpath.
|
# Add functions to fpath.
|
||||||
fpath=(
|
fpath=(
|
||||||
${0:h}/themes/*(/FN)
|
${0:h}/themes/*(/FN)
|
||||||
|
@ -43,6 +47,7 @@ autoload -Uz zmv
|
||||||
|
|
||||||
# Source plugins defined in ~/.zshrc.
|
# Source plugins defined in ~/.zshrc.
|
||||||
for plugin in "$plugins[@]"; do
|
for plugin in "$plugins[@]"; do
|
||||||
|
zstyle ":omz:plugin:$plugin" enable 'yes'
|
||||||
if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then
|
if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then
|
||||||
source "${0:h}/plugins/$plugin/init.zsh"
|
source "${0:h}/plugins/$plugin/init.zsh"
|
||||||
fi
|
fi
|
||||||
|
@ -66,6 +71,11 @@ fi
|
||||||
# Load and run the prompt theming system.
|
# Load and run the prompt theming system.
|
||||||
autoload -Uz promptinit && promptinit
|
autoload -Uz promptinit && promptinit
|
||||||
|
|
||||||
|
# Load the prompt theme.
|
||||||
|
zstyle -a ':omz:prompt' theme 'prompt_argv'
|
||||||
|
prompt "$prompt_argv[@]"
|
||||||
|
unset prompt_argv
|
||||||
|
|
||||||
# Compile zcompdump, if modified, to increase startup speed.
|
# Compile zcompdump, if modified, to increase startup speed.
|
||||||
if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then
|
if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then
|
||||||
zcompile "$HOME/.zcompdump"
|
zcompile "$HOME/.zcompdump"
|
||||||
|
|
26
keyboard.zsh
26
keyboard.zsh
|
@ -4,8 +4,12 @@ if [[ "$TERM" == 'dumb' ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The default styles.
|
# The default styles.
|
||||||
zstyle ':prompt:' vicmd '<<<' # Indicator to notify of vi command mode.
|
|
||||||
zstyle ':prompt:' completion "..." # Indicator to notify of generating completion.
|
# Indicator to notify of vi command mode.
|
||||||
|
zstyle ':omz:prompt' vicmd '<<<'
|
||||||
|
|
||||||
|
# Indicator to notify of generating completion.
|
||||||
|
zstyle ':omz:completion:indicator' format "..."
|
||||||
|
|
||||||
# Beep on error in line editor.
|
# Beep on error in line editor.
|
||||||
setopt BEEP
|
setopt BEEP
|
||||||
|
@ -50,7 +54,7 @@ keyinfo=(
|
||||||
'BackTab' "$terminfo[kcbt]"
|
'BackTab' "$terminfo[kcbt]"
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ "$KEYMAP" == (emacs|) ]]; then
|
if zstyle -m ':omz:editor' keymap 'emacs'; then
|
||||||
# Use Emacs key bindings.
|
# Use Emacs key bindings.
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
|
@ -77,7 +81,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then
|
||||||
bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line
|
bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line
|
||||||
|
|
||||||
# Expand .... to ../..
|
# Expand .... to ../..
|
||||||
if check-bool "$DOT_EXPANSION"; then
|
if zstyle -t ':omz:editor' dot-expansion; then
|
||||||
bindkey "." expand-dot-to-parent-directory-path
|
bindkey "." expand-dot-to-parent-directory-path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -90,7 +94,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then
|
||||||
bindkey "$keyinfo[Control]r" history-incremental-search-backward
|
bindkey "$keyinfo[Control]r" history-incremental-search-backward
|
||||||
bindkey "$keyinfo[Control]s" history-incremental-search-forward
|
bindkey "$keyinfo[Control]s" history-incremental-search-forward
|
||||||
fi
|
fi
|
||||||
elif [[ "$KEYMAP" == 'vi' ]]; then
|
elif zstyle -m ':omz:editor' keymap 'vi'; then
|
||||||
# Use vi key bindings.
|
# Use vi key bindings.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
|
||||||
|
@ -110,7 +114,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then
|
||||||
function zle-keymap-select() {
|
function zle-keymap-select() {
|
||||||
if ! vi-restore-rprompt && [[ "$KEYMAP" == 'vicmd' ]]; then
|
if ! vi-restore-rprompt && [[ "$KEYMAP" == 'vicmd' ]]; then
|
||||||
RPROMPT_CACHED="$RPROMPT"
|
RPROMPT_CACHED="$RPROMPT"
|
||||||
zstyle -s ':prompt:' vicmd RPROMPT
|
zstyle -s ':omz:prompt' vicmd RPROMPT
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -139,7 +143,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then
|
||||||
bindkey -M vicmd "$keyinfo[Control]r" redo
|
bindkey -M vicmd "$keyinfo[Control]r" redo
|
||||||
|
|
||||||
# Expand .... to ../..
|
# Expand .... to ../..
|
||||||
if check-bool "$DOT_EXPANSION"; then
|
if zstyle -t ':omz:editor' dot-expansion; then
|
||||||
bindkey -M viins "." expand-dot-to-parent-directory-path
|
bindkey -M viins "." expand-dot-to-parent-directory-path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -194,7 +198,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then
|
||||||
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward
|
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
print "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2
|
print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -240,7 +244,7 @@ bindkey "$keyinfo[BackTab]" reverse-menu-complete
|
||||||
bindkey "$keyinfo[Control]i" expand-or-complete-prefix
|
bindkey "$keyinfo[Control]i" expand-or-complete-prefix
|
||||||
|
|
||||||
# Convert .... to ../.. automatically.
|
# Convert .... to ../.. automatically.
|
||||||
if check-bool "$DOT_EXPANSION"; then
|
if zstyle -t ':omz:editor' dot-expansion; then
|
||||||
function expand-dot-to-parent-directory-path() {
|
function expand-dot-to-parent-directory-path() {
|
||||||
if [[ $LBUFFER = *.. ]]; then
|
if [[ $LBUFFER = *.. ]]; then
|
||||||
LBUFFER+=/..
|
LBUFFER+=/..
|
||||||
|
@ -254,9 +258,9 @@ if check-bool "$DOT_EXPANSION"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display an indicator when completing.
|
# Display an indicator when completing.
|
||||||
if check-bool "$COMPLETION_INDICATOR"; then
|
if zstyle -t ':omz:completion:indicator' enable; then
|
||||||
function expand-or-complete-prefix-with-indicator() {
|
function expand-or-complete-prefix-with-indicator() {
|
||||||
zstyle -s ':prompt:' completion indicator
|
zstyle -s ':omz:completion:indicator' format indicator
|
||||||
print -Pn "$indicator"
|
print -Pn "$indicator"
|
||||||
unset indicator
|
unset indicator
|
||||||
zle expand-or-complete-prefix
|
zle expand-or-complete-prefix
|
||||||
|
|
|
@ -174,18 +174,18 @@ function git-info() {
|
||||||
|
|
||||||
# Format commit (short).
|
# Format commit (short).
|
||||||
commit_short="$commit[1,7]"
|
commit_short="$commit[1,7]"
|
||||||
zstyle -s ':git-info:' commit commit_format
|
zstyle -s ':omz:plugin:git:prompt' commit commit_format
|
||||||
zformat -f commit_formatted "$commit_format" "c:$commit_short"
|
zformat -f commit_formatted "$commit_format" "c:$commit_short"
|
||||||
|
|
||||||
# Stashed
|
# Stashed
|
||||||
if [[ -f "$(git-root)/.git/refs/stash" ]]; then
|
if [[ -f "$(git-root)/.git/refs/stash" ]]; then
|
||||||
stashed="$(git stash list 2>/dev/null | wc -l)"
|
stashed="$(git stash list 2>/dev/null | wc -l)"
|
||||||
zstyle -s ':git-info:' stashed stashed_format
|
zstyle -s ':omz:plugin:git:prompt' stashed stashed_format
|
||||||
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Assume that the working copy is clean.
|
# Assume that the working copy is clean.
|
||||||
zstyle -s ':git-info:' clean clean_formatted
|
zstyle -s ':omz:plugin:git:prompt' clean clean_formatted
|
||||||
|
|
||||||
while IFS=$'\n' read line; do
|
while IFS=$'\n' read line; do
|
||||||
(( line_number++ ))
|
(( line_number++ ))
|
||||||
|
@ -197,7 +197,7 @@ function git-info() {
|
||||||
# Get action.
|
# Get action.
|
||||||
action="$(_git-action)"
|
action="$(_git-action)"
|
||||||
if [[ -n "$action" ]]; then
|
if [[ -n "$action" ]]; then
|
||||||
zstyle -s ':git-info:' action action_format
|
zstyle -s ':omz:plugin:git:prompt' action action_format
|
||||||
zformat -f action_formatted "$action_format" "s:$action"
|
zformat -f action_formatted "$action_format" "s:$action"
|
||||||
fi
|
fi
|
||||||
elif (( line_number == 1 )) \
|
elif (( line_number == 1 )) \
|
||||||
|
@ -231,7 +231,7 @@ function git-info() {
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Format dirty.
|
# Format dirty.
|
||||||
[[ -z "$dirty" ]] && zstyle -s ':git-info:' dirty dirty_formatted && unset clean_formatted
|
[[ -z "$dirty" ]] && zstyle -s ':omz:plugin:git:prompt' dirty dirty_formatted && unset clean_formatted
|
||||||
|
|
||||||
# Count: added/deleted/modified/renamed/unmerged/untracked
|
# Count: added/deleted/modified/renamed/unmerged/untracked
|
||||||
[[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ ))
|
[[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ ))
|
||||||
|
@ -244,7 +244,7 @@ function git-info() {
|
||||||
done < <(git status --short --branch 2> /dev/null)
|
done < <(git status --short --branch 2> /dev/null)
|
||||||
|
|
||||||
# Format branch.
|
# Format branch.
|
||||||
zstyle -s ':git-info:' branch branch_format
|
zstyle -s ':omz:plugin:git:prompt' branch branch_format
|
||||||
zformat -f branch_formatted "$branch_format" "b:$branch"
|
zformat -f branch_formatted "$branch_format" "b:$branch"
|
||||||
|
|
||||||
# Format remote.
|
# Format remote.
|
||||||
|
@ -252,61 +252,61 @@ function git-info() {
|
||||||
[[ -z $remote ]] \
|
[[ -z $remote ]] \
|
||||||
&& remote=${$(git rev-parse --verify ${branch}@{upstream} \
|
&& remote=${$(git rev-parse --verify ${branch}@{upstream} \
|
||||||
--symbolic-full-name 2> /dev/null)#refs/remotes/}
|
--symbolic-full-name 2> /dev/null)#refs/remotes/}
|
||||||
zstyle -s ':git-info:' remote remote_format
|
zstyle -s ':omz:plugin:git:prompt' remote remote_format
|
||||||
zformat -f remote_formatted "$remote_format" "R:$remote"
|
zformat -f remote_formatted "$remote_format" "R:$remote"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format ahead.
|
# Format ahead.
|
||||||
if [[ -n "$ahead" ]]; then
|
if [[ -n "$ahead" ]]; then
|
||||||
zstyle -s ':git-info:' ahead ahead_format
|
zstyle -s ':omz:plugin:git:prompt' ahead ahead_format
|
||||||
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format behind.
|
# Format behind.
|
||||||
if [[ -n "$behind" ]]; then
|
if [[ -n "$behind" ]]; then
|
||||||
zstyle -s ':git-info:' behind behind_format
|
zstyle -s ':omz:plugin:git:prompt' behind behind_format
|
||||||
zformat -f behind_formatted "$behind_format" "B:$behind"
|
zformat -f behind_formatted "$behind_format" "B:$behind"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format added.
|
# Format added.
|
||||||
if (( $added > 0 )); then
|
if (( $added > 0 )); then
|
||||||
zstyle -s ':git-info:' added added_format
|
zstyle -s ':omz:plugin:git:prompt' added added_format
|
||||||
zformat -f added_formatted "$added_format" "a:$added_format"
|
zformat -f added_formatted "$added_format" "a:$added_format"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format deleted.
|
# Format deleted.
|
||||||
if (( $deleted > 0 )); then
|
if (( $deleted > 0 )); then
|
||||||
zstyle -s ':git-info:' deleted deleted_format
|
zstyle -s ':omz:plugin:git:prompt' deleted deleted_format
|
||||||
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
|
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format modified.
|
# Format modified.
|
||||||
if (( $modified > 0 )); then
|
if (( $modified > 0 )); then
|
||||||
zstyle -s ':git-info:' modified modified_format
|
zstyle -s ':omz:plugin:git:prompt' modified modified_format
|
||||||
zformat -f modified_formatted "$modified_format" "m:$modified"
|
zformat -f modified_formatted "$modified_format" "m:$modified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format renamed.
|
# Format renamed.
|
||||||
if (( $renamed > 0 )); then
|
if (( $renamed > 0 )); then
|
||||||
zstyle -s ':git-info:' renamed renamed_format
|
zstyle -s ':omz:plugin:git:prompt' renamed renamed_format
|
||||||
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
|
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format unmerged.
|
# Format unmerged.
|
||||||
if (( $unmerged > 0 )); then
|
if (( $unmerged > 0 )); then
|
||||||
zstyle -s ':git-info:' unmerged unmerged_format
|
zstyle -s ':omz:plugin:git:prompt' unmerged unmerged_format
|
||||||
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
|
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format untracked.
|
# Format untracked.
|
||||||
if (( $untracked > 0 )); then
|
if (( $untracked > 0 )); then
|
||||||
zstyle -s ':git-info:' untracked untracked_format
|
zstyle -s ':omz:plugin:git:prompt' untracked untracked_format
|
||||||
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
|
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Format prompts.
|
# Format prompts.
|
||||||
zstyle -s ':git-info:' prompt prompt_format
|
zstyle -s ':omz:plugin:git:prompt' prompt prompt_format
|
||||||
zstyle -s ':git-info:' rprompt rprompt_format
|
zstyle -s ':omz:plugin:git:prompt' rprompt rprompt_format
|
||||||
|
|
||||||
git_info_vars=(
|
git_info_vars=(
|
||||||
git_prompt_info "$prompt_format"
|
git_prompt_info "$prompt_format"
|
||||||
|
|
|
@ -1,18 +1,53 @@
|
||||||
# The default styles.
|
# The default styles.
|
||||||
zstyle ':git-info:' action 'action:%s' # %s - Special action name (am, merge, rebase).
|
|
||||||
zstyle ':git-info:' added 'added:%a' # %a - Indicator to notify of added files.
|
# %s - Special action name (am, merge, rebase).
|
||||||
zstyle ':git-info:' ahead 'ahead:%A' # %A - Indicator to notify of ahead branch.
|
zstyle ':omz:plugin:git:prompt' action 'action:%s'
|
||||||
zstyle ':git-info:' behind 'behind:%B' # %B - Indicator to notify of behind branch.
|
|
||||||
zstyle ':git-info:' branch '%b' # %b - Branch name.
|
# %a - Indicator to notify of added files.
|
||||||
zstyle ':git-info:' clean 'clean' # %C - Indicator to notify of clean branch.
|
zstyle ':omz:plugin:git:prompt' added 'added:%a'
|
||||||
zstyle ':git-info:' commit 'commit:%c' # %c - SHA-1 hash.
|
|
||||||
zstyle ':git-info:' deleted 'deleted:%d' # %d - Indicator to notify of deleted files.
|
# %A - Indicator to notify of ahead branch.
|
||||||
zstyle ':git-info:' dirty 'dirty' # %D - Indicator to notify of dirty branch.
|
zstyle ':omz:plugin:git:prompt' ahead 'ahead:%A'
|
||||||
zstyle ':git-info:' modified 'modified:%m' # %m - Indicator to notify of modified files.
|
|
||||||
zstyle ':git-info:' remote '%R' # %R - Remote name.
|
# %B - Indicator to notify of behind branch.
|
||||||
zstyle ':git-info:' renamed 'renamed:%r' # %r - Indicator to notify of renamed files.
|
zstyle ':omz:plugin:git:prompt' behind 'behind:%B'
|
||||||
zstyle ':git-info:' stashed 'stashed:%S' # %S - Indicator to notify of stashed files.
|
|
||||||
zstyle ':git-info:' unmerged 'unmerged:%U' # %U - Indicator to notify of unmerged files.
|
# %b - Branch name.
|
||||||
zstyle ':git-info:' untracked 'untracked:%u' # %u - Indicator to notify of untracked files.
|
zstyle ':omz:plugin:git:prompt' branch '%b'
|
||||||
zstyle ':git-info:' prompt ' git:(%b %D%C)' # Left prompt.
|
|
||||||
zstyle ':git-info:' rprompt '' # Right prompt.
|
# %C - Indicator to notify of clean branch.
|
||||||
|
zstyle ':omz:plugin:git:prompt' clean 'clean'
|
||||||
|
|
||||||
|
# %c - SHA-1 hash.
|
||||||
|
zstyle ':omz:plugin:git:prompt' commit 'commit:%c'
|
||||||
|
|
||||||
|
# %d - Indicator to notify of deleted files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' deleted 'deleted:%d'
|
||||||
|
|
||||||
|
# %D - Indicator to notify of dirty branch.
|
||||||
|
zstyle ':omz:plugin:git:prompt' dirty 'dirty'
|
||||||
|
|
||||||
|
# %m - Indicator to notify of modified files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' modified 'modified:%m'
|
||||||
|
|
||||||
|
# %R - Remote name.
|
||||||
|
zstyle ':omz:plugin:git:prompt' remote '%R'
|
||||||
|
|
||||||
|
# %r - Indicator to notify of renamed files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' renamed 'renamed:%r'
|
||||||
|
|
||||||
|
# %S - Indicator to notify of stashed files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' stashed 'stashed:%S'
|
||||||
|
|
||||||
|
# %U - Indicator to notify of unmerged files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' unmerged 'unmerged:%U'
|
||||||
|
|
||||||
|
# %u - Indicator to notify of untracked files.
|
||||||
|
zstyle ':omz:plugin:git:prompt' untracked 'untracked:%u'
|
||||||
|
|
||||||
|
# Left prompt.
|
||||||
|
zstyle ':omz:plugin:git:prompt' prompt ' git:(%b %D%C)'
|
||||||
|
|
||||||
|
# Right prompt.
|
||||||
|
zstyle ':omz:plugin:git:prompt' rprompt ''
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
# FILE: gnu-utils.plugin.zsh
|
# FILE: gnu-utils.plugin.zsh
|
||||||
# DESCRIPTION: oh-my-zsh plugin file.
|
# DESCRIPTION: oh-my-zsh plugin file.
|
||||||
# AUTHOR: Sorin Ionescu <sorin.ionescu@gmail.com>
|
# AUTHOR: Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
# VERSION: 1.0.1
|
# VERSION: 1.0.2
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
if (( $+commands[gwhoami] )); then
|
if (( $+commands[gdircolors] )); then
|
||||||
function __gnu_utils() {
|
function __gnu_utils() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
local gcmds
|
local gcmds
|
||||||
|
@ -59,5 +59,13 @@ if (( $+commands[gwhoami] )); then
|
||||||
function rehash() {
|
function rehash() {
|
||||||
hash -r "$@"
|
hash -r "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A sensible default for ls.
|
||||||
|
if zstyle -t ':omz:alias:ls' color && [[ -f "$HOME/.dir_colors" ]]; then
|
||||||
|
eval $(gdircolors "$HOME/.dir_colors")
|
||||||
|
alias ls='ls -hF --group-directories-first --color=auto'
|
||||||
|
else
|
||||||
|
alias ls='ls -hF --group-directories-first'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
source "${0:h}/history-substring-search.zsh"
|
source "${0:h}/history-substring-search.zsh"
|
||||||
|
|
||||||
if check-bool "$CASE_SENSITIVE"; then
|
if zstyle -t ':omz:plugin:history-substring-search' case-sensitive; then
|
||||||
unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
|
unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check-bool "$COLOR"; then
|
if ! zstyle -t ':omz:plugin:history-substring-search' color; then
|
||||||
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
|
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
|
||||||
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
|
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
# To enabled agent forwarding support, add the following to
|
# To enabled agent forwarding support, add the following to
|
||||||
# your .zshrc file:
|
# your .zshrc file:
|
||||||
#
|
#
|
||||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
# zstyle ':omz:plugin:ssh-agent' forwarding 'on'
|
||||||
#
|
#
|
||||||
# To load multiple identies, use the identities style, For
|
# To load multiple identies, use the identities style, For
|
||||||
# example:
|
# example:
|
||||||
#
|
#
|
||||||
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
|
# zstyle ':omz:plugin:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github'
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# CREDITS
|
# CREDITS
|
||||||
|
@ -33,13 +33,13 @@ function _ssh-agent-start() {
|
||||||
source "${_ssh_agent_env}" > /dev/null
|
source "${_ssh_agent_env}" > /dev/null
|
||||||
|
|
||||||
# Load identies.
|
# Load identies.
|
||||||
zstyle -a :omz:plugins:ssh-agent identities identities
|
zstyle -a ':omz:plugin:ssh-agent' identities 'identities'
|
||||||
print starting...
|
print starting...
|
||||||
/usr/bin/ssh-add "$HOME/.ssh/${^identities}"
|
/usr/bin/ssh-add "$HOME/.ssh/${^identities}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test if agent-forwarding is enabled.
|
# Test if agent-forwarding is enabled.
|
||||||
zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding
|
zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding'
|
||||||
if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
|
if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
|
||||||
# Add a nifty symlink for screen/tmux if agent forwarding.
|
# Add a nifty symlink for screen/tmux if agent forwarding.
|
||||||
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
|
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
|
||||||
|
|
|
@ -1,34 +1,30 @@
|
||||||
# Set the path to Oh My Zsh.
|
|
||||||
OMZ="$HOME/.oh-my-zsh"
|
|
||||||
|
|
||||||
# Set the key mapping style to 'emacs' or 'vi'.
|
# Set the key mapping style to 'emacs' or 'vi'.
|
||||||
KEYMAP='emacs'
|
zstyle ':omz:editor' keymap 'emacs'
|
||||||
|
|
||||||
# Set case-sensitivity for completion, history lookup, etc.
|
|
||||||
CASE_SENSITIVE='false'
|
|
||||||
|
|
||||||
# Color output (auto set to 'false' on dumb terminals).
|
|
||||||
COLOR='true'
|
|
||||||
|
|
||||||
# Auto set the tab and window titles.
|
|
||||||
AUTO_TITLE='true'
|
|
||||||
|
|
||||||
# Auto convert .... to ../..
|
# Auto convert .... to ../..
|
||||||
DOT_EXPANSION='false'
|
zstyle ':omz:editor' dot-expansion 'no'
|
||||||
|
|
||||||
|
# Set case-sensitivity for completion, history lookup, etc.
|
||||||
|
zstyle ':omz:*:*' case-sensitive 'no'
|
||||||
|
|
||||||
|
# Color output (auto set to 'no' on dumb terminals).
|
||||||
|
zstyle ':omz:*:*' color 'yes'
|
||||||
|
|
||||||
|
# Auto set the tab and window titles.
|
||||||
|
zstyle ':omz:terminal' auto-title 'yes'
|
||||||
|
|
||||||
# Indicate that completions are being generated.
|
# Indicate that completions are being generated.
|
||||||
COMPLETION_INDICATOR='false'
|
zstyle ':omz:completion:indicator' enable 'no'
|
||||||
|
|
||||||
# Set the plugins to load (see $OMZ/plugins/).
|
# Set the plugins to load (see $OMZ/plugins/).
|
||||||
# Example: plugins=(git lighthouse rails ruby textmate)
|
zstyle ':omz:load' plugin 'archive' 'git'
|
||||||
plugins=(git)
|
|
||||||
|
# Setting it to 'random' loads a random theme.
|
||||||
|
# Auto set to 'off' on dumb terminals.
|
||||||
|
zstyle ':omz:prompt' theme 'sorin'
|
||||||
|
|
||||||
# This will make you shout: OH MY ZSHELL!
|
# This will make you shout: OH MY ZSHELL!
|
||||||
source "$OMZ/init.zsh"
|
source "$HOME/.oh-my-zsh/init.zsh"
|
||||||
|
|
||||||
# Load the prompt theme (type prompt -l to list all themes).
|
|
||||||
# Setting it to 'random' loads a random theme.
|
|
||||||
[[ "$TERM" != 'dumb' ]] && prompt sorin || prompt off
|
|
||||||
|
|
||||||
# Customize to your needs...
|
# Customize to your needs...
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
# Sets the tab and window titles before the prompt is displayed.
|
# Sets the tab and window titles before the prompt is displayed.
|
||||||
function set-title-precmd {
|
function set-title-precmd {
|
||||||
if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && check-bool "$AUTO_TITLE"; then
|
if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then
|
||||||
set-window-title "${(%):-%~}"
|
set-window-title "${(%):-%~}"
|
||||||
for kind in tab screen; do
|
for kind in tab screen; do
|
||||||
# Left-truncate the current working directory to 15 characters.
|
# Left-truncate the current working directory to 15 characters.
|
||||||
|
@ -85,7 +85,7 @@ add-zsh-hook precmd set-title-precmd
|
||||||
|
|
||||||
# Sets the tab and window titles before command execution.
|
# Sets the tab and window titles before command execution.
|
||||||
function set-title-preexec {
|
function set-title-preexec {
|
||||||
if check-bool "$AUTO_TITLE"; then
|
if zstyle -t ':omz:terminal' auto-title; then
|
||||||
set-title-by-command "$2"
|
set-title-by-command "$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,22 +22,22 @@ function prompt_sorin_setup() {
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
add-zsh-hook precmd prompt_sorin_precmd
|
add-zsh-hook precmd prompt_sorin_precmd
|
||||||
|
|
||||||
zstyle ':prompt:' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f'
|
zstyle ':omz:completion:indicator' format '%B%F{red}...%f%b'
|
||||||
zstyle ':prompt:' completion '%B%F{red}...%f%b'
|
zstyle ':omz:prompt' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f'
|
||||||
zstyle ':git-info:' action ':%%B%F{yellow}%s%f%%b'
|
zstyle ':omz:plugin:git:prompt' action ':%%B%F{yellow}%s%f%%b'
|
||||||
zstyle ':git-info:' added ' %%B%F{green}✚%f%%b'
|
zstyle ':omz:plugin:git:prompt' added ' %%B%F{green}✚%f%%b'
|
||||||
zstyle ':git-info:' ahead ' %%B%F{yellow}⬆%f%%b'
|
zstyle ':omz:plugin:git:prompt' ahead ' %%B%F{yellow}⬆%f%%b'
|
||||||
zstyle ':git-info:' behind ' %%B%F{yellow}⬇%f%%b'
|
zstyle ':omz:plugin:git:prompt' behind ' %%B%F{yellow}⬇%f%%b'
|
||||||
zstyle ':git-info:' branch ':%F{red}%b%f'
|
zstyle ':omz:plugin:git:prompt' branch ':%F{red}%b%f'
|
||||||
zstyle ':git-info:' deleted ' %%B%F{red}✖%f%%b'
|
zstyle ':omz:plugin:git:prompt' deleted ' %%B%F{red}✖%f%%b'
|
||||||
zstyle ':git-info:' modified ' %%B%F{blue}✱%f%%b'
|
zstyle ':omz:plugin:git:prompt' modified ' %%B%F{blue}✱%f%%b'
|
||||||
zstyle ':git-info:' renamed ' %%B%F{magenta}➜%f%%b'
|
zstyle ':omz:plugin:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
|
||||||
zstyle ':git-info:' commit '%c'
|
zstyle ':omz:plugin:git:prompt' commit '%c'
|
||||||
zstyle ':git-info:' stashed ' %%B%F{cyan}✭%f%%b'
|
zstyle ':omz:plugin:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
|
||||||
zstyle ':git-info:' unmerged ' %%B%F{yellow}═%f%%b'
|
zstyle ':omz:plugin:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
|
||||||
zstyle ':git-info:' untracked ' %%B%F{white}◼%f%%b'
|
zstyle ':omz:plugin:git:prompt' untracked ' %%B%F{white}◼%f%%b'
|
||||||
zstyle ':git-info:' prompt ' %F{blue}git%f%b%s'
|
zstyle ':omz:plugin:git:prompt' prompt ' %F{blue}git%f%b%s'
|
||||||
zstyle ':git-info:' rprompt '%A%B%S%a%d%m%r%U%u'
|
zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
|
||||||
|
|
||||||
PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) '
|
PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) '
|
||||||
RPROMPT='%(?::%F{red}⏎%f)${git_rprompt_info}'
|
RPROMPT='%(?::%F{red}⏎%f)${git_rprompt_info}'
|
||||||
|
|
Loading…
Reference in a new issue