s1n7ax/nvim-window-picker

Add an option to use the current window if no suitable window is found

happenslol opened this issue · 1 comments

Basically, a problem occurs when using this plugin with neo-tree and opening a folder (e.g. nvim .). Since neo-tree hijacks netrw, the only opened window will be the file tree, which is added to the ignore list/not added in the first place when include_current_win is off. That means that if you have bound your normal open mappings to always use a window picker, you will not be able to open any windows.

I think adding an option that returns the current window ID when no selectable windows were matched would be the easiest solution for this. I would be open to implementing this if you agree with this solution.

s1n7ax commented

You can open the file in the current window with the current configuration. Function cannot return a value now because that would mean the selected the window.

require('window-picker').setup({
			filter_rules = {
				include_current_win = true,
				autoselect_one = true,
				-- filter using buffer options
				bo = {
					-- if the file type is one of following, the window will be ignored
					filetype = { 'neo-tree-popup', 'notify' },
					-- if the buffer type is one of following, the window will be ignored
					buftype = { 'terminal', 'quickfix' },
				},
			},
		})