Shortcut to create block at the bottom of page

Just a simple shortcut to create a new block on bottom of the current page.

Might be duplicate of Add shortcut to go to the last block on the page

This would be lovely to have.

I always go to the journals page with a shortcut and then I have to move via arrow keys to actually start typing. IT’S SO FRUSTRATING. I just want to press a shortcut and immediately start typing a new entry on the today’s page :sob:

Would you be interested in a custom.js workaround? If so, which combination of keys would you like to use?

The perfect thing for me would actually be a combined shortcut that opens journals (daily mode) /and/ immediately starts a new block in typing mode. And yeah, I would appreciate any workaround :heart:

Right now I use Cmd+J as the “go to journal” shortcut, but I have JS experience so I suppose I would be able to customize the shortcut if necessary

To append a block at the end of the current page, try something like this:

document.addEventListener("keydown", (e)=>{
    if (e.ctrlKey && e.key === "n") {
        e.stopPropagation()
        const page = logseq.api.get_current_page()
        if (page) {
            logseq.api.insert_block(page.name, "")
        } else {
            document.querySelector(".add-button-link").dispatchEvent(new MouseEvent("click", {
                bubbles: true,
                cancelable: true
            }))
        }
    }
});

Thanks!

Is logseq.api documented anywhere? This works for “append to the current page” but I want to go to the journals first and I can’t figure out how to do it.

  • I thought that you went to journals through Cmd + J
  • The API is partially documented here

I wanted to have a single shortcut that would go to the journals /and/ start typing.

But now it seems that actually having two shortcuts (Cmd+J Cmd+O in my case, “O” because vim) is fine. Feels very natural. Thanks!