Skip to content

Commit f4eb22a

Browse files
authored
Merge pull request #53 from the-zeitgeist/master
validate nvim_buf_set_extmark existance
2 parents ab4dc40 + 76152f2 commit f4eb22a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

autoload/blamer.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ endfunction
195195

196196
function! blamer#SetVirtualText(buffer_number, line_number, message) abort
197197
let l:line_index = a:line_number - 1
198-
call nvim_buf_set_extmark(a:buffer_number, s:blamer_namespace, l:line_index, 0, {"hl_mode": "combine", "virt_text": [[s:blamer_prefix . a:message, 'Blamer']]})
198+
if exists('*nvim_buf_set_extmark')
199+
call nvim_buf_set_extmark(a:buffer_number, s:blamer_namespace, l:line_index, 0, {"hl_mode": "combine", "virt_text": [[s:blamer_prefix . a:message, 'Blamer']]})
200+
else
201+
call nvim_buf_set_virtual_text(a:buffer_number, s:blamer_namespace, l:line_index, [[s:blamer_prefix . a:message, 'Blamer']], {})
202+
endif
199203
endfunction
200204

201205
function! blamer#CreatePopup(buffer_number, line_number, message) abort
@@ -237,7 +241,7 @@ function! blamer#Show() abort
237241

238242
let l:file_path = s:substitute_path_separator(expand('%:p'))
239243

240-
if empty(l:file_path)
244+
if empty(l:file_path)
241245
return
242246
endif
243247

@@ -288,7 +292,7 @@ endfunction
288292

289293
function! blamer#IsBufferGitTracked() abort
290294
let l:file_path = shellescape(s:substitute_path_separator(expand('%:p')))
291-
if empty(l:file_path)
295+
if empty(l:file_path)
292296
return 0
293297
endif
294298

0 commit comments

Comments
 (0)