332332--- @param buf number | nil # buffer number
333333--- @param title string # title of the popup
334334--- @param size_func function # size_func(editor_width, editor_height) -> width, height, row, col
335- --- @param opts table # options - gid=nul, on_leave=false, keep_buf =false
335+ --- @param opts table # options - gid=nul, on_leave=false, persist =false
336336--- @param style table # style - border="single"
337337--- returns table with buffer, window, close function, resize function
338338_H .create_popup = function (buf , title , size_func , opts , style )
@@ -341,7 +341,7 @@ _H.create_popup = function(buf, title, size_func, opts, style)
341341 local border = style .border or " single"
342342
343343 -- create buffer
344- buf = buf or vim .api .nvim_create_buf (not not opts . persist , not opts .persist )
344+ buf = buf or vim .api .nvim_create_buf (false , not opts .persist )
345345
346346 -- setting to the middle of the editor
347347 local options = {
@@ -394,7 +394,7 @@ _H.create_popup = function(buf, title, size_func, opts, style)
394394 if win and vim .api .nvim_win_is_valid (win ) then
395395 vim .api .nvim_win_close (win , true )
396396 end
397- if opts .keep_buf then
397+ if opts .persist then
398398 return
399399 end
400400 if vim .api .nvim_buf_is_valid (buf ) then
@@ -1559,7 +1559,7 @@ M.open_buf = function(file_name, target, kind, toggle)
15591559 local wh = h - (top + bottom )
15601560 return ww , wh , top , (w - ww ) / 2
15611561 end ,
1562- { on_leave = false , escape = false , persist = true , keep_buf = true },
1562+ { on_leave = false , escape = false , persist = true },
15631563 { border = M .config .style_popup_border or " single" }
15641564 )
15651565
@@ -1613,6 +1613,8 @@ M.open_buf = function(file_name, target, kind, toggle)
16131613 return buf
16141614 end
16151615
1616+ vim .api .nvim_buf_set_option (buf , " buflisted" , false )
1617+
16161618 if target == M .BufTarget .split or target == M .BufTarget .vsplit then
16171619 close = function ()
16181620 if vim .api .nvim_win_is_valid (win ) then
0 commit comments