Add completions to emacs-bookmark.zsh
This commit is contained in:
parent
c971f1b6e8
commit
bf92e25100
@ -86,6 +86,12 @@ function __bm_list_bookmarks {
|
||||
done
|
||||
}
|
||||
|
||||
function _bookmarks {
|
||||
for ((i = 1; i < ${#__bm_bookmark_cache}; i+=4)); do
|
||||
compadd "${__bm_bookmark_cache[${i}]}"
|
||||
done
|
||||
}
|
||||
|
||||
alias lsbm="__bm_update_bookmark_list && __bm_list_bookmarks"
|
||||
function bm {
|
||||
__bm_update_bookmark_list || \
|
||||
@ -102,6 +108,10 @@ function bm {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
function _bm {
|
||||
_arguments ':bookmark:_bookmarks'
|
||||
}
|
||||
compdef _bm bm
|
||||
|
||||
function bmadd {
|
||||
if [[ "${1}" = '-h' ]]; then
|
||||
@ -138,6 +148,10 @@ function bmadd {
|
||||
[[ "${res}" = 'nil' ]] && printf 'Added bookmark "%s"\n' "${name}" \
|
||||
|| { printf '%s\n' "${res}"; return 1 }
|
||||
}
|
||||
function _bmadd {
|
||||
_arguments ':file:_files' ':name'
|
||||
}
|
||||
compdef _bmadd bmadd
|
||||
|
||||
function bmrm {
|
||||
if [[ "${1}" = '-h' ]]; then
|
||||
@ -164,3 +178,9 @@ function bmrm {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
function _bmrm {
|
||||
_arguments ':bookmark:_bookmarks'
|
||||
}
|
||||
compdef _bmrm bmrm
|
||||
|
||||
__bm_update_bookmark_list
|
||||
|
Loading…
Reference in New Issue
Block a user