38 lines · 1.1 KB · TypeScript
RawDownload
/** * Keyboard utility functions for platform-aware shortcuts */ /** * Detect if running on macOS */export function isMacOS(): boolean {  return navigator.userAgent.toLowerCase().includes('mac');} /** * Get the primary modifier key name for the current platform * @returns 'Cmd' on macOS, 'Ctrl' on other platforms */export function getModifierKeyName(): string {  return isMacOS() ? 'Cmd' : 'Ctrl';} /** * Get the primary modifier key symbol for the current platform * @returns '⌘' on macOS, 'Ctrl' on other platforms */export function getModifierKeySymbol(): string {  return isMacOS() ? '⌘' : 'Ctrl';} /** * Format a keyboard shortcut for display * @param key - The key to press (e.g., 'K', 'G', 'Enter') * @param useSymbol - Whether to use symbols (⌘) or text (Cmd) * @returns Formatted shortcut string (e.g., '⌘K' or 'Ctrl+K') */export function formatModifierShortcut(key: string, useSymbol = true): string {  const modifier = useSymbol ? getModifierKeySymbol() : getModifierKeyName();  const separator = useSymbol && isMacOS() ? '' : '+';  return `${modifier}${separator}${key}`;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t