From c286abb35fdcad46fdb8fda049894930b8804f1b Mon Sep 17 00:00:00 2001 From: Polesznyák Márk Date: Sat, 6 Dec 2025 01:12:12 +0100 Subject: feat: support local methods in goto --- plugin/haredoc.vim | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugin/haredoc.vim b/plugin/haredoc.vim index 1ff141c..256ac9f 100644 --- a/plugin/haredoc.vim +++ b/plugin/haredoc.vim @@ -36,14 +36,20 @@ function Haredoc(symbol) endif if goto - let haredoc_output = system('haredoc -N '..symbol) + let line = search('^fn '..symbol, 'bnw') - if match(haredoc_output, ":") != 1 - let [filepath, line] = split(haredoc_output, ":")[-2:-1] - - execute 'edit +'..line..' '..filepath + if line != 0 + execute line else - execute "echo '"..haredoc_output.."'" + 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 endif elseif popup && has('popupwin') && has('terminal') let buf = term_start( -- cgit v1.2.3