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

Ignore subdirectories #1203

Closed
RobertAudi opened this issue Jan 13, 2021 · 4 comments · Fixed by #1207
Closed

Ignore subdirectories #1203

RobertAudi opened this issue Jan 13, 2021 · 4 comments · Fixed by #1207

Comments

@RobertAudi
Copy link

Description

At the moment the NERDTreeIgnore allows to ignore files and directories by matching the last path component:

return self.getLastPathComponent(0) =~# pat

So the following will not work:

let NERDTreeIgnore = ['tmp/cache$[[dir]]']

It would be nice if we could specify paths to ignore. Something like that would not change the current behavior (it would just add to it):

let NERDTreeIgnore = ['tmp/cache$[[path]]']
@PhilRunninger
Copy link
Member

PhilRunninger commented Jan 18, 2021

@RobertAudi, You can checkout the branch named i1203. It has your request in it. Give it a try, and let me know how it works for you.

@RobertAudi
Copy link
Author

@PhilRunninger I just tried it and it works perfectly.

I was going to say it didn't seem to work, but then I modified the pattern. The problem was that unlike [[file]] and [[dir]] you should't use $ otherwise it only match directories without anything inside.

Anyway, it works perfectly!

@PhilRunninger
Copy link
Member

@RobertAudi could you tell me a scenario where you'd use this in place of the existing tags? I need some inspiration for the help documentation.

The reason your pattern didn't work with the $ is because I was using the UI-formatted path, which has a trailing forward slash on it, such as /tmp/cache/, which doesn't match the regex /tmp/cache$. I pushed another change to correct that, if you want to give it another go. FYI, the Windows equivalent pattern would need to be specified like so, with escaped backslashes:

let NERDTreeIgnore = ['\\Temp\\cache$[[path]]']

@RobertAudi
Copy link
Author

could you tell me a scenario where you'd use this in place of the existing tags? I need some inspiration for the help documentation.

@PhilRunninger I sometimes put temp files in tmp, for example files where I put stuff that I will reuse. However there are often other directories in the tmp directory such as cache or pids that either have huge amount of files and/or unreadable files, and if the directory node is opened it will slow down the whole editor to load its contents in the tree.

Another such example is vendor/cache in Ruby/Rails projects with vendor gems cached by bundler.

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

Successfully merging a pull request may close this issue.

2 participants