-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathcompletion.bash
57 lines (55 loc) · 1.25 KB
/
completion.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# bash command completion for neovim remote.
# Source that file in your bashrc to use it.
_nvr_opts_completions()
{
local cur prev opts
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts=(
-h
-cc
-c
-d
-l
-o
-O
-p
-q
-s
-t
--nostart
--version
--serverlist
--servername
--remote
--remote-wait
--remote-silent
--remote-wait-silent
--remote-tab
--remote-tab-wait
--remote-tab-silent
--remote-tab-wait-silent
--remote-send
--remote-expr
)
case "${prev}" in
--servername)
srvlist=$(nvr --serverlist)
COMPREPLY=( $(compgen -W "${srvlist}" -- "$cur") )
return 0
;;
-[oOpq])
# These options require at least one argument.
COMPREPLY=( $(compgen -A file -- "$cur") )
return 0
;;
esac
if [[ "$cur" =~ ^- ]]; then
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
else
COMPREPLY=( $(compgen -A file -- "$cur") )
fi
return 0
}
complete -o default -F _nvr_opts_completions nvr