Skip to content

Commit

Permalink
Require nvim-0.8.0 to nvim_set_option_value()
Browse files Browse the repository at this point in the history
Close #807
  • Loading branch information
jalvesaq committed Mar 14, 2024
1 parent 4f589ba commit 82b8468
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion R/common_global.vim
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ function RFloatWarn(wmsg)
call setbufvar(s:warn_buf, '&tabstop', 2)
call setbufvar(s:warn_buf, '&undolevels', -1)
endif
call nvim_set_option_value('syntax', 'off', {'buf': s:warn_buf})
if has("nvim-0.8.0")
call nvim_set_option_value('syntax', 'off', {'buf': s:warn_buf})
else
call nvim_buf_set_option(s:warn_buf, "syntax", "off")
endif
call nvim_buf_set_lines(s:warn_buf, 0, -1, v:true, fmsgl)
let opts = {'relative': 'editor', 'width': realwidth, 'height': wht,
\ 'col': winwidth(0) - realwidth,
Expand Down
6 changes: 5 additions & 1 deletion R/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ function CreateNewFloat(...)
call setbufvar(s:float_buf, '&tabstop', 2)
call setbufvar(s:float_buf, '&undolevels', -1)
endif
call nvim_set_option_value('syntax', 'rdocpreview', {'buf': s:float_buf})
if has("nvim-0.8.0")
call nvim_set_option_value('syntax', 'rdocpreview', {'buf': s:float_buf})
else
call nvim_buf_set_option(s:float_buf, "syntax", "rdocpreview")
endif

call nvim_buf_set_lines(s:float_buf, 0, -1, v:true, flines)

Expand Down
12 changes: 10 additions & 2 deletions ftplugin/rbrowser.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ function! UpdateOB(what)
if nvim_win_is_valid(g:rplugin.ob_winnr)
let obcur = nvim_win_get_cursor(g:rplugin.ob_winnr)
endif
call nvim_set_option_value("modifiable", v:true, {'buf': g:rplugin.ob_buf})
if has("nvim-0.8.0")
call nvim_set_option_value("modifiable", v:true, {'buf': g:rplugin.ob_buf})
else
call nvim_buf_set_option(g:rplugin.ob_buf, "modifiable", v:true)
endif
call nvim_buf_set_lines(g:rplugin.ob_buf, 0, nvim_buf_line_count(g:rplugin.ob_buf), 0, fcntt)
if nvim_win_is_valid(g:rplugin.ob_winnr) && obcur[0] <= len(fcntt)
call nvim_win_set_cursor(g:rplugin.ob_winnr, obcur)
endif
call nvim_set_option_value("modifiable", v:false, {'buf': g:rplugin.ob_buf})
if has("nvim-0.8.0")
call nvim_set_option_value("modifiable", v:false, {'buf': g:rplugin.ob_buf})
else
call nvim_buf_set_option(g:rplugin.ob_buf, "modifiable", v:false)
endif
else
if has_key(g:rplugin, "curbuf") && g:rplugin.curbuf != "Object_Browser"
let savesb = &switchbuf
Expand Down

0 comments on commit 82b8468

Please sign in to comment.