rmagatti / goto-preview

A small Neovim plugin for previewing definitions using floating windows.
Apache License 2.0
779 stars 27 forks source link

Keep the last directory structure after close the preview window #80

Closed zhanglin2018 closed 1 year ago

zhanglin2018 commented 1 year ago

Is your feature request related to a problem? Please describe. First i am in the first directory structure and then use the goto-preview plugin to only show the preview buffer. And the I close the preview buffer, unfortunatelly, the last directory structure has changed and every time I must open the directory again and again.

Describe the solution you'd like keep the last directory structure after close the preview window?

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

rmagatti commented 1 year ago

Can you clarify what you mean by directory structure? Can you provide a screenshot or video showing the problem?

zhanglin2018 commented 1 year ago

First,I have open a working directory and open some cpp file into buffers. when i use goto-preview to find a definition which the file is not in the currect working directory. As the result, the working directory will be changed. Finally, I close the goto-preview flowting window, the working directory has been changed, and only in the parent directy of the focused buffer.

zhanglin2018 commented 1 year ago

First,I have open a working directory and open some cpp file into buffers. when i use goto-preview to find a definition which the file is not in the currect working directory. As the result, the working directory will be changed. Finally, I close the goto-preview flowting window, the working directory has been changed, and only in the parent directy of the focused buffer.

rmagatti commented 1 year ago

Was this issue resolved? Was it a non-issue?

zhanglin2018 commented 1 year ago

not resolved: ex: I am in the A/B/C/demo.cpp, the demo.cpp has a reference call to D/called.cpp. use the goto-preview, the directory will be changed to the D/call.cpp. when close the goto-preview, the directory will be changed to the C/demo.cpp, that's a trouble.

every time, I need to open the directory to A/B/C/demo.cpp

rmagatti commented 1 year ago

I see. This has nothing to do with goto-preview. You probably have some other plugin changing the your cwd to whatever the directory of the newly opened buffer is. Goto preview merely navigates you to the new buffer, it does not touch your cwd.

zhanglin2018 commented 1 year ago

I got it. Thanks for your help. and i find the root cause: the nvim-tree.lua has option in the setup block, like updata_focused_file = { enable = true, update_cwd = true, ignore_list = {}, } After set the "update_cwd" to false, this issue is gone.