zsh:funcs:nvim-man: Check if stdout is terminal
If `stdout` is not a terminal, `command man` should be used as `nvim` won't work.
This commit is contained in:
@@ -397,9 +397,9 @@ git-commit-last-msg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvim-man() {
|
nvim-man() {
|
||||||
# Use nvim only if it exists, there was just one argument passed and that
|
# Use nvim only if it exists, there was just one argument passed, that
|
||||||
# argument is not an option (e.g. `--version`)
|
# argument is not an option (e.g. `--version`) and stdout is a terminal.
|
||||||
if (( $+commands[nvim] && $# == 1 && $1 == ${1#-} )); then
|
if (( $+commands[nvim] && $# == 1 && $1 == ${1#-} )) && [[ -t 1 ]]; then
|
||||||
# Check for existence of man page.
|
# Check for existence of man page.
|
||||||
command man -w "$1" >/dev/null || return
|
command man -w "$1" >/dev/null || return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user