49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
-- Resize window to prioritize the focused on.
|
|
-- https://github.com/nvim-focus/focus.nvim
|
|
return {
|
|
"nvim-focus/focus.nvim",
|
|
event = "VeryLazy",
|
|
opts = {
|
|
enable = true,
|
|
ui = {
|
|
-- Display line numbers in the focused window only.
|
|
hybridnumber = true,
|
|
|
|
-- Display signcolumn in the focused window only.
|
|
signcolumn = true,
|
|
},
|
|
},
|
|
config = function()
|
|
require("focus").setup({})
|
|
|
|
local ignore_buftypes = { "dbui", "nofile" }
|
|
local ignore_filetypes =
|
|
{ "dbui", "dapui_breakpoints", "dapui_stacks", "dapui_scopes", "dap_repl", "dapui_console" }
|
|
local augroup = vim.api.nvim_create_augroup("FocusDisable", { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd("WinEnter", {
|
|
group = augroup,
|
|
callback = function(_)
|
|
if vim.tbl_contains(ignore_buftypes, vim.bo.buftype) then
|
|
vim.w.focus_disable = true
|
|
else
|
|
vim.w.focus_disable = false
|
|
end
|
|
end,
|
|
desc = "Disable focus autoresize for BufType",
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
group = augroup,
|
|
callback = function(_)
|
|
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
|
|
vim.b.focus_disable = true
|
|
else
|
|
vim.b.focus_disable = false
|
|
end
|
|
end,
|
|
desc = "Disable focus autoresize for FileType",
|
|
})
|
|
end,
|
|
}
|