pjeby / quick-explorer

Perform file explorer operations (and see your current file path) from the Obsidian.md title bar
ISC License
265 stars 11 forks source link

Add a default folder for when there is no note open #31

Open montemartin opened 2 years ago

montemartin commented 2 years ago

I recently discovered the full power of this plugin for navigating with the keyboard. It's quickly moved to my most used and loved Obsidian plugin. Thank you!

Here is a suggestion to make it even better: add the ability to configure additional hotkeys that open directly to specific folders.

As an example I have an inbox folder where all new notes go, including externally added clippings. Every so often I process those notes (GTD style) making additional notes and moving thing to the approriate place. When I move a note it's usually into a deeply nested folder structure, and I want go right to the next note in the inbox. Right now I have to open the root folder (CMD+U in my setup) then navigate via the arrow keys. It would be terrific if I could just hit CMD+U and have it already at the fist note in the inbox instead of in the root.

pjeby commented 2 years ago

Hm. How about I add a URL action to open a specific folder? Then you can use the URI Commands plugin to set up as many specific-folder commands as you like.

montemartin commented 2 years ago

That's an interesting idea. I think it would work for me personally, though I can't imagine many other situations where a URL action would be helpful for this plugin, (that doesn't mean they don't exist).

My only other thought is that passing a hotkey to a URL action might feel a little slow compared to a direct call. I haven't done any plugin creation personally, or used the URI Actions plugin, so that's only my uneducated opinion.

pjeby commented 2 years ago

You might find it a better workflow to do something like:

  1. Set up a processing-specific workspace using the built-in workspaces plugin
  2. In that workspace, either set the search to path:My/Inbox/Folder or pin a note in one pane that has an embed of that search (or a similar dataview)

Now, when you want to process, just open that workspace and there's your files to be processed, and clicking on any item will open it in the first unpinned pane. When you move the item out of your folder, the search or dataview will update, with that item gone from it.

When you're done processing, flip back to your standard workspace, et voila.

To be fair, this process does require you to mouse-select your next file to work on, since search and dataview don't support keyboard selection. However, if you pin a note that's in the folder you want, you can keyboard back to that pane and then open quick explorer and you're in business. So three or so keystrokes rather than 1, but still 100% keyboard.

montemartin commented 2 years ago

My current keyboard driven strategy is already totally tolerable. This would only make it that much faster. I like the idea of using a workspace though.

pjeby commented 2 years ago

Well, since the URI thing isn't something you're interested, I'm going to go ahead and close this. My only other suggestion besides that and the workspace thing is that you make a QuickAdd or Templater macro/userscript to jump to the next available file in your inbox, then bind that to a hotkey. Or make an index file in your inbox, star it with the stars plugin, then use the hotkeys-for-stars plugin to define a hotkey to jump to that file. Or... well, there are lots of ways to handle it, but I don't think the idea of a default folder makes any sense -- the default folder is just the vault root.

montemartin commented 2 years ago

I am interested in the URI option. It would be far more flexible than what I was originally thinking of.

I've been testing the waters with both QuickAdd and Templater recently so I'll look into options for using them as well.

I wasn't aware of the hotkeys-for-stars plugin. It turns out the creator also made Hotkeys for specific files which doesn't quite solve my problem but is a good start and super useful in other contexts.

FelipeRearden commented 2 years ago

Hm. How about I add a URL action to open a specific folder? Then you can use the URI Commands plugin to set up as many specific-folder commands as you like.

Hello @pjeby and @montemartin !

Forgive @pjeby for step into this conversation.

I just wanna say that an URI action to open folder in QE is an amazing feature. It's the of feature that fits perfectly with QE !

If you don't mind, I just wanna add 2 suggestions to this feature:

01. Parameter for bottom

Would be amazing to have a parameter in the URI to define the focus of the selector when opening the folder.

I'm assuming that the default position is top

02. Variable for the Active Folder {{folder_-1}} {{folder_-2}} ...

I will try to explain with my poor English.

Imagine this folder structure for the note Guggenheim.md

Continent\North America\Country\USA\State\NY\City\New York\Museums\Guggenheim.md

Guggenheim.md is my ACTIVE NOTE

I want to "travel" between the folders of my active note

To go to the Museums folder I just hit QE: Browse to Current Folder

BUT With a {{variable}} we can create URI to quickly go to other folders related to the active note

Would be great to have a dynamic URI applied to the active note :)

Sorry for the long text !

Have a great day!

pjeby commented 2 years ago

It would probably simpler to just allow relative paths, i.e. . for current folder, .. for folder above, and so on.

As far as the bottom thing is concerned, I'm not really sure. The command I had in mind is effectively "explore this item", which means if you target a folder, the selected item would be the folder, in its parent folder, not a random position in the target folder. I'd need to add something like folder/ to mean "show the contents of the folder", in which case nothing would be selected and you could go either up or down or type something.

Also, I have noticed, since beginning to use the URI Commands plugin, that running commands is slow because they shell out to the OS and then send a message back to the current process. (There is a way to speed that up significantly but it requires using a currently-undocumented API in Obsidian.)

FelipeRearden commented 2 years ago

It would probably simpler to just allow relative paths, i.e. . for current folder, .. for folder above, and so on.

100% agree much easier to understand :)

As far as the bottom thing is concerned, I'm not really sure. The command I had in mind is effectively "explore this item", which means if you target a folder, the selected item would be the folder, in its parent folder, not a random position in the target folder. I'd need to add something like folder/ to mean "show the contents of the folder", in which case nothing would be selected and you could go either up or down or type something.

Would be amazing to have URI without bottom/top @pjeby !!!!

Whatever you decide to approach, I know that will be the best for the users and for QE :)

Also, I have noticed, since beginning to use the URI Commands plugin, that running commands is slow because they shell out to the OS and then send a message back to the current process. (There is a way to speed that up significantly but it requires using a currently-undocumented API in Obsidian.)

Good to know @pjeby !

In my specific case I use the plugin Shell Commands to run my URI (created using Advanced URI plugin) instead of URI Commands.

From my experience SC is fast and flawless :)

Thanks for your replying and for considering URI for QE !

Have a great day!

pjeby commented 2 years ago

Actually, it turns out I was incorrect about the performance issue: I was projecting due to the earlier comment by @montemartin, as I only just set up a URI command this weekend and then thought it was kind of slow to respond. But it turns out that it's actually the Obsidian hotkey settings page that's slow to load for some reason, as every other URI I've set up since then appears to run instantly.

FelipeRearden commented 2 years ago

Thanks for the info @pjeby !

When something behaves different from what we expect in Obsidian, we have so many variables to investigate to try to find a solution.

I'm glad to know that URI Command is working great!