File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
local uv = vim .uv or vim .loop
2
2
local fzf = require (" fzf-lua" )
3
+ local shell = require " fzf-lua.shell"
3
4
return {
4
5
desc = " hide interface instead of abort" ,
5
6
keymap = {
@@ -82,6 +83,15 @@ return {
82
83
end
83
84
return act
84
85
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 )
85
95
return opts
86
96
end ,
87
97
},
Original file line number Diff line number Diff line change @@ -797,8 +797,8 @@ function M.fzf_winobj()
797
797
return loadstring (" return require'fzf-lua'.win.__SELF()" )()
798
798
end
799
799
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(... )" )(... )
802
802
end
803
803
804
804
function M .__CTX ()
Original file line number Diff line number Diff line change 1
1
local path = require " fzf-lua.path"
2
2
local utils = require " fzf-lua.utils"
3
+ local libuv = require " fzf-lua.libuv"
3
4
local config = require " fzf-lua.config"
4
5
local actions = require " fzf-lua.actions"
5
6
@@ -1211,7 +1212,12 @@ end
1211
1212
function FzfWin .unhide ()
1212
1213
local self = _self
1213
1214
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 ))
1215
1221
vim .bo [self ._hidden_fzf_bufnr ].bufhidden = " wipe"
1216
1222
self .fzf_bufnr = self ._hidden_fzf_bufnr
1217
1223
self ._hidden_fzf_bufnr = nil
You can’t perform that action at this time.
0 commit comments