From b54d8d64f126a6d600323d56ba1d2e0051b09d16 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Tue, 14 Oct 2014 11:19:08 +1300 Subject: [PATCH] Handle unloaded buffers when getting prototype, closes #222 --- autoload/tagbar.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 2b555c3..3845651 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1394,8 +1394,9 @@ function! s:NormalTag.getPrototype(short) abort dict else let bufnr = self.fileinfo.bufnr - if self.fields.line == 0 - " No linenumber available, try the pattern instead + if self.fields.line == 0 || !bufloaded(bufnr) + " No linenumber available or buffer not loaded (probably due to + " 'nohidden'), try the pattern instead return substitute(self.pattern, '^\\V\\^\\C\s*\(.*\)\\$$', '\1', '') endif