Skip to content

Reuse Buffer #1895

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
alex-courtis opened this issue Jan 7, 2023 · 9 comments
Closed

Reuse Buffer #1895

alex-courtis opened this issue Jan 7, 2023 · 9 comments

Comments

@alex-courtis
Copy link
Member

nvim-tree buffer will be wiped on window close as bufhidden=wipe

One buffer exists per tab:
name "NvimTree_" .. vim.api.nvim_get_current_tabpage()
buftype=nofile
filetype=NvimTree

The buffer could be reused when nvim-tree is reopened.

Context: #1858 (comment)

@hinell
Copy link
Contributor

hinell commented Jan 7, 2023

Would also be cool to make a configurable synchronization of currently focused file across different nvim-tree buffers.

@alex-courtis
Copy link
Member Author

That's a larger issue #457

@asmodeus812
Copy link
Contributor

asmodeus812 commented Mar 21, 2023

@alex-courtis is there any update on that, i think i am facing an issue related to that feature. When i am on a second tab with a buffer loaded in the main tab window (1 window, 1 buffer loaded in the window), if i do :e {dir} and select file from the tree, the tree closes, the tab closes too and i am brought back to the first tab (prev tab), and the file i selected from the tree is not loaded / opened at all. Ideally i would like the file (buffer to be loaded) to be opened in place of the file explorer, i.e not close the window (and consequently the tab) but rather use that window to show the file.

@gegoune
Copy link
Collaborator

gegoune commented Mar 21, 2023

Does api.node.open.replace_tree_buffer do what you are after (mapped to <C-e> by default)?

@asmodeus812
Copy link
Contributor

asmodeus812 commented Mar 22, 2023

@gegoune indeed, is it safe to replace the default on CR = "edit" action with that one by default, what are the differences and possible implications ? I have also by default configured quit_on_open = true, could that also be interfering badly ?

@gegoune
Copy link
Collaborator

gegoune commented Mar 22, 2023

I can't think of downsides to any of these. You can override default mappings however you like.

@alex-courtis
Copy link
Member Author

The original motivation for this enhancement is no longer valid following the change to legendary to use the new API nvim-tree.api.config.mappings.get_keymap()

Please report your findings @asmodeus812 ; I'll close this one if the above solution meets your needs.

@alex-courtis
Copy link
Member Author

Let's track this at #457

@alex-courtis
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants