Skip to content
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

nvim NvimTree.lua does not open #1629

Closed
barrett-ruth opened this issue Oct 7, 2022 · 9 comments · Fixed by #1634
Closed

nvim NvimTree.lua does not open #1629

barrett-ruth opened this issue Oct 7, 2022 · 9 comments · Fixed by #1634
Labels
bug Something isn't working

Comments

@barrett-ruth
Copy link

Description

I have some custom mappings stored in nvim/after/ftplugin/NvimTree.lua to run on filetype NvimTree. Opening this file via nvim after/ftplugin/NvimTree.lua actually opens NvimTree on that file and not the file itself.

Neovim version

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system and version

arch

nvim-tree version

7282f7d -n 1

Minimal config

no config needed

Steps to reproduce

  1. NvimTreeOpen after/ftplugin/NvimTree.lua

Expected behavior

nvim-tree actually opens the file NvimTree.lua

Actual behavior

the plugin NvimTree itself opens, not the file

@barrett-ruth barrett-ruth added the bug Something isn't working label Oct 7, 2022
@alex-courtis
Copy link
Member

This is working as intended. :NvimTreeOpen takes a path as the optional argument.

@barrett-ruth
Copy link
Author

Actually, my "Steps to reproduce" had an error
What I meant to say was running

nvim after/ftplugin/NvimTree.lua

opens NvimTree (and NOT the file), which seems to make no sense (the "NvimTreeOpen" call in the issue was a typo)

I think this is still an issue so reopen it if you agree with the above correction.

@alex-courtis
Copy link
Member

It is likely to do with runtime paths; there is already an NvimTree.lua present.

Rename it and you should be fine.

@barrett-ruth
Copy link
Author

Then accessing NvimTree.lua file is impossible. Should I just change the contents into an autocmd?

@alex-courtis
Copy link
Member

Apologies, I was incorrect... there is no other NvimTree.lua. I do not know what is going on.

Same thing occurs when opening ~/NvimTree.lua

Changing to an autocmd should work if it's possible.

@alex-courtis alex-courtis reopened this Oct 8, 2022
@alex-courtis alex-courtis changed the title NvimTree opens on after/ftplugin/NvimTree.lua nvim NvimTree.lua does not open Oct 8, 2022
@kyazdani42
Copy link
Member

caused by #1618.

@alex-courtis
Copy link
Member

@barrett-ruth please test fix branch:

cd /path/to/nvim-tree.lua
git pull
git checkout 1629-cannot-start-with-buffer-named-NvimTree

When you're done, checkout master or nightly.

@barrett-ruth
Copy link
Author

Works perfectly. thanks!

alex-courtis added a commit that referenced this issue Oct 10, 2022
alex-courtis added a commit that referenced this issue Oct 10, 2022
…of buffer (#1634)

* fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer

* Revert "fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer"

This reverts commit e713607.

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1629): nvim start with file named *NvimTree* treats file as tree
Almo7aya pushed a commit to Almo7aya/nvim-tree.lua that referenced this issue Oct 11, 2022
… instead of buffer (nvim-tree#1634)

* fix(nvim-tree#1629): nvim start with file named *NvimTree* opens tree instead of buffer

* Revert "fix(nvim-tree#1629): nvim start with file named *NvimTree* opens tree instead of buffer"

This reverts commit e713607.

* fix(nvim-tree#1629): nvim start with file named *NvimTree* treats file as tree

* fix(nvim-tree#1629): nvim start with file named *NvimTree* treats file as tree
alex-courtis added a commit that referenced this issue Oct 17, 2022
…1640)

* fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer

* Revert "fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer"

This reverts commit e713607.

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1639): ensure tree autocommands match filetype as well as name

* fix(#1639): fix bad merge

* fix(#1639): ensure tree autocommands match filetype as well as name
@alex-courtis
Copy link
Member

Unfortunately this change has been reverted due to many regressions: #1668

A new mechanism to control startup behaviour is under way: #1669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants