compsys: Ignoring matches

Prevent CVS files/directories from being completed:

zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'

Ignoring lost+found directories

zstyle ':completion:*:cd:*' ignored-patterns '(*/)#lost+found'

users completer add lots of uninteresting user accounts, remove them

zstyle ':completion:*:*:*:users' ignored-patterns \
    adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
    named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
    rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs backup  bind  \
    dictd  gnats  identd  irc  man  messagebus  postfix  proxy  sys  www-data

Or, if you know that "interesting" user accounts all fall within a certain UID range — and your system uses a local /etc/passwd file instead of something like NIS — you can do something more dynamic like this:

zstyle ':completion:*:*:*:users' ignored-patterns \                     
  $(awk -F: '$3<1000 || $3>60000 {print $1}' /etc/passwd)

Ignore completion functions

zstyle ':completion:*:functions' ignored-patterns '_*'

Ignore parent directory

Useful for cd, mv and cp. Ex, cd will never select the parent directory (ie cd ../<TAB>):

zstyle ':completion:*:(cd|mv|cp):*' ignore-parents parent pwd

Ignore what's already in the line

With commands like `rm/kill/diff' it's annoying if one gets offered the same filename again even if it is already on the command line. To avoid that:

zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes
 
examples/compsys/ignore.txt · Last modified: 2010/04/29 23:14 by brandon