Question about a custom sort ordering #25
-
Hi But.... I have one folder where i'd like a bit of a custom ordering. Essentially, I'd like all folders listed first, ascending Like so
I'm using this sort spec and it +almost+ works except the folders get sorted in with the files instead of being at the front
Any ideas what I might be doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @drventure, you are almost there with your example, as you already noticed! Let me take the opportunity and explain the missing details of the syntax, until the fully fledged documentation is released. Your example goes like below:
the line What you actually need to write is So you need the first part of config to be adjusted as:
Then to say all files with names starting with 20 you write:
BTW please pay attention to the indentation. The specification of sorting rule is indented with one more space relatively to the previous line (which specifies which elements to sort) What remains to configure is: and all other items go with alphabetical order. There are many ways to express that, yet let me follow your example, which is fully correct for that piece. The final config would look like:
As you can see, you were almost there with your thinking :-) I could end here, but let me take the opportunity to provide some additional hints. First, the alphabetical order is applied by default, if not specified. So in your example we could remove the relevant lines and receive a more concise spec:
Second, the notes and folders not matching any rule by default go in the bottom sorted alphabetically. Which means the last line of config can be omitted and:
Third, some tokens have a shorter equivalents, e.g.
;-) The final most concise notation is probably readable only for me. In general, your config example with adjustments described in this message is the recommended way to go. Thank you for sharing this interesting real-life example! |
Beta Was this translation helpful? Give feedback.
-
Fantastic! Thanks for the response. I felt like I was pretty close, but couldn't quite get it there.
Very nice addition to obsidian!
Darin
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: SebastianMC ***@***.***>
Sent: Saturday, November 5, 2022 1:48:10 PM
To: SebastianMC/obsidian-custom-sort ***@***.***>
Cc: Darin Higgins ***@***.***>; Mention ***@***.***>
Subject: Re: [SebastianMC/obsidian-custom-sort] Question about a custom sort ordering (Discussion #25)
Hi @drventure<https://github.com/drventure>,
you are almost there with your example, as you already noticed!
Let me take the opportunity and explain the missing details of the syntax, until the fully fledged documentation is released.
Your example goes like below:
target-folder: Personal Notes
/folders
a-z
/:files
20...
a-z
...
< a-z
the line /folders is a keyword not followed by any text or pattern. It captures all folders, which don’t match any other pattern specified for the target-folder. Tricky, yeah, especially when detailed documentation is not there yet.
What you actually need to write is /folders .... It expresses your intention, namely: capture all folders with name matching the text or pattern following the keyword /folders. The text ... is a wildcard pattern match-all (when used with no prefix and no suffix). In result, all folders are captured by this pattern
So you need the first part of config to be adjusted as:
target-folder: Personal Notes
/folders ...
< a-z
Then to say all files with names starting with 20 you write: /:files 20... followed by a line specifying the sort order for the group. The config extends to:
target-folder: Personal Notes
/folders ...
< a-z
/:files 20...
a-z
BTW please pay attention to the indentation. The specification of sorting rule is indented with one more space relatively to the previous line (which specifies which elements to sort)
What remains to configure is: and all other items go with alphabetical order. There are many ways to express that, yet let me follow your example, which is fully correct for that piece.
The final config would look like:
target-folder: Personal Notes
/folders ...
< a-z
/:files 20...
a-z
...
< a-z
As you can see, you were almost there with your thinking :-)
I could end here, but let me take the opportunity to provide some additional hints.
First, the alphabetical order is applied by default, if not specified. So in your example we could remove the relevant lines and receive a more concise spec:
target-folder: Personal Notes
/folders ...
/:files 20...
a-z
...
Second, the notes and folders not matching any rule by default go in the bottom sorted alphabetically. Which means the last line of config can be omitted and:
target-folder: Personal Notes
/folders ...
/:files 20...
a-z
Third, some tokens have a shorter equivalents, e.g. /folders --> / and /:files --> /:. We can have a very concise notation:
target-folder: Personal Notes
/ ...
/: 20...
;-) The final most concise notation is probably readable only for me. In general, your config example with adjustments described in this message is the recommended way to go.
Thank you for sharing this interesting real-life example!
Seb
—
Reply to this email directly, view it on GitHub<#25 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAOMXBWBBVZT3KPD34Y5DZDWG2TWVANCNFSM6AAAAAARXFG2AM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Hi @drventure,
you are almost there with your example, as you already noticed!
Let me take the opportunity and explain the missing details of the syntax, until the fully fledged documentation is released.
Your example goes like below:
the line
/folders
is a keyword not followed by any text or pattern. It captures all folders, which don’t match any other pattern specified for the target-folder. Tricky, yeah, especially when detailed documentation is not there yet.What you actually need to write is
/folders ...
. It expresses your intention, namely: capture all folders with name matchin…