Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NERDTree gives error "x file(s) could not be loaded into the nerdtree"

Tags:

vim

nerdtree

I have been using NERDTree and vim/gvim on Windows (currenlty on Windows 10) for a while with this error mentioned in the title continually popping up. Whenever I open a new instance of vim/gvim and open up NERDTree I get the error "3 file(s) could not be loaded into the nerdtree". Generally, when I open gvim it defaults to my C:\Users\USERNAME folder which has led me to believe that there is some file in that folder that is causing the problem. The issue only occurs when NERDTree is opened for the first time in the particular instance of gvim/vim. The issue also occurs in other folders. When opening NERDTree for the first time in my "C:\" directory I get "2 file(s) could not be loaded into the nerdtree" as well.

This issue is quite annoying as in gvim it hangs for a few seconds. As a perfectionist, I would prefer to solve the problem.

Some previous troubleshooting:

A google search results in an issue post on the NERDTree github page where the user had a somewhat related issue. The last post on the page recommended opening vim with sudo, as the issue may be due to ownership permissions. I have tried opening gvim as administrator and still get the same problems. Notably, when opening NERDTree I see the NTUSER.DAT files (including ntuser.dat.log, ntuser.ini) and similar. So I thought the problem could be with these files, so I have included them in the ignore variable in my vimrc as shown below

let NERDTreeIgnore = ['\~$','\.pyc$','\*NTUSER*','\*ntuser*','\NTUSER.DAT','\ntuser.ini']

This had worked well in hiding the files in my NERDTree window but I still get the error message.

Any ideas on how I might identify the problem files and solve this issue completely?

like image 409
sticke4 Avatar asked Nov 21 '15 20:11

sticke4


People also ask

How do I add a file to NERDTree?

First, bring up NERDTree and navigate to the directory where you want to create the new file. Press m to bring up the NERDTree Filesystem Menu. This menu allows you to create, rename, and delete files and directories. Type a to add a child node and then simply enter the filename.

How do I open a NERDTree file?

If you want to use NERDTree, you can open NERDTree (type :NERDTree ), navigate to your file, and then press t with cursor on the file name. This will open specific file in new tab. Also, while in NERDTree , you can hit ? . That will show you it's internal help with list of available commands.

What is NERDTree in Vim?

The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.


1 Answers

For me these 3 files on Windows were registry files with file permissions (default Windows). Instead of messing with file permissions and seeing the error only happens on NERDTree's startup I decided to just suppress the error message in vim on startup:

in vimrc:

autocmd VimEnter * silent NERDTree | wincmd p

The '| wincm p' (without quotes) just moves the cursor over to the blank window and isn't needed if you don't want that behavior.

Now, no more red error message when starting vim with NERDTree.

like image 106
Ricky Cobb III Avatar answered Oct 07 '22 13:10

Ricky Cobb III