Skip to content

Commit ad6abc5

Browse files
committed
Close spurious preview window on tag not found error
1 parent d8167f5 commit ad6abc5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugin/vim-erlang-tags.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ endfunction
9090
function! s:ExecWithPreviewHeight(cmd, height)
9191
let orig_height = &previewheight
9292
let &previewheight = a:height
93-
execute a:cmd
94-
let &previewheight = orig_height
93+
94+
try
95+
execute a:cmd
96+
catch /E426/ " tag not found
97+
pclose " Spurious preview window is left open, close it.
98+
echohl WarningMsg | echom v:exception | echohl None
99+
finally
100+
let &previewheight = orig_height
101+
endtry
95102
endfunction
96103

97104
function! VimErlangTagsDefineMappings()

0 commit comments

Comments
 (0)