From 42447ac27614bd8278a810c0546879da0f5b1ae8 Mon Sep 17 00:00:00 2001 From: Byron Torres Date: Wed, 15 Jun 2022 03:12:03 +0100 Subject: new gK mapping, u & d scrolling, improved docs --- doc/haredoc.txt | 22 +++++++++++++++++----- doc/tags | 2 ++ ftplugin/hare.vim | 3 ++- plugin/haredoc.vim | 11 ++++++----- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/doc/haredoc.txt b/doc/haredoc.txt index f33a755..c2e6f60 100644 --- a/doc/haredoc.txt +++ b/doc/haredoc.txt @@ -1,4 +1,4 @@ -*haredoc.txt* *haredoc* haredoc in vim +*haredoc.txt* *haredoc* -- documentation for the Hare programming language This plugin integrates the haredoc command of the Hare programming language, which looks up and displays documentation for Hare symbols/identifiers in your @@ -19,19 +19,31 @@ MAPPINGS *K* *haredoc-K* K Show documentation for the Hare symbol under the - cursor in a |popup-window|. Press q or CTRL-C to - close. + cursor in a |popup-window|. + Press d and u to scroll largs outputs. + Press q or CTRL-C to close. + *gK* *haredoc-gK* +gK Show documentation for the Hare symbol under the + cursor in a |terminal-window|. + Press d and u to scroll largs outputs. + Press q or CTRL-C once or twice to close. + COMMANDS *:Haredoc* :Haredoc {symbol} Show documentation for the given Hare symbol in a - |terminal-window|. Press q or CTRL-C once or twice to - close. + |terminal-window|. + Press d and u to scroll largs outputs. + Press q or CTRL-C once or twice to close. :Haredoc . Same as the |K| command. +:Haredoc , Same as the |gK| command. + + + LICENSE diff --git a/doc/tags b/doc/tags index bac0b1a..4b108e0 100644 --- a/doc/tags +++ b/doc/tags @@ -1,5 +1,7 @@ :Haredoc haredoc.txt /*:Haredoc* K haredoc.txt /*K* +gK haredoc.txt /*gK* haredoc haredoc.txt /*haredoc* haredoc-K haredoc.txt /*haredoc-K* +haredoc-gK haredoc.txt /*haredoc-gK* haredoc.txt haredoc.txt /*haredoc.txt* diff --git a/ftplugin/hare.vim b/ftplugin/hare.vim index 2d31f90..944ee0a 100644 --- a/ftplugin/hare.vim +++ b/ftplugin/hare.vim @@ -5,4 +5,5 @@ setlocal keywordprg=haredoc -nnoremap K :call Haredoc('.') +nnoremap K :call Haredoc('.') +nnoremap gK :call Haredoc(',') diff --git a/plugin/haredoc.vim b/plugin/haredoc.vim index 65171fa..d7ff721 100644 --- a/plugin/haredoc.vim +++ b/plugin/haredoc.vim @@ -7,15 +7,14 @@ command -nargs=? Haredoc :call Haredoc() function Haredoc(symbol) let symbol = a:symbol - let popup = 0 - if symbol == '.' - let popup = 1 + let popup = symbol == '.' ? 1 : 0 + if (symbol == '.' || symbol == ',') let oldiskeyword = &iskeyword setlocal iskeyword+=: let symbol = expand('') let &iskeyword = oldiskeyword endif - if has('terminal') && has('popupwin') && popup == 1 + if popup == 1 && has('popupwin') && has('terminal') let minheight = 1 + system( \ "haredoc -Ftty '"..symbol.."' 2>&1 | wc -l" \ ) @@ -39,8 +38,10 @@ function Haredoc(symbol) \ ) elseif has('terminal') execute 'terminal ++noclose haredoc '..symbol - set nonumber + set nonumber filetype=hare nnoremap q :close + nnoremap u + nnoremap d else execute '!haredoc '..symbol endif -- cgit v1.2.3