File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11local uv = vim .uv or vim .loop
22local fzf = require (" fzf-lua" )
3+ local shell = require " fzf-lua.shell"
34return {
45 desc = " hide interface instead of abort" ,
56 keymap = {
@@ -82,6 +83,15 @@ return {
8283 end
8384 return act
8485 end , opts .actions )
86+ -- Hijack the resize event to reload buffer/tab list on unhide
87+ opts .keymap .fzf .resize = " transform:" .. shell .raw_action (function (_ , _ , _ )
88+ if opts ._unhide_called then
89+ opts ._unhide_called = nil
90+ if opts .__reload_cmd then
91+ return string.format (" reload:%s" , opts .__reload_cmd )
92+ end
93+ end
94+ end , " {q}" , opts .debug )
8595 return opts
8696 end ,
8797 },
Original file line number Diff line number Diff line change @@ -797,8 +797,8 @@ function M.fzf_winobj()
797797 return loadstring (" return require'fzf-lua'.win.__SELF()" )()
798798end
799799
800- function M .CTX ()
801- return loadstring (" return require'fzf-lua'.core.CTX()" )()
800+ function M .CTX (... )
801+ return loadstring (" return require'fzf-lua'.core.CTX(... )" )(... )
802802end
803803
804804function M .__CTX ()
Original file line number Diff line number Diff line change 11local path = require " fzf-lua.path"
22local utils = require " fzf-lua.utils"
3+ local libuv = require " fzf-lua.libuv"
34local config = require " fzf-lua.config"
45local actions = require " fzf-lua.actions"
56
@@ -1211,7 +1212,12 @@ end
12111212function FzfWin .unhide ()
12121213 local self = _self
12131214 if not self or not self :hidden () then return end
1214- self ._o .__CTX = utils .CTX ()
1215+ self ._o .__CTX = utils .CTX ({ includeBuflist = true })
1216+ self ._o ._unhide_called = true
1217+ -- Send SIGWINCH to to trigger resize in the fzf process
1218+ -- We will use the trigger to reload necessary buffer lists
1219+ local pid = fn .jobpid (vim .bo [self ._hidden_fzf_bufnr ].channel )
1220+ vim .tbl_map (function (_pid ) libuv .process_kill (_pid , 28 ) end , vim ._os_proc_children (pid ))
12151221 vim .bo [self ._hidden_fzf_bufnr ].bufhidden = " wipe"
12161222 self .fzf_bufnr = self ._hidden_fzf_bufnr
12171223 self ._hidden_fzf_bufnr = nil
You can’t perform that action at this time.
0 commit comments