summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-02-23 15:39:53 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-02-23 15:39:53 +0900
commit85751966e9d7628893796e3eac7e9051108a144b (patch)
treeee177e80aba47fde7d7937b63a46c78fdd77d72d
parent42c006d07c7d795517aa6040f4ac789b371a3ea6 (diff)
parenta7bc9d53519569fc4e024f4ca3c733e2702ebe42 (diff)
Merge pull request #506 from justinmk/fixvarmismatch
[vim] s:callback: Always return list.
-rw-r--r--plugin/fzf.vim17
1 files changed, 8 insertions, 9 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 80b85d28..ac508a68 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -239,7 +239,7 @@ function! s:exit_handler(code, command, ...)
return 1
endfunction
-function! s:execute(dict, command, temps)
+function! s:execute(dict, command, temps) abort
call s:pushd(a:dict)
silent! !clear 2> /dev/null
let escaped = escape(substitute(a:command, '\n', '\\n', 'g'), '%#')
@@ -255,7 +255,7 @@ function! s:execute(dict, command, temps)
return s:exit_handler(v:shell_error, command) ? s:callback(a:dict, a:temps) : []
endfunction
-function! s:execute_tmux(dict, command, temps)
+function! s:execute_tmux(dict, command, temps) abort
let command = a:command
if s:pushd(a:dict)
" -c '#{pane_current_path}' is only available on tmux 1.9 or above
@@ -320,7 +320,7 @@ function! s:split(dict)
endtry
endfunction
-function! s:execute_term(dict, command, temps)
+function! s:execute_term(dict, command, temps) abort
call s:split(a:dict)
let fzf = { 'buf': bufnr('%'), 'dict': a:dict, 'temps': a:temps, 'name': 'FZF' }
@@ -369,11 +369,10 @@ function! s:execute_term(dict, command, temps)
return []
endfunction
-function! s:callback(dict, temps)
+function! s:callback(dict, temps) abort
+let lines = []
try
- if !filereadable(a:temps.result)
- let lines = []
- else
+ if filereadable(a:temps.result)
let lines = readfile(a:temps.result)
if has_key(a:dict, 'sink')
for line in lines
@@ -392,12 +391,12 @@ try
for tf in values(a:temps)
silent! call delete(tf)
endfor
-
- return lines
catch
if stridx(v:exception, ':E325:') < 0
echoerr v:exception
endif
+finally
+ return lines
endtry
endfunction