mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
Add example on how to implement branch name completion for hg update/hg merge
@@ -66,3 +66,24 @@ _fzf_complete_pass() {
|
||||
|
||||
[ -n "$BASH" ] && complete -F _fzf_complete_pass -o default -o bashdefault pass
|
||||
```
|
||||
|
||||
### Complete hg update/hg merge
|
||||
|
||||
If you need to add branch name completion for a subset of hg commands, e.g. hg up, hg merge, you can use technique as follows (zsh completion):
|
||||
|
||||
```sh
|
||||
_fzf_complete_hg() {
|
||||
ARGS="$@"
|
||||
if [[ $ARGS == 'hg merge'* ]] || [[ $ARGS == 'hg up'* ]]; then
|
||||
_fzf_complete "--no-sort" "$@" < <(
|
||||
{ hg branches & hg tags }
|
||||
)
|
||||
else
|
||||
eval "zle ${fzf_default_completion:-expand-or-complete}"
|
||||
fi
|
||||
}
|
||||
|
||||
_fzf_complete_hg_post() {
|
||||
cut -f1 -d' '
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user