-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_completion
110 lines (102 loc) · 4.85 KB
/
.bash_completion
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# bash completions
# 1) find command name from comspec list (first full path, then basename)
# 2) generate list if found, otherwise do default
# 2a) perform actions, filter prefixes (-f, -d: use $FIGNORE)
# 2b) generate -G filename expansion pattern matches (do not use $GLOBIGNORE, use $FIGNORE)
# 2c) prefix match on -W (use $IFS, expand words)
# 2d) shell function -F, command -C ($COMP_LINE, $COMP_POINT, -F: $COMP_WORDS, $COMP_CWORD)
# 1st arg: name of the command, 2nd arg: word preceding the word being completed
# NO FILTERING!
# 2d1) -F: completions in $COMPREPLY array
# 2d2) -C: completions stdout, one per line
# 2e) filter with -X (& = word being completed, ! negates the pattern)
# 2f) -P, -S: add prefix/suffix to each completion
# 2g) use -o
# -o comp-option
# The comp-option controls several aspects of the compspec's behavior
# beyond the simple generation of completions. comp-option may be one
# of:
# default Use readline's default filename completion if the compspec
# generates no matches.
# dirnames
# Perform directory name completion if the compspec generates no
# matches.
# filenames
# Tell readline that the compspec generates filenames, so it can
# perform any filename-specific processing (like adding a slash
# to directory names or suppressing trailing spaces). Intended
# to be used with shell functions.
# nospace Tell readline not to append a space (the default) to words
# completed at the end of the line.
# -A action
# The action may be one of the following to generate a list of possible
# completions:
# alias Alias names. May also be specified as -a.
# arrayvar
# Array variable names.
# binding Readline key binding names.
# builtin Names of shell builtin commands. May also be specified as -b.
# command Command names. May also be specified as -c.
# directory
# Directory names. May also be specified as -d.
# disabled
# Names of disabled shell builtins.
# enabled Names of enabled shell builtins.
# export Names of exported shell variables. May also be specified as
# -e.
# file File names. May also be specified as -f.
# function
# Names of shell functions.
# group Group names. May also be specified as -g.
# helptopic
# Help topics as accepted by the help builtin.
# hostname
# Hostnames, as taken from the file specified by the HOSTFILE
# shell variable.
# job Job names, if job control is active. May also be specified as
# -j.
# keyword Shell reserved words. May also be specified as -k.
# running Names of running jobs, if job control is active.
# service Service names. May also be specified as -s.
# setopt Valid arguments for the -o option to the set builtin.
# shopt Shell option names as accepted by the shopt builtin.
# signal Signal names.
# stopped Names of stopped jobs, if job control is active.
# user User names. May also be specified as -u.
# variable
# Names of all shell variables. May also be specified as -v.
complete -r
# general stuff
complete -u adduser deluser
[ "$BASH_VERSION" \> "2.05a" ] && complete -g -u adduser deluser
complete -u id
complete -o default -d -X '@(*/CVS|CVS)' cd rd
complete -o default -A running disown
complete -o default -c fakeroot help ltrace strace sudo tsocks type xargs
complete -v unset vared
# generic filetype rules
complete -o default -f -X '*.@(a|bc|o|pdf|so)' vi vim
complete -o default -f -X '!*.pdf' evince xpdf
complete -o default -f -X '!*.deb' dpkg-deb
complete -o default -f -X '!*.dsc' dpkg-source
complete -o default -f -X '!*.@(deb|dsc)' debdiff
complete -o default -f -X '!*.@(changes|dsc)' dscverify
complete -o default -f -X '!*.changes' debsign dput debrsign lintian
complete -o default -f -X '!*.?(e)ps*(.gz)' gv
complete -o default -f -X '!*.tex' latex
complete -o default -f -X '!*.diff*(.gz)' lsdiff interdiff
complete -o default -f -X '!*.?(e)ps' lpr
complete -o default -f -X '!*.dvi' kdvi xdvi
complete -o default -f -X '!*.fig' xfig
complete -o default -f -X '!*.@(tar|tar.gz|tgz|tar.bz2|ace|ar|deb|arj|lzh|rar|xar|zip|7z)' ttar xtar
# stuff that uses my completer
complete -o default -C completer man sc scu start stop status reload restart enable disable
complete -o default -C completer cp mv
complete -o default -X '!&*' -C completer bibtex make mosh ncftp ssh super
complete -X '!&*' -C completer complete mailsync
# special rules
complete -C completer agi agr
complete -W "install remove" -C completer apt-get
complete -o default -d -X '!&*' -C completer cvs
complete -o default -f -d -X '!&*' -C completer scp rsync
#complete -o default -f -W Makefile vim