focus.nvim icon indicating copy to clipboard operation
focus.nvim copied to clipboard

All `cmd` does not work in `Diffview`

Open ls-devs opened this issue 1 year ago • 8 comments

Hi, When working in Diffview I would like to be able to resize / enable auto resizing of the differents windows (diff files) except the Diffview panel. Actually when I open Diffview, all the cmd (like FocusEnable FocusAutoresize or FocusMaximise) are not working. How can I proceed so the Diffview panel is not resized but the diff files are ?

Actual config :

{
	"nvim-focus/focus.nvim",
	event = "VeryLazy",
	opts = {
		enable = true,
		commands = true,
		split = {
			bufnew = false,
			tmux = false,
		},
		autoresize = {
			enable = true,
			width = 0,
			height = 0,
			minwidth = 0,
			minheight = 0,
			height_quickfix = 10,
		},
		ui = {
			number = false,
			relativenumber = false,
			hybridnumber = false,
			absolutenumber_unfocussed = false,

			cursorline = false,
			cursorcolumn = false,
			colorcolumn = {
				enable = false,
			},
			signcolumn = false,
			winhighlight = false,
		},
	},
}

Autocmds related :

				{
					"WinEnter",
					function()
						local ignore_buftypes = { "nofile", "prompt", "popup" }
						if vim.tbl_contains(ignore_buftypes, vim.bo.buftype) then
							vim.b.focus_disable = true
						end
					end,
					description = "Disable focus autoresize for BufType",
				},
				{
					"FileType",
					function()
						local ignore_filetypes = {
							["neo-tree"] = true,
							["dap-repl"] = true,
							SidebarNvim = true,
							Trouble = true,
							terminal = true,
							dapui_console = true,
							dapui_watches = true,
							dapui_stacks = true,
							dapui_breakpoints = true,
							dapui_scopes = true,
							OverseerList = true,
							noice = true,
							DiffviewFiles = true,
						}
						vim.b.focus_disable = ignore_filetypes[vim.bo.filetype]
					end,
					description = "Disable focus autoresize for FileType",
				},

ls-devs avatar Feb 19 '24 10:02 ls-devs

You recognize that you disabled focus for DiffviewFiles?

cryptomilk avatar Feb 21 '24 06:02 cryptomilk

You recognize that you disabled focus for DiffviewFiles?

@cryptomilk Of course, in Diffview, the left panel has a filetype of Diffviewfiles but other splits are not of that filetype. (They can be lua, ts etc..). So, the commands should work for the other splits right ? And when enabling focus for DiffviewFiles, I have the Diffview pane being resized on focus, and not the others panes.

For example, with Overseer (which I disabled too), the pane of Overseer is not changed by focus, but if I have splits opened the splits are being changed by focus

ls-devs avatar Feb 21 '24 07:02 ls-devs

@cryptomilk

Please see the behavior with Overseer and then with Diffview

https://github.com/nvim-focus/focus.nvim/assets/58638832/cd025723-ef32-44bf-9ad0-6277d8549e76

So, can I achieve the same behavior focus has with Overseer for Diffview

And can the probleme be related to Diffview opening a new tab while Overseer don't ?

ls-devs avatar Feb 21 '24 14:02 ls-devs

a) You can disable it for windows, buffers or globally. See :help windows. b) I don't know what you mean, there a config for reproducing things here: https://github.com/nvim-focus/focus.nvim/tree/master/extras Use it and explain how to t reproduce the behavior with it.

cryptomilk avatar Mar 05 '24 06:03 cryptomilk

Could it be caused by this https://github.com/nvim-focus/focus.nvim/blob/5500e1a9e926eec5a361d910679282fd723c0a96/lua/focus/modules/resizer.lua#L120 line?

pkwiek avatar Jul 29 '25 09:07 pkwiek

Try to remove it and see :-)

cryptomilk avatar Jul 29 '25 09:07 cryptomilk

The question was directed @ls-devs.

pkwiek avatar Jul 29 '25 10:07 pkwiek

@pkwiek Want to create a PR to remove that line?

cryptomilk avatar Aug 09 '25 13:08 cryptomilk