1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:50:06 +08:00

fix(vim#buffer): fix create_buf function

create_buf do not load buffer automatically.
load the buffer as far as possible
This commit is contained in:
wsdjeg 2022-04-21 21:03:05 +08:00
parent 1670480e3b
commit 0b4d10639d

View File

@ -100,8 +100,11 @@ if exists('*nvim_create_buf')
else
function! s:self.create_buf(listed, scratch) abort
let bufnr = self.bufadd('')
" in vim, a:listed must be number
" why can not use v:true and v:false
if exists('*bufloaded')
\ && exists('*bufload')
\ && !bufloaded(bufnr)
call bufload(bufnr)
endif
call setbufvar(bufnr, '&buflisted', a:listed ? 1 : 0)
if a:scratch
call setbufvar(bufnr, '&swapfile', 0)