diff --git a/.config/zsh/zshrc.d/20-completion.zsh b/.config/zsh/zshrc.d/20-completion.zsh index adf4565..e59839e 100644 --- a/.config/zsh/zshrc.d/20-completion.zsh +++ b/.config/zsh/zshrc.d/20-completion.zsh @@ -31,8 +31,9 @@ _comp_options+=(globdots) # Taken from http://leahneukirchen.org/dotfiles/.zshrc 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 nvim-man=man # Do not sort `git checkout`s completion zstyle ":completion:*:git-checkout:*" sort false diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index 02f0224..093ccf4 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -56,12 +56,11 @@ alias bin='xxd -b -c4 | cut -d" " -f2-5' if (( $+commands[nvim] )); then alias vim='jobs | grep -q nvim && {fg;:;} || nvim' - # $MANPAGER does the trick too but lines are hard-wrapped. - alias man='() { nvim +"Man $* | only" }' fi alias v='vim' alias vi='vim' alias vimdiff='vim --cmd "set list" -c "set listchars=tab:>·,space:·" -d' + alias man='nvim-man' alias resetCursor='echo -ne "\e[5 q"' alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"' # grep filenames and date entries in exiftool diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 152c060..d84aeed 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -363,3 +363,12 @@ git-commit-last-msg() { gitdir="$(git rev-parse --git-dir)" || return 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 +}