Tab to Autocomplete path parts in Quick Switcher and move file

Use case or problem

I like to create new files from within the Quick Switcher, so I can search for existing files on a topic then decide to create a new one if it isn’t there, as part of a single flow. If the search field contains the complete path of the new file I want to create, I can press shift-enter to create it.

When I decide to create a new file, I may want to create it in a nested sub-folder. As far as I can tell, the only way to do this from within the Quick Switcher is to manually type every character of the path. I would like the ability to auto-complete this path, so I can save typing and am less likely to misspell a path part.

This could also be an intuitive alternate way to select a search result: auto-complete to its final name, then press enter.

Notice that [[ completion in the editor already has completion behaviors similar to these. This feature request makes them available to Quick Switcher.

Proposed solution

With the Quick Switcher open, if the entire string in the search field matches the prefix of a path to a directory or file in the vault, when I press the tab key, Obsidian completes the path using canonical path completion rules similar to a Linux shell. If the prefix is unique to a path part up to a path delimiter (directory) or up to the end of the path (file; but not beyond the next path delimiter), complete the path part, including a trailing path delimiter (forward slash) in the case of a directory. If the prefix is shared by multiple path parts, complete only up to the first character that differs between the path parts.

For example, given a vault with these existing paths:

Journal/2022-02-28
Journal/2022-03-01
Journal/2022-03-02
Zettelkasten/Topics/Nature
Zettelkasten/Topics/Nuture
  • If the search field contains Jo and I press tab, it updates to: Journal/
  • If the search field contains Journal/ and I press tab, if updates to: Journal/2022-
  • If the search field contains Ze and I press tab, it updates to: Zettelkasten/
  • If the search field contains Zettelkasten and I press tab, it updates to: Zettelkasten/
  • If the search field contains Zettelkasten/ and I press tab, it updates to: Zettelkasten/Topics/
  • If the search field contains Zettelkasten/Topics/ and I press tab, it updates to: Zettelkasten/Topics/N
  • If the search field contains Zettelkasten/Topics/N and I press tab, nothing happens.
  • If the search field contains Zettelkasten/Topics/Q and I press tab, nothing happens.

Related polish: When Quick Switcher is displaying results, I can use up/down cursor keys to select a result. If I press the tab key with a result selected, Obsidian updates the search field text to be the path of the result, and the cursor returned to the end of the search field. This would allow me to choose an existing path that I have matched, delete the path suffix, enter a new suffix, and create a new file with a path prefix similar to the result.

For example, given the above vault paths, a search field containing Nat would have Zettelkasten/Topics/Nature as its sole result. If I press down to select it, then tab, the search field updates to Zettelkasten/Topics/Nature with the cursor at the end of the field.

Other considerations

I’m not sure I’ve described the [[ completion behavior precisely. It’s not clear whether Quick Switcher completion should use the exact behavior of [[ completion or if something slightly different is warranted for polish.

I don’t know if this feature would benefit from special handling of spaces in paths, such as with additional support for “quoted terms” in Quick Switcher. Without special support, completion would assemble valid paths and match existing files under those paths, but may also match other files via terms formed by spaces in the completed path. My guess is quoted terms can be a separate feature request, and would extend both matching logic and the way the path completer works (by adding quotes when introducing spaces via completion). It is not needed to fulfill this use case.

I can’t think of a use case for this where the entire search string isn’t a full path prefix, but just to explore this idea a bit: if my search field contains alpha beta Ome, there exists a top level Omega directory, and I press tab, perhaps I would expect this to complete to alpha beta Omega/. With support for quoted terms, if there exists a top level Omega Pi directory (and no other completions exist), it would complete to alpha beta "Omega Pi/", with the cursor to the left of the second ". This would not be useful for creating a new topic so I’m not sure this needs to be supported.

If anything, the non-path case should complete terms, not path parts: if Omega is a known word in file paths and there are no other completions, alpha beta Ome could complete to alpha beta Omega with a trailing space and without a trailing path delimiter. Only use path completion logic if the entire search field matches a path prefix. Term completion could be a separate feature request.

Current workaround

As far as I can tell, to create a topic from the Quick Switcher in a subdirectory, I must type the entire directory path. It’s possible that a search result with a similar path prefix is already being displayed, but I have to manually transcribe the path from the result.

52 Likes

I second this!

I love obsidian, and this is the ONLY thing that’s missing from perfection for me.

I’d love to create folders on the fly

2 Likes

bumping, it feels very strange that this isn’t implemented, i continue to try and hit tab to complete the path that i can see. thanks!

4 Likes

I second this, I have the same problem.

TAB feature is nice but I would be happy with even smaller change: I would like to have → arrow (next to ↑↓) which would copy the selected position from the list into the input field so I can alter the file name / extend the path to create the new one.

Bumping!
Is there any plugin that implements this?

I would love some functionality like this. I often create directories because of a typo.

I’ll keep this thread watched and post any workarounds I may encounter. Has anyone here found anything that is similar to the described experience OP mentions?

Use case or problem

I heavily use the quick switcher to create notes in folders and subfolders. To do this I type the entire path of the note I want to create and use Shift-Enter or Shift-Ctrl-Enter

Proposed solution

Since there are already suggestions for notes, make pressing Tab complete to the folder of the selected note.

Example

Suppose I have a folder “software” with a note “obsidian” in it. Now I want to create a note “software/linux”.

  1. Ctrl-O to open quick switcher
  2. type: soft
  3. it shows and selects software/obsidian
  4. press Tab
  5. the typed soft completes to software/
  6. it still shows and selects software/obsidian since it still matches
  7. type linux and press Shift-Enter (Enter would also do, if nothing matches)

This could also make it possible to filter while opening new files.

Current workaround (optional)

Type the entire path (correctly). If I mistype I get a new folder (which is a wanted feature in case I need a new directory)

8 Likes

Created my account just to put a like because this is such an important feature. Bump! (loving Obsidian to bits btw)

It’s a crucial feature, how can we help develop it?

2 Likes

I have been missing this feature since day one of my Obsidian journey. Please, please implement. :pray: :smile:

1 Like

This is a really important feature. Currently I have to keep my folder name abbreviated to use quick switcher to create file smoothly, but when I have 20+ abbreviated folders, it usually takes me a few secs to recall how a certain thing is abbreviated. Really painful.

This would be good enough for me, and seems easier to implement.

I made a quick work around here. LINK
It should exactly work like what you have talked about, but a ‘Tab’ version.

1 Like

I’m actually so happy right now that, I not just found a thread about exactly my problem, I found a post, that in the cleanest style expresses exactly how i want the problem to be solved. I even have a folder called “software”, :sob: i feel so understood.

Big fan. Ty.

1 Like

Hello, I find the way of creating files inside folders with the structure <folder>/<subfolder>/<file> very useful, but when I want to create a file in a specific folder (not necessary the same folder) I have to type the whole route or (if I have the option activated) navigate to the folder and then create it.

It would be nice to be able to create files in folder just typing the folder, selecting from the list and press tab to autocomplete the input with the route of the selected file, and then replace the name of the file used to autocomplete for the name of the new file.

What do you think? I think it can make the process easier and faster, don’t you?

I suggest a global setting that says “Show Folders in Autocomplete” as a solution. This setting should make folder names searchable, visually distinct and change the “Enter” behavior when selecting folders. Make it so that when you press Enter on a folder, the full folder path gets inserted and the cursor stays at the end of the path (instead of jumping to after the bracket). Demonstration:

Existing Path: Information / Notes / Podcasts / Huberman / Meditation.md

Expected output when selecting “Podcasts” and pressing Enter:
[[Information/Notes/Podcasts/%CURSOR%]]

Expected output when selecting “Meditation” and pressing Enter:
[[Meditation]]%CURSOR%

This does not reduce functionality and makes it easier to add folders and sort files on the go.

A Redditor has posted a partial workaround. Unfortunately, the workaround does not address if you want to CREATE a new folder in-line. Reddit - Dive into anything

1 Like

Just registered to THANK YOU A TON! :slight_smile: :heart:

This is exactly what I have been looking for as well. Would very much improve QoL using Obsidian since I use nested folders. Without this creating notes from the quick switcher is not useful at all, unfortunately.

1 Like

How do I upvote for this?

Press the heart under the main post.