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
473 stars 13 forks source link

Bug with plugins that automatically change cwd #52

Closed IndianBoy42 closed 1 year ago

IndianBoy42 commented 1 year ago

Describe the bug Currently the arguments are sent as is, along with guest_cwd, assuming guest_cwd/argv will give the correct absolute path. However if the user has a plugin/autocmd that automatically changes the cwd base on, for example .git or whatever, then this assumption is broken

To Reproduce This is the autocd code I use, which is set before lazy.setup{} even https://pastebin.com/7uq31x2a

  1. cd some_dir with a .git
  2. cd sub_dir && nvim some_file
  3. host nvim tries to open some_dir/some_file

Expected behavior some_dir/sub_dir/some_file should be opened instead

Screenshots If applicable, add screenshots and/or videos to help explain your problem.

Desktop (please complete the following information):

Additional context One solution is of course to make sure these autocd plugins do not load and activate too early, but then ideally the documentation of this plugin would reflect this requirement.

The more robust solution is to properly fully resolve filepaths (absolute) on the guest side, perhaps we should use the names from the buffers that are automatically opened by neovim?