1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-22 17:05:42 +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 else
function! s:self.create_buf(listed, scratch) abort function! s:self.create_buf(listed, scratch) abort
let bufnr = self.bufadd('') let bufnr = self.bufadd('')
" in vim, a:listed must be number if exists('*bufloaded')
" why can not use v:true and v:false \ && exists('*bufload')
\ && !bufloaded(bufnr)
call bufload(bufnr)
endif
call setbufvar(bufnr, '&buflisted', a:listed ? 1 : 0) call setbufvar(bufnr, '&buflisted', a:listed ? 1 : 0)
if a:scratch if a:scratch
call setbufvar(bufnr, '&swapfile', 0) call setbufvar(bufnr, '&swapfile', 0)