diff options
| -rw-r--r-- | ftplugin/hare.vim | 4 | ||||
| -rw-r--r-- | plugin/haredoc.vim | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/ftplugin/hare.vim b/ftplugin/hare.vim index 944ee0a..1e9fad7 100644 --- a/ftplugin/hare.vim +++ b/ftplugin/hare.vim @@ -1,9 +1,11 @@ " Haredoc plugin -- Hare documentation in vim " Maintainer: Byron Torres <b@torresjrjr.com> -" Last Updated: 2022-06-15 +" Maintainer: Polesznyák Márk <contact@pml68.dev> +" Last Updated: 2025-12-06 " License: Vim License setlocal keywordprg=haredoc nnoremap <buffer> K :call Haredoc('.')<CR> nnoremap <buffer> gK :call Haredoc(',')<CR> +nnoremap <buffer> gd :call Haredoc(';')<CR> diff --git a/plugin/haredoc.vim b/plugin/haredoc.vim index ee83377..1ff141c 100644 --- a/plugin/haredoc.vim +++ b/plugin/haredoc.vim @@ -1,6 +1,7 @@ " Haredoc plugin -- Hare documentation in vim " Maintainer: Byron Torres <b@torresjrjr.com> -" Last Updated: 2022-06-15 +" Maintainer: Polesznyák Márk <contact@pml68.dev> +" Last Updated: 2025-12-06 " License: Vim License command -nargs=? Haredoc :call Haredoc(<q-args>) @@ -8,8 +9,9 @@ command -nargs=? Haredoc :call Haredoc(<q-args>) function Haredoc(symbol) let symbol = a:symbol let popup = symbol == '.' + let goto = symbol == ';' - if (symbol == '.' || symbol == ',') + if (symbol == '.' || symbol == ',' || symbol == ';') let oldiskeyword = &iskeyword setlocal iskeyword+=: let symbol = expand('<cword>') @@ -33,7 +35,17 @@ function Haredoc(symbol) endif endif - if popup && has('popupwin') && has('terminal') + if goto + let haredoc_output = system('haredoc -N '..symbol) + + if match(haredoc_output, ":") != 1 + let [filepath, line] = split(haredoc_output, ":")[-2:-1] + + execute 'edit +'..line..' '..filepath + else + execute "echo '"..haredoc_output.."'" + endif + elseif popup && has('popupwin') && has('terminal') let buf = term_start( \ [ \ 'sh', '-c', |
