[Tags] Handle errors so that &magic and &wrapscan are properly restored

Close #202
This commit is contained in:
Junegunn Choi
2016-09-24 22:33:42 +09:00
parent 687f5e298f
commit 93dbf1711e

View File

@@ -629,11 +629,15 @@ function! s:tags_sink(lines)
let cmd = get(get(g:, 'fzf_action', s:default_action), a:lines[0], 'e')
let [magic, &magic, wrapscan, &wrapscan] = [&magic, 0, &wrapscan, 1]
for line in a:lines[1:]
let parts = split(line, '\t\zs')
let excmd = matchstr(join(parts[2:], ''), '^.*\ze;"\t')
call s:open(cmd, parts[1][:-2])
execute excmd
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
try
let parts = split(line, '\t\zs')
let excmd = matchstr(join(parts[2:], ''), '^.*\ze;"\t')
call s:open(cmd, parts[1][:-2])
execute excmd
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
catch
call s:warn(v:exception)
endtry
endfor
let [&magic, &wrapscan] = [magic, wrapscan]
if len(qfl) > 1