Create Headline Link Keyboard Shortcut

What I’m trying to do

I’m working on a project to archive some interactive fiction games from old magazine scans. Is there a way to set a keyboard shotcut so that when I highlight the 88 in “go to 88” the shortcut creates a headline link within the document - [[#88]] - as currently I’m stuck typing the hash every time and then creating a link with the keyboard shortcut.

Things I have tried

I’ve checked the defaul hotkeys and searched for a custom shortcut option in the plugin library but no joy (AFAICS)

You are trying to land at heading 88

I’m trying to setup a keyboard shortcut to automatically create a link to hadline within the note, rather than another note.

In this example that’s 88, but could be any bit of text of number.

Numeric block ids are not usually allowed (see HTML - The id attribute). You want to create an inline template and set a keyboard shortcut to it—in this case producing this text: [[#. You can do this using Templater community plugin.

If the text is selected before you hit the key combo, you can make the entire link using a Template template assigned to a hotkey.

That just overrides the selected text?

This is correct. The syntax is this:

[[#<cursor is here>|the display text for the link you want to create]]

The beautiful thing is that when you cursor is there, Obsidian will display interactive suggestions. I haven’t tested that template but I believe it should work fine.

Maybe I’m doing it wrong, but that overwrites the highlighted text?

The easiest version would be to have a template like:

[[#<% tp.file.selection() %>]]

Assign this template to a hotkey from Settings > Templater. Now when you select the header text, it’ll insert the brackets around your selection. Do note this require a full header to be selected for the link to work.

1 Like


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.