From 83701dc0180ef5f6fe66b80935505dbc718c1f3b Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 27 Jun 2022 13:04:36 +0200 Subject: [PATCH] config/nvim: delegate help to info in vim --- .config/nvim/init/plug.vim | 2 ++ .local/bin/scripts/help | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.config/nvim/init/plug.vim b/.config/nvim/init/plug.vim index e81a30e..e848d9e 100644 --- a/.config/nvim/init/plug.vim +++ b/.config/nvim/init/plug.vim @@ -57,6 +57,8 @@ Plug 'austintraver/vim-jrnl' Plug 'weinshec/vim-dictcc' " TODO do not hang without internet Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } Plug 'mipmip/vim-scimark' " Edit markdown tables with sc-im +Plug 'alx741/vinfo' +Plug 'HiPhish/info.vim' call plug#end() diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help index 37d0755..dfbd267 100755 --- a/.local/bin/scripts/help +++ b/.local/bin/scripts/help @@ -11,7 +11,7 @@ case "$cmd" in # need to install zsh-doc package for info pages info $(test "$last" != zsh && echo "--index-search=$last") zsh || LESS="$LESS +/^ *$last *\\[" man zshall;; - (gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr) unbuffer "$@" --help | $paginate;; + (gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker) unbuffer "$@" --help | $paginate;; (caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit # TODO view fossil ui in terminal shift @@ -23,8 +23,12 @@ case "$cmd" in (pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions | paste -s -d' ';; (swaymsg) test $# -gt 1 && shift && man sway "$@" || man swaymsg;; (swaymsg-*) man sway "${1#swaymsg-}";; - (*) { which info >/dev/null 2>&1 && info -f "$@" 2>/dev/null; } || #"$cmd" -w | grep -q . && pinfo "$@"; } || - man "$@" || + (*) { + case $EDITOR in + (*vim) info "$@" -w | grep -q . && $EDITOR -R -M -c "Info $*" +only;; + (*) { which info >/dev/null 2>&1 && info -f "$@" 2>/dev/null; } || man "$@";; + esac + } || if which "$cmd" >/dev/null then { "$@" --help || { test $? == 1 && "$@" -help; } || { test $? == 1 && "$@" -h; }; } 2>&1 | $paginate fi;;