[Tags] Ask before generating tags file

Close #127
This commit is contained in:
Junegunn Choi
2016-04-19 01:11:16 +09:00
parent a148f78863
commit 90169196e1
+10
View File
@@ -580,11 +580,21 @@ endfunction
function! fzf#vim#tags(query, ...) function! fzf#vim#tags(query, ...)
if empty(tagfiles()) if empty(tagfiles())
call inputsave()
echohl WarningMsg
let gen = input('tags not found. Generate? (y/N) ')
echohl None
call inputrestore()
redraw
if gen =~ '^y'
call s:warn('Preparing tags') call s:warn('Preparing tags')
call system('ctags -R') call system('ctags -R')
if empty(tagfiles()) if empty(tagfiles())
return s:warn('Failed to create tags') return s:warn('Failed to create tags')
endif endif
else
return s:warn('No tags found')
endif
endif endif
let tagfile = tagfiles()[0] let tagfile = tagfiles()[0]