mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] add stuff from my local zshrc's
This commit is contained in:
parent
85ef26db77
commit
19d8023326
3 changed files with 32 additions and 4 deletions
|
@ -114,3 +114,11 @@ fi
|
||||||
|
|
||||||
alias bytefmt2="numfmt --to=iec-i --suffix=B"
|
alias bytefmt2="numfmt --to=iec-i --suffix=B"
|
||||||
alias bytefmt10="numfmt --to=si --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
|
||||||
|
|
|
@ -20,7 +20,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() {
|
lazy_load() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
|
@ -125,3 +129,14 @@ sync_working_dir_load() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
alias cds="sync_working_dir_load"
|
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"
|
||||||
|
}
|
||||||
|
|
|
@ -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 \
|
_plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \
|
||||||
after_load='plugin-cfg-path fpath prepend ""'
|
after_load='plugin-cfg-path fpath prepend ""'
|
||||||
|
|
||||||
rustup_bin="${commands[rustup]}"
|
if rustup_bin="$(command_locate rustup)" && [[ -n "$rustup_bin" ]]; then
|
||||||
if [[ -n "$rustup_bin" ]]; then
|
|
||||||
rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup"
|
rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup"
|
||||||
if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then
|
if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then
|
||||||
_perf_timer_start "generate rustup completions"
|
_perf_timer_start "generate rustup completions"
|
||||||
|
@ -23,7 +22,7 @@ if [[ -n "$rustup_bin" ]]; then
|
||||||
_perf_timer_stop "generate rustup completions"
|
_perf_timer_stop "generate rustup completions"
|
||||||
fi
|
fi
|
||||||
unset rustup_comp_path
|
unset rustup_comp_path
|
||||||
fi
|
fi; unset rustup_bin
|
||||||
|
|
||||||
# compinit {{{
|
# compinit {{{
|
||||||
_perf_timer_start "compinit"
|
_perf_timer_start "compinit"
|
||||||
|
@ -137,4 +136,10 @@ if [[ "$TERM" != "linux" ]]; then
|
||||||
fi
|
fi
|
||||||
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
|
unset _checkout_latest_version
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue