zshrc.d/15-completion.zrc
author Mikael Berthe <mikael@lilotux.net>
Mon, 02 Mar 2020 13:16:10 +0100
changeset 44 157f894ef9f7
parent 35 c6d405e0684b
permissions -rw-r--r--
Add some quotes and double brackets...
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
44
157f894ef9f7 Add some quotes and double brackets...
Mikael Berthe <mikael@lilotux.net>
parents: 35
diff changeset
    21
if [[ -f ~/.ssh/config ]]; then
13
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
44
157f894ef9f7 Add some quotes and double brackets...
Mikael Berthe <mikael@lilotux.net>
parents: 35
diff changeset
    24
if [[ "$hosts" ]]; then
13
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
35
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    41
# From Debian' system zshrc
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    42
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    43
                                           /usr/local/bin  \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    44
                                           /usr/sbin       \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    45
                                           /usr/bin        \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    46
                                           /sbin           \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    47
                                           /bin            \
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    48
                                           /usr/X11R6/bin
c6d405e0684b Add zstyle for sudo completion
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    49
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    50
autoload -Uz compinit
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    51
compinit
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    52
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    53
# Needed for menuselect below
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    54
zmodload zsh/complist
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    55
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    56
autoload -U incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    57
zle -N incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    58
bindkey 'i' incremental-complete-word
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    59
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    60
bindkey -M menuselect '' accept-and-infer-next-history