formatHotkey
formatHotkey(
hotkey,separator):string
Defined in: extensions/commands/format.ts:53
Utility that formats a hotkey to display in a user interface. Modifier keys use symbols on Mac and labels otherwise.
Parameters
Section titled “Parameters”hotkey
Section titled “hotkey”string
Hotkey to format for display.
separator
Section titled “separator”string = ...
String to join the segments together with. Defaults to " " on Mac
and "+" otherwise.
Returns
Section titled “Returns”string
Formatted key for display.
Example
Section titled “Example”// On MacformatHotkey("mod+s") // "⌘ S"formatHotkey("12+escape") // "⇧ ⌘ Esc"formatHotkey("arrowup") // "↑"
// On Windows/LinuxformatHotkey("mod+s") // "Ctrl+S"formatHotkey("12+escape") // "Shift+Win+Esc"formatHotkey("arrowup") // "↑"