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

Ignoring files #171

Open
NJAldwin opened this issue Feb 22, 2022 · 7 comments
Open

Ignoring files #171

NJAldwin opened this issue Feb 22, 2022 · 7 comments

Comments

@NJAldwin
Copy link

NJAldwin commented Feb 22, 2022

I've been trying out nb across a couple of environments and I love it so far!

I often edit my files with emacs, which leaves <filename>~ and #<filename># files lying around in directories. I have these files ignored from git with my global gitignore (ref: Emacs gitignore); however, I've noticed they're still appearing in the index files nb uses, as well as in the nb cli itself.

The current behavior makes sense -- a user might have local files that are gitignored but might still want to view/edit them in nb.

However, I'd love to be able to explicitly denylist files like these from nb. Is there any way to apply global filters? a .nbignore file somewhere, perhaps?

Apologies if this is documented somewhere, or if it's a dupe issue -- I did a quick search in both places and didn't see anything relevant. Maybe I'm the only one using emacs here 😄

@xwmx
Copy link
Owner

xwmx commented Feb 27, 2022

Hi @NJAldwin, I published a new version, 6.9.4, that skips common editor temp files automatically as a first iteration for this feature, which can be expanded to be more configurable. Please try upgrading and let me know if the issue is resolved.

@doolin
Copy link

doolin commented Feb 27, 2022

Seems to be working correctly now. nb with emacs org-mode is really, really good.

@xwmx
Copy link
Owner

xwmx commented Feb 28, 2022

Glad you like it! 😊

@tbdcit
Copy link

tbdcit commented Nov 3, 2024

I am having a similar problem with my text editor making files that I do not want nb to index. Was there ever a way implemented to ignore certain files?

@xwmx
Copy link
Owner

xwmx commented Nov 4, 2024

@tbdcit Is it possible to share an example filename? The filename for an item can be viewed with nb show <id> --filename.

Currently nb ignores files that match a set of ignore patterns defined in the $_IGNORE_PATTERNS variable:

# $_IGNORE_PATTERNS
#
# An array of filename patterns to ignore, formatted as `sed -e` arguments.
_IGNORE_PATTERNS=(
  -e '/~$/d'
  -e '/^#.*#$/d'
  -e '/\.swa?p$/d'
  -e '/^\.#*/d'
)

If the files have a standard naming format, then we can add or expand a pattern to ignore them.

@tbdcit
Copy link

tbdcit commented Nov 4, 2024 via email

@xwmx
Copy link
Owner

xwmx commented Nov 5, 2024

@tbdcit Thanks for the information. I added a pattern to ignore these files and that's now available in version 7.14.6. I'm still considering how to make this configurable.

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

No branches or pull requests

4 participants