tamago324 / lir.nvim

Neovim file explorer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Close on lose focus

lucastrvsn opened this issue · comments

Hello!

I'm using this plugin and love it so far! But, I think is good to when I open the float and do <C-w>h (to back the focus to the opened file) the float window closes. Maybe it's a good idea to close it when loses focus?

Or just disable all others keymaps (like telescope do)?

Gravacao.de.Tela.2021-04-30.as.21.46.32.mov

Thanks!

Hi.
Thank you for creating the issue.
Yes, it would be nice to have such a setting.

You can close the floating window when it loses focus by setting it as follows.

function _G.LirSettings()
  vim.cmd [[augroup LirCloseOnWinLeave]]
  vim.cmd [[  autocmd!]]
  vim.cmd [[  autocmd WinLeave <buffer> if get(w:, 'lir_is_float', v:false) | call nvim_win_close(0, v:true) | endif]]
  vim.cmd [[augroup END]]
end

vim.cmd [[augroup lir-settings]]
vim.cmd [[  autocmd!]]
vim.cmd [[  autocmd Filetype lir :lua LirSettings()]]
vim.cmd [[augroup END]]

No reply, so I'll close it.