Advanced Exclude
approvedby Michael Naumov
Enhances the Excluded files setting bringing gitignore syntax. - This plugin has not been manually reviewed by Obsidian staff.
Advanced Exclude
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:
- Configure ignore patterns using
gitignoresyntax. .obsidianignorefile for manual editing.- Support ignore patterns from
.gitignorefile. - Reuse existing
Files and links > Excluded filessetting in string/regexp format. - Optionally hide folders left empty by exclusion via the
Hide empty folderssetting. 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.
Demo vault
A demo vault with usage examples ships with every release. You can access it via any of the following:
- Running the Advanced Exclude: Open demo vault command.
- Downloading
advanced-exclude-demo-vault-<version>.zip(<version>is the release version) from the Releases. - Browsing its source in
demo-vault/in this repository.
Pattern examples
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.
Installation
The plugin is available in the official Community Plugins repository.
Beta versions
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:
- Ensure you have the BRAT plugin installed and enabled.
- Click Install via BRAT.
- An Obsidian pop-up window should appear. In the window, click the
Add pluginbutton once and wait a few seconds for the plugin to install.
Debugging
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.
Support
My other Obsidian resources
See my other Obsidian resources.
License
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.
