From 95574066fc2ead4d87906018666dbe0fc922dd61 Mon Sep 17 00:00:00 2001 From: dezza <402927+dezza@users.noreply.github.com> Date: Tue, 18 Oct 2022 13:49:32 +0000 Subject: [PATCH] Fix: Unusable file-marks building up in viminfo https://github.com/prabirshrestha/vim-lsp/issues/1337 Fixes: https://github.com/hrsh7th/vim-vital-vs/issues/19 --- autoload/vital/__vital__/VS/Vim/Buffer.vim | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/autoload/vital/__vital__/VS/Vim/Buffer.vim b/autoload/vital/__vital__/VS/Vim/Buffer.vim index 69cbebb..a3c8662 100644 --- a/autoload/vital/__vital__/VS/Vim/Buffer.vim +++ b/autoload/vital/__vital__/VS/Vim/Buffer.vim @@ -38,28 +38,24 @@ endfunction " ensure " function! s:ensure(expr) abort - if !bufexists(a:expr) + if !exists('g:__VS_Vim_Buffers') + let g:__VS_Vim_Buffers = {} + endif + if !has_key(g:__VS_Vim_Buffers, a:expr) if type(a:expr) == type(0) throw printf('VS.Vim.Buffer: `%s` is not valid expr.', a:expr) endif call s:add(a:expr) endif - return bufnr(a:expr) + return g:__VS_Vim_Buffers[a:expr] endfunction " " add " -if exists('*bufadd') - function! s:add(name) abort - let l:bufnr = bufadd(a:name) - call setbufvar(l:bufnr, '&buflisted', 1) - endfunction -else - function! s:add(name) abort - badd `=a:name` - endfunction -endif +function! s:add(name) abort + call extend(g:__VS_Vim_Buffers, { a:name : bufadd('') }) +endfunction " " load