dotfiles/zsh/plugins.zsh

52 lines
2 KiB
Bash
Raw Normal View History

2021-06-23 17:17:04 +00:00
#!/usr/bin/env zsh
_plugin() {
2023-02-08 11:32:43 +00:00
[ -z "$DOTFILES_LOAD_SILENT" ] && _perf_timer_start "plugin $1"
2021-06-23 17:17:04 +00:00
plugin "$@"
2023-02-08 11:32:43 +00:00
[ -z "$DOTFILES_LOAD_SILENT" ] && _perf_timer_stop "plugin $1"
2021-06-23 17:17:04 +00:00
}
# based off of Dima's completion generation code, but made dynamic
# https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25
_addcomp() {
local command_name="$1"
local command_args="${2:-completion zsh}"
declare ${command_name}_bin="$(command_locate $command_name)"
local command_bin="${(P)${:-${command_name}_bin}}"
if [[ -n "${command_bin}" ]]; then
declare ${command_name}_comp_path="${ZSH_CACHE_DIR}/site-functions/_${command_name}"
local comp_path="${(P)${:-${command_name}_comp_path}}"
if [[ "$command_bin" -nt "$comp_path" || ! -s "$comp_path" ]]; then
_perf_timer_start "generate $command_name completions"
eval "$command_bin" "$command_args" >| "$comp_path"
_perf_timer_stop "generate $command_name completions"
fi
fi; unset comp_path
}
2021-06-23 17:17:04 +00:00
_plugin gitio 'denysdovhan/gitio-zsh'
2021-06-28 16:24:10 +00:00
# Load the brilliant project management tool.
2021-06-27 15:31:14 +00:00
_plugin project 'https://git.sr.ht/~keanucode/scripts/blob/master/project/project.zsh' from=url \
build="wget -O listbox.zsh https://raw.githubusercontent.com/gko/listbox/master/listbox.zsh" \
load="listbox.zsh" \
load="project.zsh" \
2021-06-28 16:24:10 +00:00
# Completions {{{
_addcomp gh "completion -s zsh"
_addcomp bw "completion --shell zsh"
_addcomp kubectl
2023-06-05 07:48:10 +00:00
2021-06-28 16:24:10 +00:00
_plugin nim-compl 'https://raw.githubusercontent.com/nim-lang/Nim/devel/tools/nim.zsh-completion' from=url \
after_load='plugin-cfg-path fpath prepend ""'
_plugin keybase-compl 'https://raw.githubusercontent.com/fnoris/keybase-zsh-completion/master/_keybase' from=url \
after_load='plugin-cfg-path fpath prepend ""'
2023-07-02 08:19:07 +00:00
if command_exists pnpm-shell-completion; then
_plugin pnpm-compl "https://raw.githubusercontent.com/g-plane/pnpm-shell-completion/main/pnpm-shell-completion.plugin.zsh" from=url \
after_load='plugin-cfg-path fpath prepend ""'
fi
2021-06-28 16:24:10 +00:00
# }}}