Michael Naumov14k downloadsEnhances the Excluded files setting bringing gitignore syntax.
This is a plugin for Obsidian that enhances the Excluded files setting bringing gitignore syntax.
Obsidian has Files and links > Excluded files setting, but it is not as useful, because the excluded files are still present in the Files pane, appear in Backlinks pane, etc.
The plugin adds the following features:
gitignore syntax..obsidianignore file for manual editing..gitignore file.Files and links > Excluded files setting in string/regexp format.Hide empty folders setting. When every file inside a folder is excluded, the folder is hidden too, cascading up through parent folders whose whole subtree became empty. Genuinely empty folders (with no files at all) stay visible.[!WARNING]
The plugin makes Obsidian behave like the ignored files do not exist. This might affect features like
Obsidian Sync,Obsidian Publish, etc.Ensure you configured the plugin correctly to avoid data loss.
A demo vault with usage examples ships with every release. You can access it via any of the following:
advanced-exclude-demo-vault-<version>.zip (<version> is the release version) from the Releases.demo-vault/ in this repository.Patterns use gitignore syntax. A few common recipes:
Ignore a folder and everything under it:
Archive/
Ignore all files with a given extension, anywhere in the vault:
*.png
Ignore everything except a few file types (a whitelist). This is the idiom most people get wrong: once * ignores everything, you must re-include directories with !*/ before a negated file rule can match inside them — otherwise the files stay ignored because their parent folder is still excluded:
# Ignore everything...
*
# ...but keep folders traversable so the rules below can reach into them...
!*/
# ...and re-include these file types.
!*.md
!*.canvas
!*.base
Whitelist specific folders instead of file types:
*
!Journal/
!Journal/**
!Templates/
!Templates/**
[!NOTE]
The
!*/(or!Folder/) line is required bygitignoreitself: "It is not possible to re-include a file if a parent directory of that file is excluded." Re-including the directory is what lets the later!...file rules take effect.
See the official gitignore pattern format for the full syntax.
The plugin is available in the official Community Plugins repository.
To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:
Add plugin button once and wait a few seconds for the plugin to install.By default, debug messages for this plugin are hidden.
To show them, run the following command in the DevTools Console:
window.DEBUG.enable('advanced-exclude');
For more details, refer to the documentation.
See my other Obsidian resources.