zshrc.d/15-completion.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 15 Jul 2012 15:57:45 +0200
changeset 13 e1da4a7a9e92
child 35 c6d405e0684b
permissions -rw-r--r--
More modularization
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
compctl -g '.*(-/) *(-/)' cd pushd
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
compctl -g '.*(-/) *(-/)' rmdir
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
compctl -g '*.Z *.z *.gz *.tgz *(-/)' zcat gunzip
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
compctl -g '*.Z *.z *.gz *.tgz *.tar *.bz2 *(-/)' tart tarx tar
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
compctl -g '*.bz2 *(-/)' bz2cat bunzip2
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
compctl -g '*.zip *.ZIP *.exe *.EXE *(-/)' unzip
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
compctl -g '*.ps *.ps.gz *(-/)' gs ghostview gv evince
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
compctl -g '*.tex* *.latex* *(-/)' tex latex texi2dvi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
compctl -g '*.dvi *(-/)' xdvi dvips
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
compctl -j -P % -x 's[-] p[1]' -k signals -- kill
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
compctl -l '' nohup exec
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
compctl -u -x 's[@]' -k hosts -- finger
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
compctl -m info
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
compctl -m -g '*.1 *(-/)' man
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
compctl -c which where type
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
compctl -g '*.pdf *(-/)' evince
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
# Hosts completion
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
if [ -f ~/.ssh/config ]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
  hosts=($hosts `grep ^Host ~/.ssh/config | sed s/Host\ // | egrep -v '^\*$'`)
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
fi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
if [ "$hosts" ]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    25
  zstyle ':completion:*:hosts' hosts $hosts
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
fi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    27
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    29
zstyle ':completion:*' completer _expand _complete _correct _approximate
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    30
zstyle ':completion:*' completions 1
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    31
zstyle ':completion:*' format 'Completing %B%d%b%:'
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    32
zstyle ':completion:*' glob 1
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    33
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    34
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    35
zstyle ':completion:*' max-errors 2 numeric
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    36
zstyle ':completion:*' menu select=3
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    37
zstyle ':completion:*' prompt '%e erreur(s)...'
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    38
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    39
zstyle ':completion:*' substitute 1
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    40
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    41
autoload -Uz compinit
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    42
compinit
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    43
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    44
# Needed for menuselect below
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    45
zmodload zsh/complist
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    46
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    47
autoload -U incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    48
zle -N incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    49
bindkey 'i' incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    50
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    51
bindkey -M menuselect '' accept-and-infer-next-history