Compare commits

...

3 Commits

Author SHA1 Message Date
Zoey Hewll
b6fe3c0488
Merge da3dce98bb into 6e564503f1 2025-01-13 16:35:58 -05:00
Indrajit Raychaudhuri
6e564503f1 general: Apply quote styling consistency
Remove redundant quotes from comparisons and
variable expansions where they are not needed.

Also add style nits to comments and code.
2025-01-10 11:09:08 -06:00
Zoey Llewellyn Hewll
da3dce98bb Add 'tracked' context to git-info
* add :prezto:module:git:info:tracked (%t) to format dirty tracked file count
2018-12-26 17:17:26 +08:00
7 changed files with 35 additions and 23 deletions

View File

@ -173,7 +173,7 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
fi fi
# Disable color and theme in dumb terminals. # Disable color and theme in dumb terminals.
if [[ "$TERM" == 'dumb' ]]; then if [[ $TERM == dumb ]]; then
zstyle ':prezto:*:*' color 'no' zstyle ':prezto:*:*' color 'no'
zstyle ':prezto:module:prompt' theme 'off' zstyle ':prezto:module:prompt' theme 'off'
fi fi

View File

@ -7,7 +7,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ $TERM == 'dumb' ]]; then if [[ $TERM == dumb ]]; then
return 1 return 1
fi fi

View File

@ -14,7 +14,7 @@
# paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic # paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic
# which is generally better than url-quote-magic so we load that when possible. # which is generally better than url-quote-magic so we load that when possible.
autoload -Uz is-at-least autoload -Uz is-at-least
if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then if [[ $ZSH_VERSION != 5.1.1 && $TERM != dumb ]]; then
if is-at-least 5.2; then if is-at-least 5.2; then
autoload -Uz bracketed-paste-url-magic autoload -Uz bracketed-paste-url-magic
zle -N bracketed-paste bracketed-paste-url-magic zle -N bracketed-paste bracketed-paste-url-magic
@ -34,7 +34,8 @@ setopt COMBINING_CHARS # Combine zero-length punctuation characters (accent
# with the base character. # with the base character.
setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell.
setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed. unsetopt MAIL_WARNING # Don't print a warning message if a mail file has
# been accessed.
# Allow mapping Ctrl+S and Ctrl+Q shortcuts # Allow mapping Ctrl+S and Ctrl+Q shortcuts
[[ -r ${TTY:-} && -w ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY [[ -r ${TTY:-} && -w ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY
@ -43,23 +44,23 @@ unsetopt MAIL_WARNING # Don't print a warning message if a mail file has b
# Jobs # Jobs
# #
setopt LONG_LIST_JOBS # List jobs in the long format by default. setopt LONG_LIST_JOBS # List jobs in the long format by default.
setopt AUTO_RESUME # Attempt to resume existing job before creating a new process. setopt AUTO_RESUME # Attempt to resume existing job before creating a new process.
setopt NOTIFY # Report status of background jobs immediately. setopt NOTIFY # Report status of background jobs immediately.
unsetopt BG_NICE # Don't run all background jobs at a lower priority. unsetopt BG_NICE # Don't run all background jobs at a lower priority.
unsetopt HUP # Don't kill jobs on shell exit. unsetopt HUP # Don't kill jobs on shell exit.
unsetopt CHECK_JOBS # Don't report on jobs when shell exit. unsetopt CHECK_JOBS # Don't report on jobs when shell exit.
# #
# Termcap # Termcap
# #
if zstyle -t ':prezto:environment:termcap' color; then if zstyle -t ':prezto:environment:termcap' color; then
export LESS_TERMCAP_mb=$'\E[01;31m' # Begins blinking. export LESS_TERMCAP_mb=$'\E[01;31m' # Begins blinking.
export LESS_TERMCAP_md=$'\E[01;31m' # Begins bold. export LESS_TERMCAP_md=$'\E[01;31m' # Begins bold.
export LESS_TERMCAP_me=$'\E[0m' # Ends mode. export LESS_TERMCAP_me=$'\E[0m' # Ends mode.
export LESS_TERMCAP_se=$'\E[0m' # Ends standout-mode. export LESS_TERMCAP_se=$'\E[0m' # Ends standout-mode.
export LESS_TERMCAP_so=$'\E[00;47;30m' # Begins standout-mode. export LESS_TERMCAP_so=$'\E[00;47;30m' # Begins standout-mode.
export LESS_TERMCAP_ue=$'\E[0m' # Ends underline. export LESS_TERMCAP_ue=$'\E[0m' # Ends underline.
export LESS_TERMCAP_us=$'\E[01;32m' # Begins underline. export LESS_TERMCAP_us=$'\E[01;32m' # Begins underline.
fi fi

View File

@ -149,6 +149,9 @@ function git-info {
local dirty=0 local dirty=0
local dirty_format local dirty_format
local dirty_formatted local dirty_formatted
local tracked=0
local tracked_format
local tracked_formatted
local ignore_submodules local ignore_submodules
local indexed=0 local indexed=0
local indexed_format local indexed_format
@ -413,6 +416,13 @@ function git-info {
fi fi
fi fi
# Format tracked.
(( tracked = dirty - untracked ))
if (( tracked > 0 )); then
zstyle -s ':prezto:module:git:info:tracked' format 'tracked_format'
zformat -f tracked_formatted "$tracked_format" "t:$tracked"
fi
# Format dirty and clean. # Format dirty and clean.
if (( dirty > 0 )); then if (( dirty > 0 )); then
zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format' zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format'
@ -447,6 +457,7 @@ function git-info {
"s:$action_formatted" \ "s:$action_formatted" \
"S:$stashed_formatted" \ "S:$stashed_formatted" \
"U:$unmerged_formatted" \ "U:$unmerged_formatted" \
"t:$tracked_formatted" \
"u:$untracked_formatted" "u:$untracked_formatted"
git_info[$info_format]="$REPLY" git_info[$info_format]="$REPLY"
done done

View File

@ -7,7 +7,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then if [[ $TERM == dumb ]]; then
return 1 return 1
fi fi

View File

@ -7,7 +7,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then if [[ $TERM == (dumb|linux|*bsd*|eterm*) ]]; then
return 1 return 1
fi fi
@ -60,7 +60,7 @@ function _terminal-set-titles-with-command {
local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}" local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}"
unset MATCH unset MATCH
if [[ "$TERM" == screen* ]]; then if [[ $TERM == screen* ]]; then
set-multiplexer-title "$truncated_cmd" set-multiplexer-title "$truncated_cmd"
fi fi
set-tab-title "$truncated_cmd" set-tab-title "$truncated_cmd"
@ -78,7 +78,7 @@ function _terminal-set-titles-with-path {
local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}"
unset MATCH unset MATCH
if [[ "$TERM" == screen* ]]; then if [[ $TERM == screen* ]]; then
set-multiplexer-title "$truncated_path" set-multiplexer-title "$truncated_path"
fi fi
set-tab-title "$truncated_path" set-tab-title "$truncated_path"
@ -89,7 +89,7 @@ function _terminal-set-titles-with-path {
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
# Set up the Apple Terminal. # Set up the Apple Terminal.
if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] \ if [[ $TERM_PROGRAM == Apple_Terminal ]] \
&& ( ! [[ -n "$STY" || -n "$TMUX" || -n "$DVTM" ]] ) && ( ! [[ -n "$STY" || -n "$TMUX" || -n "$DVTM" ]] )
then then
# Sets the Terminal.app current working directory before the prompt is # Sets the Terminal.app current working directory before the prompt is

View File

@ -14,6 +14,6 @@ SAYINGS=(
) )
# Print a randomly-chosen message: # Print a randomly-chosen message:
echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))] echo $SAYINGS[$(($RANDOM % $#SAYINGS + 1))]
} >&2 } >&2