Fix coding styles for ./lib/*

This commit is contained in:
Satoshi Ohmori 2015-11-25 01:03:35 +09:00
commit df136ebb99
9 changed files with 85 additions and 77 deletions

View file

@ -1,10 +1,10 @@
## Bazaar integration ## Bazaar integration
## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT ## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
function bzr_prompt_info() { function bzr_prompt_info() {
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` BZR_CB=$(bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}')
if [ -n "$BZR_CB" ]; then if [ -n "$BZR_CB" ]; then
BZR_DIRTY="" BZR_DIRTY=""
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}" [[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi fi
} }

View file

@ -18,6 +18,7 @@
function clipcopy() { function clipcopy() {
emulate -L zsh emulate -L zsh
local file=$1 local file=$1
if [[ $OSTYPE == darwin* ]]; then if [[ $OSTYPE == darwin* ]]; then
if [[ -z $file ]]; then if [[ -z $file ]]; then
pbcopy pbcopy

View file

@ -23,8 +23,8 @@ function handle_completion_insecurities() {
# If no such directories exist, get us out of here. # If no such directories exist, get us out of here.
if (( ! ${#insecure_dirs} )); then if (( ! ${#insecure_dirs} )); then
print "[oh-my-zsh] No insecure completion-dependent directories detected." print "[oh-my-zsh] No insecure completion-dependent directories detected."
return return
fi fi
# List ownership and permissions of all insecure directories. # List ownership and permissions of all insecure directories.

View file

@ -72,10 +72,12 @@ function omz_diagnostic_dump() {
if [[ ${#*} > 0 ]]; then if [[ ${#*} > 0 ]]; then
opt_outfile=$1 opt_outfile=$1
fi fi
if [[ ${#*} > 1 ]]; then if [[ ${#*} > 1 ]]; then
builtin echo "$thisfcn: error: too many arguments" >&2 builtin echo "$thisfcn: error: too many arguments" >&2
return 1 return 1
fi fi
if [[ -n "$opt_outfile" ]]; then if [[ -n "$opt_outfile" ]]; then
outfile="$opt_outfile" outfile="$opt_outfile"
fi fi
@ -124,6 +126,7 @@ function _omz_diag_dump_one_big_text() {
for program in $programs; do for program in $programs; do
extra_str="" sha_str="" extra_str="" sha_str=""
progfile=$(builtin which $program) progfile=$(builtin which $program)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
if [[ -e $progfile ]]; then if [[ -e $progfile ]]; then
if builtin whence shasum &>/dev/null; then if builtin whence shasum &>/dev/null; then
@ -140,6 +143,7 @@ function _omz_diag_dump_one_big_text() {
builtin echo "$program: not found" builtin echo "$program: not found"
fi fi
done done
builtin echo builtin echo
builtin echo Command Versions: builtin echo Command Versions:
builtin echo "zsh: $(zsh --version)" builtin echo "zsh: $(zsh --version)"
@ -350,4 +354,3 @@ function _omz_diag_dump_os_specific_version() {
builtin echo builtin echo
done done
} }

View file

@ -31,31 +31,37 @@ function parse_git_dirty() {
# Gets the difference between the local and remote branches # Gets the difference between the local and remote branches
function git_remote_status() { function git_remote_status() {
local remote ahead behind git_remote_status git_remote_status_detailed local remote ahead behind git_remote_status git_remote_status_detailed
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
if [[ -n ${remote} ]]; then
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then if [[ -n ${remote} ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
fi
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
fi elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
echo $git_remote_status git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
fi fi
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
fi
echo $git_remote_status
fi
if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
fi
echo $git_remote_status
} }
# Outputs the name of the current branch # Outputs the name of the current branch

View file

@ -3,15 +3,15 @@
autoload -Uz is-at-least autoload -Uz is-at-least
if [[ $ZSH_VERSION != 5.1.1 ]]; then if [[ $ZSH_VERSION != 5.1.1 ]]; then
for d in $fpath; do for d in $fpath; do
if [[ -e "$d/url-quote-magic" ]]; then if [[ -e "$d/url-quote-magic" ]]; then
if is-at-least 5.1; then if is-at-least 5.1; then
autoload -Uz bracketed-paste-magic autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic zle -N bracketed-paste bracketed-paste-magic
fi fi
autoload -Uz url-quote-magic autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic zle -N self-insert url-quote-magic
break break
fi fi
done done
fi fi
@ -35,7 +35,7 @@ fi
# only define LC_CTYPE if undefined # only define LC_CTYPE if undefined
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
fi fi
# recognize comments # recognize comments

View file

@ -6,17 +6,17 @@
typeset -AHg FX FG BG typeset -AHg FX FG BG
FX=( FX=(
reset "%{%}" reset "%{%}"
bold "%{%}" no-bold "%{%}" bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}" italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}" underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}" blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}" reverse "%{%}" no-reverse "%{%}"
) )
for color in {000..255}; do for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}" FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}" BG[$color]="%{[48;5;${color}m%}"
done done

View file

@ -6,7 +6,7 @@
# Fully supports screen, iterm, and probably most modern xterm and rxvt # Fully supports screen, iterm, and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used) # (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately) # Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title { function title() {
emulate -L zsh emulate -L zsh
setopt prompt_subst setopt prompt_subst
@ -49,7 +49,7 @@ if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
fi fi
# Runs before showing the prompt # Runs before showing the prompt
function omz_termsupport_precmd { function omz_termsupport_precmd() {
emulate -L zsh emulate -L zsh
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
@ -60,7 +60,7 @@ function omz_termsupport_precmd {
} }
# Runs before executing the command # Runs before executing the command
function omz_termsupport_preexec { function omz_termsupport_preexec() {
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob

View file

@ -3,8 +3,7 @@ autoload -U colors && colors
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Enable ls colors # Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ] if [ "$DISABLE_LS_COLORS" != "true" ]; then
then
# Find the option for using colors in ls, depending on the version: Linux or BSD # Find the option for using colors in ls, depending on the version: Linux or BSD
if [[ "$(uname -s)" == "NetBSD" ]]; then if [[ "$(uname -s)" == "NetBSD" ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
@ -27,11 +26,10 @@ setopt auto_cd
setopt multios setopt multios
setopt cdablevars setopt cdablevars
if [[ x$WINDOW != x ]] if [[ x$WINDOW != x ]]; then
then SCREEN_NO="%B$WINDOW%b "
SCREEN_NO="%B$WINDOW%b "
else else
SCREEN_NO="" SCREEN_NO=""
fi fi
# Apply theming defaults # Apply theming defaults