vim-haredoc

[vim] haredoc plugin
git clone https://git.torresjrjr.com/vim-haredoc.git
Log | Files | Refs | README | LICENSE

commit 42447ac27614bd8278a810c0546879da0f5b1ae8
parent e7a6d6ef762945d979044e924cd12452acb50459
Author: Byron Torres <b@torresjrjr.com>
Date:   Wed, 15 Jun 2022 03:12:03 +0100

new gK mapping, u & d scrolling, improved docs

Diffstat:
Mdoc/haredoc.txt | 22+++++++++++++++++-----
Mdoc/tags | 2++
Mftplugin/hare.vim | 3++-
Mplugin/haredoc.vim | 11++++++-----
4 files changed, 27 insertions(+), 11 deletions(-)

diff --git 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 @@ -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 @@ -5,4 +5,5 @@ setlocal keywordprg=haredoc -nnoremap <buffer> K :call Haredoc('.')<CR> +nnoremap <buffer> K :call Haredoc('.')<CR> +nnoremap <buffer> gK :call Haredoc(',')<CR> diff --git a/plugin/haredoc.vim b/plugin/haredoc.vim @@ -7,15 +7,14 @@ command -nargs=? Haredoc :call Haredoc(<q-args>) 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('<cword>') 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 <buffer> q :close<CR> + nnoremap <buffer> <nowait> u <C-U> + nnoremap <buffer> <nowait> d <C-D> else execute '!haredoc '..symbol endif