From 172afabdb79813d1cd17c4fc7a8adb53ba776729 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sat, 5 Feb 2011 19:32:49 +1300 Subject: [PATCH] Handle ctags failures gracefully --- plugin/tagbar.vim | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index b8890f6..6ff62f9 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -406,6 +406,7 @@ function! s:OpenWindow() setlocal nonumber setlocal nowrap setlocal winfixwidth + setlocal textwidth=0 if exists('+relativenumber') setlocal norelativenumber @@ -1010,9 +1011,26 @@ function! s:RenderContent(fname, ftype) return endif - let typeinfo = s:known_types[a:ftype] + if !has_key(s:known_files, a:fname) + silent! put ='There was an error processing the file. Please run ' . + \ 'ctags manually to determine what the problem is.' + normal! gqq + + let s:current_file = '' + + setlocal nomodifiable + let &lazyredraw = lazyredraw_save + + if !in_tagbar + execute 'wincmd p' + endif + + return + endif let fileinfo = s:known_files[a:fname] + let typeinfo = s:known_types[a:ftype] + " Print tags for kind in typeinfo.kinds let curtags = filter(copy(fileinfo.tags),