Command palette plugin v1.0 , powerful context search bar, search under filter, etc


The [ mode should allow you search “filter” tiddlers, both there title and text fields. So you can give it a name to search. But I think what you want it to sort these tiddlers based on their “order” field. Some search mode respect this, I forget if I add this to the “fitler” mode, I can add one if there isn’t.

The support for filter mode is based on standard $:/tags/Filter tag, so if you have some useful filter to share, you can pack it as a plugin and allow other people install it. Me myself haven’t use “filter” mode in daily life, because I don’t have any useful filter to use.

No, my main point was that I’m not interested in searching predetermined filters at all: it’s easier for me to type the filter I want than to find it in a list. I think I am probably an outlier in this, and most users will appreciate easy access to the $:/tags/Filter filters—so I’m glad that you included them! But I do think my input should appear as the first result, not the last.

Let me try to better illustrate the issue:

  1. When I start typing (you can see I had to scroll down just to get my input value on screen.)

  2. When I add the first interior [, the filter search results disappear. This is perfect—it’s exactly what I’d expect.

  3. When I keep typing…


    My filter doesn’t match any of the presets, so it’s back at the bottom again.

I see, there can be a config for this config to show missing filter as first item · Issue #33 · tiddly-gittly/tw-command-palette · GitHub

But I suggest you add useful filter as a tiddler, and add $:/tags/Filter to it.

Thank you for adding the issue! I look forward to trying your plugin again when it’s resolved. :slight_smile:

The vast majority of my filter searches are spontaneous—things I need in the moment but may never need again. There wouldn’t be any value for me in creating new tagged filters; they’d just add more clutter to the list.

1 Like

Just wanted to say that this is a really nice update to the previous commandpalette plugin! Thanks!

1 Like

I add an option on latest update, toggle it and have a try!

1 Like

Perfect! Thank you for the quick update!

I’m sorry, I’m back with another bug: if you use the command palette to navigate to a tiddler while using a non-default page layout, the navigation event will switch your current layout to the default. I assume the problem is the following line in $:/plugins/linonetwo/commandpalette/widget/widget.js

t.context.noNavigate || ($tw.wiki.setText("$:/layout", "text", void 0, "", { suppressTimestamp: !0 }), this.dispatchEvent({ type: "tm-navigate", navigateTo: e, navigateFromNode: this })),

… but unfortunately I don’t know enough Javascript to fix it.

It is standard layout now Rename default layout to "Standard Layout" by linonetwo · Pull Request #8172 · Jermolene/TiddlyWiki5 · GitHub

Only it will have story flow. Other layouts are calendar, CPL, whiteboard, usually not have navigation. See Do you want your wiki to have 3-10 different layouts? So this is a feature. But maybe this navigation should left to layout to handle. How to navigate to a tiddler in default layout from a custom layout (when out of default layout widget tree) · Jermolene/TiddlyWiki5 · Discussion #8123 · GitHub

I really don’t think a search tool should be setting the layout with every navigation event, though. :confused: I know you use a lot of alternate layouts in the same wiki, but I’d imagine many other users (me included!) have one preferred layout and want to stick with it. It’s jarring and time-consuming to have to switch layouts every time I navigate to a different tiddler.

I figured out a hack-y solution that let me use the plugin, which was to modify this line

t.context.noNavigate || ($tw.wiki.setText("$:/layout", "text", void 0, "", { suppressTimestamp: !0 }), this.dispatchEvent({ type: "tm-navigate", navigateTo: e, navigateFromNode: this })),

to add the name of my preferred layout

t.context.noNavigate || ($tw.wiki.setText("$:/layout", "text", void 0, "$:/LAYOUT TIDDLER NAME", { suppressTimestamp: !0 }), this.dispatchEvent({ type: "tm-navigate", navigateTo: e, navigateFromNode: this })),

Which let me do enough testing in my main wiki to realize how much I missed the custom filter steps I’d added to @Souk21’s original to customize the order in which it returns results. Specifically, I’d added @clsturgeon’s rsort operator, so my search steps looked something like this:

{
    "steps": [
          {"filter": "[<query>!has[title]]", "queryTransformFilter": "", "hint": "missing"},
          {"filter": "[<query>has[title]]", "queryTransformFilter": "", "hint": "tiddler"},
          {"filter": "[!is[system]search:title<query>rsort<query>]", "queryTransformFilter": "", "hint": "in title"},
          {"filter": "[all[system]search:title<query>rsort<query>]", "queryTransformFilter": "", "hint": "in title (system)"},
          {"filter": "[all[shadows]search:title<query>rsort<query>]", "queryTransformFilter": "", "hint": "in title (shadow)"},
          {"filter": "[!is[system]search:text<query>]", "queryTransformFilter": "", "hint": "text"},
          {"filter": "[all[system]search:text<query>]", "queryTransformFilter": "", "hint": "text (system)"},
          {"filter": "[all[shadows]search:text<query>]", "queryTransformFilter": "", "hint": "text (shadow)"}
    ]
}

I’d gotten used to getting the most relevant results at the top, and I’m not sure I can handle going back to alphabetical sort. :frowning: Disappointing, because your command palette is so much faster! But if it doesn’t have the features that the original did, and I can’t easily modify it with pure TW syntax, I think I’ll have to stick with the original.

What layout that supports navigation are you using? Hope it follows the For Layout Developers part.

I just update the plugin, let layout itself to handle the navigation to standard layout. So the behavior will depend on the layout you are using, will not force back to standard layout now.

Since you added some custom filters,

I’m using a version of @Brian_Radspinner’s Be Rad that I’ve modified heavily over the last year+. I have no idea whether it meets the current best practices for navigation, but I’ve never had any issues with the original CP (or with any other plugin).

I’m sorry, I wasn’t clear enough. The code snippet I shared above is not just a search filter; it corresponds to the tiddler $:/plugins/souk21/commandpalette/CommandPaletteSearchSteps in the fork of the original CP that I’ve been using for over a year. Each of these filters gets applied with every text search, and all the results are shown at once. This lets me customize the way normal text search results are sorted and displayed, as @vilc demonstrated in his earlier post.

I see, this is missing, and it is easy to add (new version is much easier to add new feature). I’m playing with AI plugin and some core PR, so I don’t have time for this, but PR is welcome.

How does searching system tiddlers work? I checked the “search system tiddler title” option in the config but now: if I search some part of the title, it doesn’t find a system tiddler (note: the tiddler is not a shadow or shadowed). and if I search by starting with ‘$:/’ then the list of system tiddlers is not filtered according to my search term.