Skip to content

How to disallow use some buffers for opening files? #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Wansmer opened this issue Sep 10, 2022 · 5 comments
Closed

How to disallow use some buffers for opening files? #511

Wansmer opened this issue Sep 10, 2022 · 5 comments
Labels
enhancement New feature or request how-to

Comments

@Wansmer
Copy link

Wansmer commented Sep 10, 2022

Now neo-tree opens the file in the last used buffer.
This is convenient in most cases, but if there were "toggleterm" or "packer" buffers before, it becomes inconvenient.
How to disable the use of these types of buffers for opening files?

@cseickel
Copy link
Contributor

cseickel commented Sep 10, 2022

There's no config option to specify which buffer types to never replace, but you can implement that logic yourself by handling the "file_open_requested" event: https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#custom-window-chooser-for-file-open-commands

My suggestion is always to use :Neotree reveal current in the window you intend to open the file in, that way there's no ambiguity about where that file will open.

@Wansmer
Copy link
Author

Wansmer commented Sep 10, 2022

Thanks for the answer. I'll try to use 'file_open_requested'.
P.S. I think it would be cool if future releases add this functionality to the config (as in 'nvim-window-picker' config: filter_rules.bo.filetype). It will be very helpful.

@cseickel cseickel added the enhancement New feature or request label Sep 10, 2022
@zolrath
Copy link

zolrath commented Jan 11, 2023

I agree that having this exposed more easily would be great.
Currently experiencing neo-tree opening files in a noice.nvim popup buffer when vim is first launched.

@nhat-vo
Copy link
Collaborator

nhat-vo commented Apr 9, 2023

Not very sure if this answers the problem, but the *_with_window_picker commands allow you to choose which window to open the buffer in.

@cseickel
Copy link
Contributor

This has been fixed by #694 and this option:

open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request how-to
Projects
None yet
Development

No branches or pull requests

4 participants