# Custom File Explorer Sorting Custom File Explorer Sorting is a powerful Obsidian plugin that provides complete control over how notes and folders are displayed in the File Explorer. It enables both config-driven automatic sorting with fine-grained rules and intuitive drag-and-drop manual ordering through Bookmarks integration. The plugin supports wildcard matching, Roman numerals, compound numbers, metadata-based sorting, and inheritance rules for folder hierarchies. The sorting configuration is stored directly in note frontmatter using YAML syntax under the `sorting-spec:` key. This approach keeps sorting rules version-controlled alongside your vault content. The plugin operates non-destructively, only affecting display order without modifying actual files or folder structures. It seamlessly integrates with Obsidian's native features including the Bookmarks and Starred core plugins. ## Basic Sorting Configuration Create a `sortspec.md` note with YAML frontmatter to define sorting rules for any folder. The `target-folder:` directive specifies which folder receives the sorting rules, while order directives like `< a-z` (ascending) or `> a-z` (descending) define the sort behavior. ```yaml --- sorting-spec: | target-folder: / < a-z --- ``` ## Reverse Alphabetical Order Apply reverse alphabetical sorting to treat folders and files equally, intermixing them based on names with 'Z' appearing before 'A'. ```yaml --- sorting-spec: | target-folder: / > a-z --- ``` ## Manual Item Ordering Explicitly list items by name in the desired display order. Unlisted items appear after the specified ones by default. ```yaml --- sorting-spec: | target-folder: / Note 1 Z Archive Some note Some folder --- ``` ## Files First with Folders at Bottom Separate files and folders into distinct groups with independent sorting rules per group. Files sorted by modification date go first, then folders in reverse alphabetical order. ```yaml --- sorting-spec: | target-folder: / /:files < modified /folders > a-z --- ``` ## Pinning Items to Top and Bottom Use wildcards (`...`) and the special `%` symbol to create pinned sections at top and bottom while remaining items sort normally in between. ```yaml --- sorting-spec: | target-folder: . Focus... Inbox % Archive sortspec --- ``` ## P.A.R.A. Method Folder Order Implement the P.A.R.A. organizational system by listing folders in the exact sequence needed: Projects, Areas, Responsibilities, Archive. ```yaml --- sorting-spec: | target-folder: / Projects Areas Responsibilities Archive --- ``` ## Wildcard Pattern Matching Use the `...` wildcard to match partial names with prefix, suffix, or both. This enables flexible matching without specifying complete item names. ```yaml --- sorting-spec: | target-folder: / Pro... A...s Res...es ...ive --- ``` ## Multi-Folder Sorting Rules Apply identical sorting rules to multiple folders by stacking `target-folder:` directives before the sorting instructions. ```yaml --- sorting-spec: | target-folder: Some subfolder target-folder: Archive target-folder: Archive/2021/Completed projects > created --- ``` ## Multiple Folder Configurations Define different sorting rules for different folders within a single specification. Each `target-folder:` section can have unique ordering rules. ```yaml --- sorting-spec: | target-folder: / Pro... Archive target-folder: Projects Top Secret target-folder: Archive > a-z --- ``` ## Numerical Suffix Sorting Sort items by numerical values appearing at the end of names using the `\d+` regex pattern to extract and compare numbers. ```yaml --- sorting-spec: | target-folder: Data/Inbox ... part \d+ < a-z --- ``` ## Roman Numeral Chapter Sorting Support for Roman numerals using `\R+` pattern enables proper ordering of chapters like I, II, III, IV regardless of their textual representation. ```yaml --- sorting-spec: | target-folder: Book Preface Chapter \R+ ... < a-z Epi... --- ``` ## Compound Roman Number Suffixes Sort by compound Roman numerals (like i.iii or iv.vii.x) using the `\.R+` pattern with dot separators for multi-level numbering schemes. ```yaml --- sorting-spec: | target-folder: Research pub Summ... ... \.R+ Final... --- ``` ## Vault-Wide Sorting Inheritance Apply sorting rules to all folders in the vault using the `/*` wildcard suffix on root. This enables global sorting with single configuration. ```yaml --- sorting-spec: | target-folder: /* > advanced modified --- ``` ## Inheritance with Exclusions Create hierarchical sorting rules with the `/*` wildcard for deep inheritance, `/...` for immediate children only, and explicit folder names to override inherited rules. ```yaml --- sorting-spec: | target-folder: /* < a-z target-folder: Reviews/... < modified target-folder: Archive target-folder: Inbox < created target-folder: Reviews/Attachments target-folder: TODOs sorting: standard --- ``` ## Metadata-Based Sorting Sort notes by custom frontmatter metadata values using `by-metadata:` directive. Notes with the specified metadata appear first, sorted by that value. ```yaml --- sorting-spec: | target-folder: Remarks from 'The Little Prince' book < a-z by-metadata: Pages --- ``` ## Advanced Metadata Grouping Combine `with-metadata:` for grouping and `by-metadata:` for sorting to create sophisticated organization based on note properties. ```yaml --- sorting-spec: | target-folder: Remarks from 'The Little Prince' book with-metadata: Pages < a-z by-metadata: Pages ... > modified --- ``` ## Bookmarks Integration for Drag-and-Drop Enable automatic drag-and-drop ordering through Bookmarks integration. Items bookmarked in a dedicated group reflect their order in File Explorer. ```yaml --- sorting-spec: | target-folder: /* bookmarked: < by-bookmarks-order sorting: standard --- ``` ## Starred Items Prioritization Push starred items to the top of any folder using the `starred:` group matcher combined with vault-wide targeting. ```yaml --- sorting-spec: | target-folder: /* > advanced created starred: --- ``` ## Group Priority Modifiers Use priority prefixes `/!`, `/!!`, `/!!!` to control matching order when multiple rules could apply. Higher priority rules match first regardless of definition order. ```yaml --- sorting-spec: | target-folder: Some folder /:files ... /! /:files Archive... --- ``` ## Combining Sorting Groups Merge multiple matching patterns into a single logical group using the `/+` prefix. Combined groups share a single sorting rule. ```yaml --- sorting-spec: | /+ Notes \d\d\d\d /+ Notes \d\d\d\d-\d\d > advanced modified --- ``` ## Regex-Based Target Folder Matching Use `regexp:` modifier for advanced folder matching with regular expressions. Add `for-name:` to match folder names instead of paths. ```yaml --- sorting-spec: | target-folder: regexp: \d?\d-\d?\d-\d\d\d\d$ > created target-folder: regexp: for-name: ^I am everywhere$ < a-z --- ``` ## Excluding Folders from Custom Sorting Explicitly exclude specific folders from custom sorting using `sorting: standard` to return control to Obsidian's native sorting. ```yaml --- sorting-spec: | target-folder: /* < a-z target-folder: Reviews/Attachments target-folder: TODOs sorting: standard --- ``` ## Supported Sorting Methods Configure various sorting algorithms using order directives. Each can be applied at folder or group level with ascending (`<`) or descending (`>`) direction. ```yaml --- sorting-spec: | // Alphabetical (natural) - numbers treated specially: 2 before 11 target-folder: Folder1 < a-z // True alphabetical - strict character comparison: 11 before 2 target-folder: Folder2 < true a-z // By modification date - most recently modified first target-folder: Folder3 > modified // By creation date - newest first target-folder: Folder4 > created // Advanced modified - folders get dates from children target-folder: Folder5 > advanced modified // Advanced created - folders get dates from oldest child target-folder: Folder6 < advanced created // Standard Obsidian sorting target-folder: Folder7 sorting: standard --- ``` ## Alternate Token Syntax Use shorthand tokens for more concise specifications. These are equivalent to their longer forms and can be mixed freely. ```yaml --- sorting-spec: | // Equivalent pairs: // target-folder: --> :::: :::: / // order-asc: --> < or \< < a-z // order-desc: --> > or \> > modified // /:files --> /: /: Chapter... // /folders --> / / Archive... // /folders:files --> % % remaining items --- ``` ## Date Extraction Patterns Extract and sort by dates embedded in file names using date format patterns. Multiple date formats are supported for international conventions. ```yaml --- sorting-spec: | target-folder: Journal // ISO format: 2024-01-15 ... \[yyyy-mm-dd] < a-z target-folder: Reports // US format: 01-15-2024 ... \[mm-dd-yyyy] < a-z target-folder: Archives // European format: 15-01-2024 ... \[dd-mm-yyyy] < a-z --- ``` The Custom File Explorer Sorting plugin excels at organizing complex vault structures where standard Obsidian sorting falls short. Primary use cases include implementing productivity methodologies like P.A.R.A. or Zettelkasten, managing book manuscripts with numbered chapters, organizing research notes by metadata fields, and creating custom workflows with pinned priority items. The combination of manual ordering and automatic rules makes it ideal for vaults that need both structured organization and flexibility. Integration follows a simple pattern: create a `sortspec.md` note in any folder requiring custom sorting, define rules in YAML frontmatter, and toggle the ribbon icon to activate. For vault-wide consistency, use `target-folder: /*` in a single specification note. The plugin respects Obsidian's ecosystem by storing configuration in standard frontmatter format and integrating with core plugins like Bookmarks and Starred for enhanced functionality without external dependencies.