darlal / obsidian-switcher-plus

Enhanced Quick Switcher plugin for Obsidian.md
GNU General Public License v3.0
418 stars 11 forks source link

FR: Use first alias in place of file name #73

Closed julroger2013 closed 1 year ago

julroger2013 commented 2 years ago

For someone who uses certain filenaming conventions, such as Zettelkasten IDs, the resulting filenames might be lengthy, hard to read, and hard to search for. Aliases can be a good workaround, allowing someone to add a more easily-searchable name in addtion to the more complex filename.

Would you consider adding a toggle to Switcher ++ that would substitute the first alias for a note's file name in all Quick Switcher ++ searches? The filename could be a fallback in the event that a given note has no aliases.

With my filenaming conventions, being able to pull up all first aliases (rather than file names) would be very helpful, such as when trying to switch between different documents in Workspace with many notes using Quick Switch ++'s editor search mode.

(In my case, this would be helpful because I import literature notes from Zotero in a way that uses the Zotero citekey as the filename, such as @2019woodjexrelgarst, which you can imagine is harder to search for than the aliased title of the source).

darlal commented 2 years ago

Hey @julroger2013 thanks for the feature request.

If I understand correctly, this request is to enable the first Alias defined in the file frontmatter to be used as a filename substitute in search and display operations across the various switcher++ modes - effectively turning the first alias into the "Title" for the file.

Question: Have you considered using the first H1 heading contained in the file as the title? A lot of people use the first H1 in exactly the way that you are describing, as a preferred stand-in over filename. It would be fairly straightforward to have Switcher++ show the first H1 (a lot of the the infrastructure is in place already). I'm just trying to better understand your thinking about first Alias vs first H1. Thanks!

julroger2013 commented 2 years ago

Yes, what you've described—substituting a file's first alias in place of the filename in all Switcher++ modes & searches—is exactly what I was thinking of.

I don't have a strong reason to prefer first alias over first H1 header, although my convention hasn't been to use the H1 that way, so it would require some re-configuring on my part (which I'd be fine with doing, to be clear!).

One very weak reason to use first alias vs first H1 heading is that another plugin, Front Matter Title, allows substituting a defined frontmatter item for the file name in, e.g., File Explorer & Title Bar.

I choose to define the frontmatter key/value pair used by Front Matter Title as "aliases," so using the first alias as a filename substitute in Switcher++ would allow me to use the same key/value pair to override the display name in every relevant view of Obsidian (Switcher ++ modals, built-in File Explorer, etc.)

But that's just my idiosyncratic way of doing things, and I would still consider the H1 substitution extremely useful. Whatever you end up doing, thank you so much for considering the FR—Obsidian is better because of devs like you who make such terrific plugins!

julroger2013 commented 2 years ago

Seriously, Switcher ++ is terrific and I can't thank you enough for making it.

julroger2013 commented 1 year ago

Hey again! Bumping this one.

You have many requests & are busy, and I can't think of any reason this should be a special priority.

However, after further experience using Obsidian, I think your idea of having H1 displayed in place of the filename would be very helpful. I'm in the habit of creating notes that have UIDs as titles—e.g. 230721110358—and then using H1 as the "real" title. It's a byproduct of working with lots of legal materials where the citation conventions use all sorts of characters that are illegal in a file name.

When I'm working on a writing project, I may have many such UID-bearing notes open as I synthesize them into a larger piece of writing. I love to use Switcher++'s Editor Mode to change between these different source notes, but it becomes rather difficult when all that is displayed is a set of UIDs. If H1 could be substituted for file name, at least in editor mode, that would make a big difference.

Thank you for considering!

darlal commented 1 year ago

I think we have the infrastructure in place to be able to do this relatively easily now, at least to get H1 titles in the other modes where it makes sense 👍

darlal commented 1 year ago

@julroger2013 First H₁ heading is now displayed everywhere applicable with release 3.3.5. Thanks!