Shortcut to jump from search window or omnibar into note?
I vaguely remember this question or something similar having been asked before, but couldn't find the thread anymore: Is there a keyboard shortcut that will get me from the search window or the omnibar into the zettel again – and more specifically to the (first) search result within it?
Background: I'm trying to get a KM macro working that will jump to the first line of a zettel to add a tag and then bring the text cursor back to where it was. The idea was to insert a unique text string before jumping to the first line, then adding the tag, then jumping back to the unique text string via the search function. But I can't get the text cursor out of the search field...
Howdy, Stranger!
Comments
@Vinho I'd suggest if @ctietze doesn't have a built-in solution you might use the "Move or Click Mouse" action in Keyboard Maestro. Here is a short macro that starts on the OMNI Bar then moves into the editor window (line four in my case) inserts tag (you'll want more sophisticated code here), then the curser returns to the OMNI Bar.
Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
@Vinho When the focus is in the Omnibar and a note was matched (i.e. open in the editor),
tab
should bring you into the note. If you have the "Highlight search terms in the editor" option (Preferences > Editing) enabled, the focus should be at the first search term match automatically.(If you just enabled that preference and experiment with a test note, you might have to select a different note first and then try again with the test note because the editor needs to display something else first to truly clear the selection cache.)
Author at Zettelkasten.de • https://christiantietze.de/
Thanks @ctietze, works great. This should solve things for @Vinho. I had to deactivate my text replacement for the tab key. I can't rememeber why I had set the tab key in The Archive to
⌘]
. When the text replacement is active the tab key with focus in the OMNI bar only beeps at me.Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
@ctietze That sounds exactly like what I'm looking for, but it doesn't seem to work as you describe. When I press
tab
in the Omnibar, the cursor moves into the editor, but not to the search match. It seems to move to the position where I last edited the zettel, which in my macro would be the position where I inserted the tag...@Will Thanks for the suggestion, but it doesn't solve my problem because I want to get to exactly the position in the zettel where I edited before the tag was inserted. I thought about the action "Move or Click Mouse" with the option of restoring the cursor position to where it was, but that's unfortunately the mouse cursor, not the text cursor...
@Vinho To reset the cursor position from where you last edited to the first search term occurence, you have to visit another note first. If the note you edit is topmost, and there are 2+ search results, hit ⌘+L, ⌘+down_arrow, ⌘+up_arrow to select another note and go back to your search match. You'll see that the search term matches in the text now are highlighted again. (Once you begin to edit, the highlights will disappear.) When you tab into the editor, the text input cursor will select the first highlighted match.
If you want to automate this and cannot guarantee 2+ search results, perform the same search again. (
Esc
, then let KM type the search again for you.) That will auto-select the first highlight, too.Author at Zettelkasten.de • https://christiantietze.de/
@ctietze: I am searching for a unique string, so only get one search result. In that case, what you are describing doesn't always seem to work. Even with zettels that I haven't visited for a while
tab
will sometimes bring me to where I last edited, not to the search string... Sometimes, not always. Even if I perform the same search again as you suggested. Don't understand the differences in behaviour... But to be honest: If it is that fiddly and you even have to leave the zettel temporarily in order to get back to where you last edited, it doesn't really seem worth it. Will Scriptability make this easier?I guess I'll eventually catch the source of the inconsistency you describe. Text manipulation and restoring cursor positions is on my scriptability task list, but may not hit with the first release, because that, too, is rather fiddly and error-prone
Author at Zettelkasten.de • https://christiantietze.de/