feat: Option for excluding buffers from the window picker. (#401)

This commit is contained in:
Sindre T. Strøm
2021-05-27 09:19:10 +02:00
committed by GitHub
parent 1499360359
commit 23935ff003
4 changed files with 47 additions and 0 deletions

View File

@@ -224,8 +224,17 @@ function M.pick_window()
local tabpage = api.nvim_get_current_tabpage()
local win_ids = api.nvim_tabpage_list_wins(tabpage)
local tree_winid = view.View.tabpages[tabpage]
local exclude = config.window_picker_exclude()
local selectable = vim.tbl_filter(function (id)
local bufid = api.nvim_win_get_buf(id)
for option, v in pairs(exclude) do
local ok, option_value = pcall(api.nvim_buf_get_option, bufid, option)
if ok and vim.tbl_contains(v, option_value) then
return false
end
end
local win_config = api.nvim_win_get_config(id)
return id ~= tree_winid and win_config.focusable
end, win_ids)