willothy / flatten.nvim

Open files and command output from wezterm, kitty, and neovim terminals in your current neovim instance
https://luarocks.org/modules/willothy/flatten.nvim
MIT License
476 stars 13 forks source link

Should avoid opening files in windows containing special buffers (`&buftype != ''`) #42

Closed Bekaboo closed 1 year ago

Bekaboo commented 1 year ago

Is your feature request related to a problem? Please describe. It seems that currently flatten.nvim will open files in users' previous windows no matter what buffer is originally associated in that window. This can be an issue when users have two terminal windows opening side by side and try to open a file inside one of the terminals since the file opened will be displayed in the window for another terminal.

Describe the solution you'd like Find the first window that is not associate with a special buffer (vim.bo.bt == '') and open the file in that window.

Describe alternatives you've considered N/A

Additional context

There are some screenshots that explain the issue:

  1. Two terminals opened side by side: image

  2. Opening files from the terminal on the right (with the window on the left as the previous window accessed):

    image

  3. File opened on the left window, taking the place of the first terminal, which is not expected:

    image

willothy commented 1 year ago

That's a good point, I'll look into implementing that soon.