obsidian-editor-shortcuts icon indicating copy to clipboard operation
obsidian-editor-shortcuts copied to clipboard

Support certain commands in preview mode

Open wenlzhang opened this issue 3 years ago • 7 comments

It would be great if certain commands can work in preview mode/reading view, e.g. Go to previous/next heading.

wenlzhang avatar Jan 13 '22 12:01 wenlzhang

I'm not sure how this would work, since there's no cursor or selection to use as a starting point?

timhor avatar Jan 14 '22 11:01 timhor

there's no cursor or selection to use as a starting point?

This indeed can be an issue. How about always make the first or last header as the staring point then?

wenlzhang avatar Jan 14 '22 12:01 wenlzhang

Well, by 'starting point' I'm essentially referring to an anchor from which you would search for the next or previous heading. For example, if your cursor was on line 3, character 5 in edit mode, the command to Go to next heading would look for the next heading after that exact position. If you don't have a corresponding anchor in preview mode and instead always assign it to search from the first or last heading, it's not ideal for navigating between headings since you'd need to step through every single one.

timhor avatar Jan 14 '22 12:01 timhor

If your use case is simply to jump between various headings while reading, I'd suggest using the Outline plugin (you'll find it under Core plugins). That will display a list of headings in the current file which allows you to click to jump to a particular heading.

timhor avatar Jan 14 '22 12:01 timhor

That will display a list of headings in the current file which allows you to click to jump to a particular heading.

Thanks for the suggestion. However, with the outline plugin, one needs to use it to navigate among headings by clicking them in the side pane? Is it possible to navigate among headings by using hotkeys, without needing to open the side pane?

wenlzhang avatar Jan 14 '22 13:01 wenlzhang

Ah, Outline doesn't support hotkeys as far as I'm aware. I just had a quick search though and found Quick Switcher++, which can be mapped to a hotkey. See if that works for you instead.

I can experiment with your original request at some point, but it'll be a while before I have the time to do that. I've tracked it here in the meantime: https://github.com/timhor/obsidian-editor-shortcuts/projects/1#card-76194970

timhor avatar Jan 17 '22 11:01 timhor

I just had a quick search though and found Quick Switcher++, which can be mapped to a hotkey. See if that works for you instead.

Thanks for the help!

wenlzhang avatar Jan 17 '22 12:01 wenlzhang