mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
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:
@@ -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]
|
||||||
|
|||||||
Reference in New Issue
Block a user