| 33 | } |
| 34 | |
| 35 | export function toString(info: Info): string { |
| 36 | const parts: string[] = [] |
| 37 | |
| 38 | if (info.ctrl) parts.push("ctrl") |
| 39 | if (info.meta) parts.push("alt") |
| 40 | if (info.super) parts.push("super") |
| 41 | if (info.shift) parts.push("shift") |
| 42 | if (info.name) { |
| 43 | if (info.name === "delete") parts.push("del") |
| 44 | else if (info.name === "escape") parts.push("esc") |
| 45 | else parts.push(info.name) |
| 46 | } |
| 47 | |
| 48 | let result = parts.join("+") |
| 49 | |
| 50 | if (info.leader) { |
| 51 | result = result ? `<leader> ${result}` : `<leader>` |
| 52 | } |
| 53 | |
| 54 | return result |
| 55 | } |
| 56 | |
| 57 | export function parse(key: string): Info[] { |
| 58 | if (key === "none") return [] |