mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 20:57:59 +00:00
Check for non-empty files, not just existance
This commit is contained in:
parent
3ed8265e28
commit
e5ec94af42
@ -58,7 +58,7 @@ function omodload {
|
|||||||
print "$0: no such module: $omodule" >&2
|
print "$0: no such module: $omodule" >&2
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
if [[ -f "$OMZ/modules/$omodule/init.zsh" ]]; then
|
if [[ -s "$OMZ/modules/$omodule/init.zsh" ]]; then
|
||||||
source "$OMZ/modules/$omodule/init.zsh"
|
source "$OMZ/modules/$omodule/init.zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
2
init.zsh
2
init.zsh
@ -47,7 +47,7 @@ fi
|
|||||||
|
|
||||||
# Compile the completion dump, to increase startup speed.
|
# Compile the completion dump, to increase startup speed.
|
||||||
dump_file="$HOME/.zcompdump"
|
dump_file="$HOME/.zcompdump"
|
||||||
if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -f "${dump_file}.zwc" ]]; then
|
if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -s "${dump_file}.zwc" ]]; then
|
||||||
zcompile "$dump_file"
|
zcompile "$dump_file"
|
||||||
fi
|
fi
|
||||||
unset dump_file
|
unset dump_file
|
||||||
|
@ -16,7 +16,7 @@ if is-callable 'dircolors'; then
|
|||||||
alias ls='ls --group-directories-first'
|
alias ls='ls --group-directories-first'
|
||||||
|
|
||||||
if zstyle -t ':omz:alias:ls' color; then
|
if zstyle -t ':omz:alias:ls' color; then
|
||||||
if [[ -f "$HOME/.dir_colors" ]]; then
|
if [[ -s "$HOME/.dir_colors" ]]; then
|
||||||
eval "$(dircolors "$HOME/.dir_colors")"
|
eval "$(dircolors "$HOME/.dir_colors")"
|
||||||
else
|
else
|
||||||
eval "$(dircolors)"
|
eval "$(dircolors)"
|
||||||
|
@ -28,7 +28,7 @@ if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
if [[ ! -f "$1" ]]; then
|
if [[ ! -s "$1" ]]; then
|
||||||
print "$0: file not valid: $1" >&2
|
print "$0: file not valid: $1" >&2
|
||||||
shift
|
shift
|
||||||
continue
|
continue
|
||||||
|
@ -24,7 +24,7 @@ if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
if [[ ! -f "$1" ]]; then
|
if [[ ! -s "$1" ]]; then
|
||||||
print "$0: file not valid: $1" >&2
|
print "$0: file not valid: $1" >&2
|
||||||
shift
|
shift
|
||||||
continue
|
continue
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# Joseph Jon Booker <joe@neoturbine.net>
|
# Joseph Jon Booker <joe@neoturbine.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ -f /etc/zsh_command_not_found ]]; then
|
if [[ -s /etc/zsh_command_not_found ]]; then
|
||||||
source /etc/zsh_command_not_found
|
source /etc/zsh_command_not_found
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-
|
|||||||
zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'
|
zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'
|
||||||
|
|
||||||
# Mutt
|
# Mutt
|
||||||
if [[ -f ~/.mutt/aliases ]]; then
|
if [[ -s ~/.mutt/aliases ]]; then
|
||||||
zstyle ':completion:*:*:mutt:*' menu yes select
|
zstyle ':completion:*:*:mutt:*' menu yes select
|
||||||
zstyle ':completion:*:mutt:*' users ${${${(f)"$(<~/.mutt/aliases)"}#alias[[:space:]]}%%[[:space:]]*}
|
zstyle ':completion:*:mutt:*' users ${${${(f)"$(<~/.mutt/aliases)"}#alias[[:space:]]}%%[[:space:]]*}
|
||||||
fi
|
fi
|
||||||
|
@ -19,7 +19,7 @@ function _gpg-agent-start {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Source GPG agent settings, if applicable.
|
# Source GPG agent settings, if applicable.
|
||||||
if [[ -f "${_gpg_env}" ]]; then
|
if [[ -s "${_gpg_env}" ]]; then
|
||||||
source "${_gpg_env}" > /dev/null
|
source "${_gpg_env}" > /dev/null
|
||||||
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || {
|
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || {
|
||||||
_gpg-agent-start
|
_gpg-agent-start
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
cache_file="${0:h}/cache.zsh"
|
cache_file="${0:h}/cache.zsh"
|
||||||
if [[ ! -f "$cache_file" ]]; then
|
if [[ ! -s "$cache_file" ]]; then
|
||||||
if (( $+commands[npm] )); then
|
if (( $+commands[npm] )); then
|
||||||
# npm is slow; cache its output.
|
# npm is slow; cache its output.
|
||||||
npm completion >! "$cache_file" 2> /dev/null
|
npm completion >! "$cache_file" 2> /dev/null
|
||||||
|
@ -21,7 +21,7 @@ if [[ "$OSTYPE" == darwin* ]]; then
|
|||||||
perl_path="$HOME/Library/Perl/5.12"
|
perl_path="$HOME/Library/Perl/5.12"
|
||||||
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
||||||
manpath=("$perl_path/man" $manpath)
|
manpath=("$perl_path/man" $manpath)
|
||||||
if [[ ! -f "$cache_file" ]]; then
|
if [[ ! -s "$cache_file" ]]; then
|
||||||
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
||||||
source "$cache_file"
|
source "$cache_file"
|
||||||
else
|
else
|
||||||
|
@ -51,7 +51,7 @@ zstyle -b ':omz:module:ssh-agent' forwarding '_ssh_agent_forwarding'
|
|||||||
if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
|
if is-true "${_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
|
||||||
elif [ -f "${_ssh_agent_env}" ]; then
|
elif [[ -s "${_ssh_agent_env}" ]]; then
|
||||||
# Source SSH settings, if applicable.
|
# Source SSH settings, if applicable.
|
||||||
source "${_ssh_agent_env}" > /dev/null
|
source "${_ssh_agent_env}" > /dev/null
|
||||||
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'ssh-agent$' || {
|
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'ssh-agent$' || {
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
local config_file="$HOME/.wakeonlan/$1"
|
local config_file="$HOME/.wakeonlan/$1"
|
||||||
if [[ ! -f "$config_file" ]]; then
|
if [[ ! -s "$config_file" ]]; then
|
||||||
print "$0: no such device file: $1" >&2
|
print "$0: invalid device file: $1" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ _z_prefixes=(
|
|||||||
for _z_prefix in "$_z_prefixes[@]"; do
|
for _z_prefix in "$_z_prefixes[@]"; do
|
||||||
_z_sh="${_z_prefix}/etc/profile.d/z.sh"
|
_z_sh="${_z_prefix}/etc/profile.d/z.sh"
|
||||||
|
|
||||||
if [[ -f "$_z_sh" ]]; then
|
if [[ -s "$_z_sh" ]]; then
|
||||||
source "$_z_sh"
|
source "$_z_sh"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user