Select text + shortcut to mark backlink

I use AutoHotkey to produce “[[” by single left-hand keypress. I write numbers by different method so I do not miss previous functionality.

KEYBOARD LAYOUT ILLUSTRATION:
Virtual key code on the left. 
Output on the right. 
╔════╗ ╔════╦════╦════╦════╗ 
║1B  ║ ║70  ║71  ║72  ║73  ║ 
╠════╩╦╩════╬════╩╦═══╩═╦══╩═
║C0  `║31 [[║32  2║33  3║34  
╠═════╩══╦══╩══╦══╩══╦══╩══╦═
║09   Tab║51  q║57  w║45  e║5
╠════════╩╦════╩╦════╩╦════╩╦
║14 CapsLk║41  a║53  s║44  d║
╠═════════╩══╦══╩══╦══╩══╦══╩

However it produces “[[” regardless of (not)having selected text.
I do not know if VIM mode takes into account if text is selected or not.

Here is AutoHotkey code:

; CREATE WIKILINK
#IfWinActive ahk_exe Obsidian.exe
vk31:: ; !/1 hotkey
  Send, {[ 2} 
    ; Double opening square bracket by left hand while right hand controls cursor. 
    ; useful for linking in Obsidian. 
    ; purpose: right hand selects text, left hand presses the key, Obsidian encloses selected text in square brackets. 
  return
#IfWinActive ; end restriction to ahk_exe Obsidian.exe

Proposed solution:

It would certainly be better to have native Obsidian customizable hotkey that would take into account if text is selected or not.
Now there is hotkey “Insert link” (default Ctrl+K) which produces markdown-style link and adjusts behavior depending on existence of text selection.
There could be similar version for creation of wikilinks.

Related feature requests:

It would be more efficient with:


@Steve_yang By the way, the title of this request is misleading. I would suggest to change it e.g. to “Select text + customizable hotkey to create wikilink”.
Similarly in body of original post, replace “backlink” → “link” since this request is obviously only about forward links, not backlinks.

1 Like