zsh: Move man wrapper into function for completion

This commit is contained in:
2021-01-04 16:34:16 +01:00
parent 4d4a5d4ef2
commit d0cd6ffef0
3 changed files with 12 additions and 3 deletions

View File

@@ -31,8 +31,9 @@ _comp_options+=(globdots)
# Taken from http://leahneukirchen.org/dotfiles/.zshrc # Taken from http://leahneukirchen.org/dotfiles/.zshrc
zstyle ':completion:*:(diff|meld|trash):*' ignore-line yes zstyle ':completion:*:(diff|meld|trash):*' ignore-line yes
# Use completion of `ls` for `ls-show-hidden` # Use completion of commands for their wrapper functions
compdef ls-show-hidden=ls compdef ls-show-hidden=ls
compdef nvim-man=man
# Do not sort `git checkout`s completion # Do not sort `git checkout`s completion
zstyle ":completion:*:git-checkout:*" sort false zstyle ":completion:*:git-checkout:*" sort false

View File

@@ -56,12 +56,11 @@
alias bin='xxd -b -c4 | cut -d" " -f2-5' alias bin='xxd -b -c4 | cut -d" " -f2-5'
if (( $+commands[nvim] )); then if (( $+commands[nvim] )); then
alias vim='jobs | grep -q nvim && {fg;:;} || nvim' alias vim='jobs | grep -q nvim && {fg;:;} || nvim'
# $MANPAGER does the trick too but lines are hard-wrapped.
alias man='() { nvim +"Man $* | only" }'
fi fi
alias v='vim' alias v='vim'
alias vi='vim' alias vi='vim'
alias vimdiff='vim --cmd "set list" -c "set listchars=tab:>·,space:·" -d' alias vimdiff='vim --cmd "set list" -c "set listchars=tab:>·,space:·" -d'
alias man='nvim-man'
alias resetCursor='echo -ne "\e[5 q"' alias resetCursor='echo -ne "\e[5 q"'
alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"' alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"'
# grep filenames and date entries in exiftool # grep filenames and date entries in exiftool

View File

@@ -363,3 +363,12 @@ git-commit-last-msg() {
gitdir="$(git rev-parse --git-dir)" || return gitdir="$(git rev-parse --git-dir)" || return
git commit -eF <(sed -n '/^#/q;p' "$gitdir/COMMIT_EDITMSG") git commit -eF <(sed -n '/^#/q;p' "$gitdir/COMMIT_EDITMSG")
} }
nvim-man() {
if (( $+commands[nvim] )); then
# $MANPAGER does the trick too but lines are hard-wrapped.
nvim +"Man $* | only"
else
command man "$@"
fi
}