Backward compatibility for nvim-0.1.7.

NeoVim 0.1.7 does not support the `function()` function accepting an
optional argument list.

Fixes #496.
This commit is contained in:
Andy Stewart
2018-03-14 11:43:36 +00:00
parent 380e7935b7
commit 2f736d58b4

View File

@@ -124,10 +124,17 @@ function! gitgutter#utility#set_repo_path(bufnr) abort
\ 'err': {bufnr -> gitgutter#utility#setbufvar(bufnr, 'path', -2)}, \ 'err': {bufnr -> gitgutter#utility#setbufvar(bufnr, 'path', -2)},
\ }) \ })
else else
call gitgutter#async#execute(cmd, a:bufnr, { if has('nvim') && !has('nvim-0.2.0')
\ 'out': function('s:set_path'), call gitgutter#async#execute(cmd, a:bufnr, {
\ 'err': function('s:set_path', [-2]) \ 'out': function('s:set_path'),
\ }) \ 'err': function('s:not_tracked_by_git')
\ })
else
call gitgutter#async#execute(cmd, a:bufnr, {
\ 'out': function('s:set_path'),
\ 'err': function('s:set_path', [-2])
\ })
endif
endif endif
else else
let path = gitgutter#utility#system(cmd) let path = gitgutter#utility#system(cmd)
@@ -139,6 +146,12 @@ function! gitgutter#utility#set_repo_path(bufnr) abort
endif endif
endfunction endfunction
if has('nvim') && !has('nvim-0.2.0')
function! s:not_tracked_by_git(bufnr)
call s:set_path(a:bufnr, -2)
endfunction
endif
function! s:set_path(bufnr, path) function! s:set_path(bufnr, path)
if a:bufnr == -2 if a:bufnr == -2
let [bufnr, path] = [a:path, a:bufnr] let [bufnr, path] = [a:path, a:bufnr]