From 13257f07e6f3ac0607fc2b4aa840e395a797103a Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Fri, 1 Mar 2019 15:59:17 -0800 Subject: [PATCH] Use site-functions directory for all zsh plugins --- zsh/{completions => }/_cptemplate | 3 +-- zsh/{completions => }/_ddusb | 0 zsh/{completions => }/_dlaudio | 1 - zsh/_fedit | 32 +++++++++++++++++++++++++++++ zsh/{plugins.d/fless.zsh => _fless} | 4 +++- zsh/{plugins.d/cf.zsh => _fuzzy_cd} | 17 +++++++++++++-- zsh/{plugins.d/mkcd.zsh => _mkcd} | 2 ++ zsh/{completions => }/_open | 3 +-- zsh/{completions => }/_quickdel | 3 +-- zsh/plugins.d/fedit.zsh | 14 ------------- 10 files changed, 55 insertions(+), 24 deletions(-) rename zsh/{completions => }/_cptemplate (54%) rename zsh/{completions => }/_ddusb (100%) rename zsh/{completions => }/_dlaudio (81%) create mode 100644 zsh/_fedit rename zsh/{plugins.d/fless.zsh => _fless} (59%) rename zsh/{plugins.d/cf.zsh => _fuzzy_cd} (64%) rename zsh/{plugins.d/mkcd.zsh => _mkcd} (75%) rename zsh/{completions => }/_open (61%) rename zsh/{completions => }/_quickdel (72%) delete mode 100644 zsh/plugins.d/fedit.zsh diff --git a/zsh/completions/_cptemplate b/zsh/_cptemplate similarity index 54% rename from zsh/completions/_cptemplate rename to zsh/_cptemplate index efa7071..cddf30f 100644 --- a/zsh/completions/_cptemplate +++ b/zsh/_cptemplate @@ -1,7 +1,6 @@ #compdef cptemplate -# zsh completions for 'cptemplate' -# automatically generated with http://github.com/RobSis/zsh-completion-generator +# ========== Completions ========== local arguments arguments=( diff --git a/zsh/completions/_ddusb b/zsh/_ddusb similarity index 100% rename from zsh/completions/_ddusb rename to zsh/_ddusb diff --git a/zsh/completions/_dlaudio b/zsh/_dlaudio similarity index 81% rename from zsh/completions/_dlaudio rename to zsh/_dlaudio index 71ed5d1..959dbd9 100644 --- a/zsh/completions/_dlaudio +++ b/zsh/_dlaudio @@ -1,7 +1,6 @@ #compdef dlaudio # zsh completions for 'dlaudio' -# automatically generated with http://github.com/RobSis/zsh-completion-generator local arguments arguments=( diff --git a/zsh/_fedit b/zsh/_fedit new file mode 100644 index 0000000..a38efb3 --- /dev/null +++ b/zsh/_fedit @@ -0,0 +1,32 @@ +#compdef fedit +# Fuzzy find a file and then edit it + +# ========== Shortcuts ========== +_fedit() { + /usr/bin/fedit +} + +_etcedit() { + /usr/bin/fedit --etc +} + +zle -N fedit +bindkey -M viins '^o' _fedit + +zle -N _etcedit +bindkey -M viins '^e' _etcedit + +# ========== Completions ========== +local arguments + +arguments=( +$argument_list + {-h, --help}'[show this help message and exit]' + {-b, --boot}'[edit a file in /boot]' + {-d, --dir}'[edit a file in a given directory]' + {-E, --etc}'[edit a file in /etc]' + {-e, --editor}'[use a given editor]' + '*:filename:_files' +) + +_arguments -s $arguments diff --git a/zsh/plugins.d/fless.zsh b/zsh/_fless similarity index 59% rename from zsh/plugins.d/fless.zsh rename to zsh/_fless index fc2dace..4a80eb3 100644 --- a/zsh/plugins.d/fless.zsh +++ b/zsh/_fless @@ -1,4 +1,6 @@ -# key bindings for fless script +#compdef fless + +# ========== Shortcuts ========== fless() { /usr/bin/fless } diff --git a/zsh/plugins.d/cf.zsh b/zsh/_fuzzy_cd similarity index 64% rename from zsh/plugins.d/cf.zsh rename to zsh/_fuzzy_cd index ee57642..01e6257 100644 --- a/zsh/plugins.d/cf.zsh +++ b/zsh/_fuzzy_cd @@ -1,7 +1,10 @@ +#compdef fcd # Fuzzy cd from anywhere # Dependencies -# - fzf -# - mlocate +# * fzf +# * mlocate + +# ========== Shortcuts ========== cf() { [[ -z "${*}" ]] && return 1 [[ ! -x /usr/bin/fzf ]] && return 1 @@ -18,3 +21,13 @@ cf() { } autoload -Uz cf + +# ========== Completions ========== +local arguments + +arguments=( +$argument_list + '*:filename:_files' +) + +_arguments -s $arguments diff --git a/zsh/plugins.d/mkcd.zsh b/zsh/_mkcd similarity index 75% rename from zsh/plugins.d/mkcd.zsh rename to zsh/_mkcd index a3896a0..06dae18 100644 --- a/zsh/plugins.d/mkcd.zsh +++ b/zsh/_mkcd @@ -1,5 +1,7 @@ +#compdef mkcd # Make a directory, then change into it +# ========== Shortcuts ========== mkcd() { [[ ! -d "${1}" ]] && mkdir --parents -- "${1}" cd "${1}" || exit diff --git a/zsh/completions/_open b/zsh/_open similarity index 61% rename from zsh/completions/_open rename to zsh/_open index 593bce5..d344deb 100644 --- a/zsh/completions/_open +++ b/zsh/_open @@ -1,7 +1,6 @@ #compdef open -# zsh completions for 'open' -# automatically generated with http://github.com/RobSis/zsh-completion-generator +# ========== Completions ========== local arguments arguments=( diff --git a/zsh/completions/_quickdel b/zsh/_quickdel similarity index 72% rename from zsh/completions/_quickdel rename to zsh/_quickdel index 7b2af90..96222b2 100644 --- a/zsh/completions/_quickdel +++ b/zsh/_quickdel @@ -1,7 +1,6 @@ #compdef quickdel -# zsh completions for 'quickdel' -# automatically generated with http://github.com/RobSis/zsh-completion-generator +# ========== Completions ========== local arguments arguments=( diff --git a/zsh/plugins.d/fedit.zsh b/zsh/plugins.d/fedit.zsh deleted file mode 100644 index 9e0964c..0000000 --- a/zsh/plugins.d/fedit.zsh +++ /dev/null @@ -1,14 +0,0 @@ -# call the fedit script -_fedit() { - /usr/bin/fedit -} - -_etcedit() { - /usr/bin/fedit -E -} - -zle -N fedit -bindkey -M viins '^o' _fedit - -zle -N _etcedit -bindkey -M viins '^e' _etcedit