Compare commits

...

2 commits

Author SHA1 Message Date
pull[bot]
0a09d67979
Merge pull request #294 from dmitmel/master
[pull] master from dmitmel:master
2021-06-23 11:01:47 +00:00
Dmytro Meleshko
19d8023326 [zsh] add stuff from my local zshrc's 2021-06-23 13:18:34 +03:00
3 changed files with 32 additions and 4 deletions

View file

@ -114,3 +114,11 @@ fi
alias bytefmt2="numfmt --to=iec-i --suffix=B"
alias bytefmt10="numfmt --to=si --suffix=B"
if command_exists dragon-drag-and-drop && ! command_exists dragon; then
alias dragon='dragon-drag-and-drop'
fi
if gnu_time_path="$(command_locate time)" && [[ -n "$gnu_time_path" ]]; then
alias gtime="${(q)gnu_time_path} -v"
fi

View file

@ -26,7 +26,11 @@ viscd() {
}
}
command_exists() { command -v "$1" &>/dev/null; }
# Checks if a word can be meaningfully executed as a command (aliases,
# functions and builtins also count).
command_exists() { whence -- "$@" &>/dev/null; }
# Searches the command binary in PATH.
command_locate() { whence -p -- "$@"; }
lazy_load() {
local command="$1"
@ -131,3 +135,14 @@ sync_working_dir_load() {
fi
}
alias cds="sync_working_dir_load"
discord-avatar() {
setopt local_options err_return
if (( $# != 1 )); then
print >&2 "Usage: $0 [user_snowflake]"
return 1
fi
local avatar_url
avatar_url="$(discord-whois --image-size 4096 --get 'Avatar' "$1")"
open "$avatar_url"
}

View file

@ -14,8 +14,7 @@ _plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-confi
_plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \
after_load='plugin-cfg-path fpath prepend ""'
rustup_bin="${commands[rustup]}"
if [[ -n "$rustup_bin" ]]; then
if rustup_bin="$(command_locate rustup)" && [[ -n "$rustup_bin" ]]; then
rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup"
if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then
_perf_timer_start "generate rustup completions"
@ -23,7 +22,7 @@ if [[ -n "$rustup_bin" ]]; then
_perf_timer_stop "generate rustup completions"
fi
unset rustup_comp_path
fi
fi; unset rustup_bin
# compinit {{{
_perf_timer_start "compinit"
@ -146,4 +145,10 @@ if [[ "$TERM" != "linux" ]]; then
fi
fi
if (( _is_macos )); then
plugin retina 'https://raw.githubusercontent.com/lunixbochs/meta/master/utils/retina/retina.m' from=url \
build='mkdir -p bin && gcc retina.m -framework Foundation -framework AppKit -o bin/retina' \
after_load='plugin-cfg-path path prepend "bin"'
fi
unset _checkout_latest_version