2019-03-01 15:59:17 -08:00
|
|
|
#compdef fedit
|
|
|
|
# Fuzzy find a file and then edit it
|
|
|
|
|
|
|
|
# ========== Shortcuts ==========
|
|
|
|
_fedit() {
|
|
|
|
/usr/bin/fedit
|
2019-03-01 16:28:05 -08:00
|
|
|
zle reset-prompt
|
2019-03-01 15:59:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
_etcedit() {
|
|
|
|
/usr/bin/fedit --etc
|
2019-03-01 16:28:05 -08:00
|
|
|
zle reset-prompt
|
2019-03-01 15:59:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|