]> arthur.barton.de Git - ax-zsh.git/blob - core/40_completion/40_completion.zshrc
ls: Add support for "lscolors.sh"
[ax-zsh.git] / core / 40_completion / 40_completion.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # 50_completion.zshrc: Setup completion
3
4 autoload -Uz compinit
5
6 zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
7
8 zstyle ':completion:*' accept-exact '*(N)'
9 zstyle ':completion:*' list-colors ''
10 zstyle ':completion:*' menu select
11 zstyle ':completion:*' special-dirs true
12 zstyle ':completion:*' group-name ''
13 zstyle ':completion:*' squeeze-slashes true
14
15 # Messages
16 zstyle ':completion:*:corrections' format '%B%d%b (%e errors)'
17 zstyle ':completion:*:descriptions' format '%B%d%b'
18 zstyle ':completion:*:messages' format '%B%F{yellow}%d%f%b'
19 zstyle ':completion:*:warnings' format '%B%F{red}No matches found!%f%b'
20
21 # Use caching so that commands like apt and dpkg completions are useable
22 zstyle ':completion:*' use-cache on
23 zstyle ':completion:*' cache-path "$ZSH_CACHE_DIR"
24
25 # Manual pages
26 zstyle ':completion:*:manuals' separate-sections true
27 zstyle ':completion:*:manuals.*' insert-sections true
28
29 # Don't complete uninteresting users
30 zstyle ':completion:*:*:*:users' ignored-patterns \
31         adm amanda amavis apache arpwatch at avahi avahi-autoipd backup \
32         beaglidx bin bind cacti canna clamav cockpit-ws cockpit-wsinstance \
33         colord daapd daemon dbus distcache dnsmasq dovecot dovenull fax \
34         fetchmail firebird ftp games gdm gkrellmd gnats gopher hacluster \
35         haldaemon halt hsqldb ident irc junkbust kdm ldap libuuid libvirt-qemu \
36         list logcheck lp mail mailman mailnull man messagebus mldonkey mysql \
37         nagios named netdata netdump news nfsnobody nobody nscd ntp nut nx \
38         obsrun oident openvpn operator pcap polkitd postfix postgres postgrey \
39         privoxy proxy pvm quagga radvd rpc rpcuser rpm rslsync rtkit rwhod \
40         sbuild scard shutdown squid sshd statd stunnel4 svn sync sys \
41         systemd-coredump systemd-journal-remote systemd-network systemd-resolve \
42         systemd-timesync telnetd telnetd-ssl tftp thelounge usbmux uucp uuidd \
43         vcsa www-data wwwrun xfs xrdp zabbix  \
44         '_*' '*$' 'debian-*' 'Debian-*'
45
46 # Ignore completion functions
47 zstyle ':completion:*:functions' ignored-patterns '_*'
48
49 # Show ignore matches, if we really want this
50 zstyle '*' single-ignored show
51
52 # Save the location of the current completion dump file.
53 if [[ -z "$ZSH_COMPDUMP" ]]; then
54         ZSH_COMPDUMP="$ZSH_CACHE_DIR/zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
55 fi
56
57 # Try to add all folders possibly containing completion functions to the fpath
58 # before calling compinit. See <https://github.com/ohmyzsh/ohmyzsh/issues/4614>
59 # for a discussion of this topic, for example. It boils down to:
60 # - We have to call compinit early,
61 # - but plugins can add completions later, that won't be found ...
62 # (GENCOMPL_FPATH is used by RobSis/zsh-completion-generator)
63 [[ -n "$GENCOMPL_FPATH" ]] && fpath+=($GENCOMPL_FPATH)
64 fpath+=("$AXZSH/active_plugins/"*/completions(N))
65 fpath+=("$AXZSH/active_plugins/"*/src(N))
66
67 # Initialize ZSH completion system
68 if [[ "$ZSH_DISABLE_COMPFIX" = "true" ]]; then
69         compinit -u -d "$ZSH_COMPDUMP"
70 else
71         compinit -d "$ZSH_COMPDUMP"
72 fi