2

I've been dealing with a huge problem of NeoVim for weeks (also applies to Vim a GVim) and I failed to find the solution on my own. What's happening is that NERDTree is hiding the content of any folder or directory that contains brackets in its name, either [] or {}. Here's an example:

If I add brackets to a directory name, NERDTree just hide all the content inside that folder

But probably, this problem is not directly related to NERDTree, maybe it's related to Netrw plugin, the default file explorer of Vim (I'm not sure, but I think that NERDTree works with Netrw on the background). See this:

non description

Important: Note that I first tried to open the folder "category" and it worked properly. Then, I changed the name to "[category]" and Netrw began to hide the file index.tsx inside that folder.


I'm on:

  • CMD (Windows Terminal), recently installed.
  • NeoVim, latest version.
  • NERDTree, latest version.
  • I updated all my plugins after having this problem, but it's still there.

I don't know what else to add. I tested the same case with a clean instalation of Vim, without configs and plugins, and I got the same behavior from the code editor. I'll be so grateful if someone here can help me with this.

2
  • Welcome to Vi and Vim!
    – filbranden
    Feb 26, 2022 at 14:31
  • Welcome to this site! Just to add a bit of information: NERDTree does not rely on netrw. Since v 3.0.0 they even added a piece of code which hijacks :e <directory> to open NERDTree instead of netrw. If this is a bug you can consistently reproduce it's worth checking NERDTree's issue tracker and create a new one if it doesn't already exists.
    – statox
    Mar 1, 2022 at 14:33

2 Answers 2

1

Oh, well, please, don't push the limits for the poor Vim file managers. They are all buggy as homeless dogs. Especially when dealing with unusual file names. You can open an issue or just forget it...

Personally, I ended writing one of my own. And it is pretty good at swallowing the brackets, I have to admit, but, quite probably, it has plenty of other bugs.

0

I know it has already been 2 years since this post was written, but nevertheless.

I had the same problem when I was working with Next.js. The only solution I found was changing terminal from PowerShell to WSL.

Here is the video of working with [directory] in PowerShell Nvim in Windows Powershell And here is the video from the same repo but in WSL Nvim in Ubuntu terminal

The issue is caused by PowerShell's Set-Location command which by default uses the [] in the same way regex does, as a character set.

This can be demonstrated by following the below steps:

  1. Open a PowerShell window

  2. Set up our test by creating two new folders:

    a. One called "T" via the command New-Item "T" -ItemType Directory

    b. One called "[Test]" via the command New-Item "[Test]" -ItemType Directory

  3. Try to change folders with Set-Location [Test]

You'll notice that you were actually moved into the "T" folder not the "[Test]" folder. This can be fixed by just using Set-Location -LiteralPath [Test] instead.

You can find the relevant issue on the official Neovim GitHub.

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Friedrich
    Apr 3 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.