diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 99883bd..1a40d6f 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -114,11 +114,3 @@ 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 diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 3a21626..f378e7e 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -26,11 +26,7 @@ viscd() { } } -# 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 -- "$@"; } +command_exists() { command -v "$1" &>/dev/null; } lazy_load() { local command="$1" @@ -135,14 +131,3 @@ 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" -} diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 174551f..1472428 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -14,7 +14,8 @@ _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 ""' -if rustup_bin="$(command_locate rustup)" && [[ -n "$rustup_bin" ]]; then +rustup_bin="${commands[rustup]}" +if [[ -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" @@ -22,7 +23,7 @@ if rustup_bin="$(command_locate rustup)" && [[ -n "$rustup_bin" ]]; then _perf_timer_stop "generate rustup completions" fi unset rustup_comp_path -fi; unset rustup_bin +fi # compinit {{{ _perf_timer_start "compinit" @@ -145,10 +146,4 @@ 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