Ignore (or !DoNot) files/folders biginning with !

I used to use the exclamation mark character ! as first one in Windows to have a folder/file sorted first on default (sort by name view) to highlight attention on special purpose. With ST using ! as the classical negation prefix in ignore patterns this is a no go. Could we use instead another character picked in the list of forbidden ones in all FS’es, e.g. > or <, with the same idea you devs selected // for comments?

The ignore syntax supports various control/special characters, which may or may not be valid filenames on a given system. Trying to find something that will never be supported anywhere sounds like a mostly impossible task, perhaps with the exception of path separators (which, as you noted, is already utilized by syncthing).

I can use < and > without any problems on Linux ext4: touch '<testfile.txt'. This would mean to add Windows-only syntax to the ignore patterns, which doesn’t sound awesome to me.

On Linux it’s already easy to do what you want, because escaping works:

\!testfile.txt

will ignore !testfile.txt. On Windows, this doesn’t work because \ is a path-separator :man_shrugging:.

However, playing around with ignore patterns, it appears that you can easily work around the \! limitation. Just add brackets:

{!}testfile.txt

will happily ignore !testfile.txt on Windows.

2 Likes

Nice! That’s worth updating the doc :wink:

1 Like

Also probably /!whatever and /**/!whatever.

1 Like

Great! I didn’t thought about this. And what about \!!NoSync ? … hmmm no! Rather !/!NoSync

1 Like

I think !!whatever should work to not ignore files named !whatever, only the first exclamation point should be considered special.

2 Likes

My bad! Silly me! Puzzled! Confused! This whole post is a non-sense. Thank you Jakob. Simple is beautiful.

1 Like