Some custom completion stuff

This commit is contained in:
root 2018-01-22 13:09:53 +01:00 committed by crater2150
parent 3b2eb6cd5b
commit 01d19b1b52
4 changed files with 32 additions and 22 deletions

View file

@ -44,7 +44,7 @@ alias E="exec zsh"
# edit and refresh aliases
aliases() {
sudo vim /etc/zsh/aliases/${1:-functions}
sudoedit /etc/zsh/aliases/${1:-functions}
. /etc/zsh/aliases/*
}

3
compdef/_re Normal file
View file

@ -0,0 +1,3 @@
#compdef re
_arguments -A "*" '-d[directory]:dirname:_dirs' ":script:_files -W $XDG_CONFIG_HOME/re/"

25
completion.zsh Normal file
View file

@ -0,0 +1,25 @@
# autoload completions
fpath+=( "${ZDOTDIR:+ZDOTDIR}/compdef" )
fpath+=( "/etc/zsh/compdef" )
autoload -U /etc/zsh/compdef/*(:t)
if [[ -d $ZDOTDIR/compdef ]]; then
autoload -U /etc/zsh/compdef/*(N:t)
fi
autoload -Uz compinit && compinit
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format %B%d%b
zstyle ':completion:*:messages' format %d
zstyle ':completion:*:warnings' format No matches for: %d
# completion for programs with standard gnu --help
for prog in amm tapestry; do
compdef _gnu_generic $prog
done
# custom compdefs
compdef _xbps xi=xbps-install

24
zshrc
View file

@ -1,4 +1,3 @@
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
@ -15,15 +14,6 @@ setopt chase_links
setopt short_loops
setopt cdable_vars
# autoload completions
fpath+=( "${ZDOTDIR:+ZDOTDIR}/compdef" )
fpath+=( "/etc/zsh/compdef" )
autoload -U /etc/zsh/compdef/*(:t)
if [[ -d $ZDOTDIR/compdef ]]; then
autoload -U /etc/zsh/compdef/*(N:t)
fi
# get a file from ZDOTDIR, return file in /etc/zsh if it does not exist
zdotfile() {
if [[ -e $ZDOTDIR/$1 ]]; then
@ -34,14 +24,9 @@ zdotfile() {
}
bindkey -v
autoload -Uz compinit && compinit
autoload -Uz zmv
function exists { command -v "$@" >/dev/null }
ZMODLOAD_BLACKLIST=( ssh-agent )
stty -ixon
@ -56,12 +41,6 @@ echo $PATH | grep -q 'local' || . /etc/zsh/zprofile
echo $PATH | grep -q 'sbin' || . /etc/zsh/zprofile
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format %B%d%b
zstyle ':completion:*:messages' format %d
zstyle ':completion:*:warnings' format No matches for: %d
typeset -A conf_locations
conf_locations=(
vim $XDG_CONFIG_HOME/vim
@ -76,4 +55,7 @@ conf_locations=(
ssh $HOME/.ssh/config
)
. $(zdotfile completion.zsh)
exists todo && todo