From 1569c5dd3da4cd957d43b90794874c5e003e88e5 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Wed, 29 Jun 2022 12:57:54 +0800 Subject: [PATCH] bash: pager: prefer nvimpager, find commands with command --- .bash_profile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.bash_profile b/.bash_profile index 9d1e3a7..5310d1f 100644 --- a/.bash_profile +++ b/.bash_profile @@ -39,10 +39,14 @@ export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass export ABDUCO_SOCKET_DIR="$XDG_DATA_HOME" # application envs -[ -f /usr/bin/vimpager ] && export PAGER=vimpager +if command -v nvimpager >/dev/null; then + export PAGER=nvimpager +elif command -v vimpager >/dev/null; then + export PAGER=vimpager +fi export LESS='-S -R' export LESSHISTFILE=- -if [ -f /usr/bin/nvim ]; then +if command -v nvim >/dev/null; then export EDITOR=nvim export VIMPAGER_VIM=nvim else -- 2.45.2