From eb160de09bdaefbfee12d913e5fe5d9af7e26f92 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Sun, 9 Oct 2022 05:52:19 +0200 Subject: [PATCH] zsh: Remove nvim-man and use neovim as MANPAGER `:Man` wraps to the window width if `$MANWIDTH` is not set, making `nvim-man` as man wrapper obsolete. --- .config/zsh/.zprofile | 4 ++++ .config/zsh/zshrc.d/30-alias.zsh | 2 -- .config/zsh/zshrc.d/40-functions.zsh | 14 -------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 88923d6..7fe338b 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -90,6 +90,10 @@ LESS+="${LESS:+ }--RAW-CONTROL-CHARS" LESS+="${LESS:+ }--quit-if-one-screen" export LESS +# Use neovim's man plugin as manpager +(( ! $+commands[nvim] )) || \ + export MANPAGER='nvim +"Man! | set scrolloff=999 | normal M"' + # NOTE: This is used in keys.zsh for the ALT_C widget fzf_default_no_rg="find -L . -mindepth 1 \(" fzf_default_no_rg+=" -name '.git' -o" diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index 05dc60a..f2e2413 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -174,7 +174,5 @@ fi alias vi='vim' ! is_exec vi || alias v='vi' - (( ! $+commands[man] )) || - alias man='nvim-man' unfunction add_flags is_exec diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index e5e926b..1fc93c7 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -393,20 +393,6 @@ cd() { fi } -nvim-man() { - # Use nvim only if it exists, there was just one argument passed, that - # argument is not an option (e.g. `--version`) and stdout is a terminal. - if (( $+commands[nvim] && $# == 1 )) && [[ $1 == ${1#-} && -t 1 ]]; then - # Check for existence of man page. - command man -w "$1" >/dev/null || return - - # $MANPAGER would do the trick too but lines would be hard-wrapped. - nvim +"Man $1 | only | set scrolloff=999 | normal M" - else - command man "$@" - fi -} - # This is meant for adding a quick fix to a commit. # It automatically rebases a given commit (defaults to HEAD), applies the given # stash (defaults to last) and finishes the rebase.