Skip to content

Is a dynamic menu listing register contents possible? #280

Closed Answered by SecretPocketCat
SecretPocketCat asked this question in Q&A
Discussion options

You must be logged in to vote

I'm gonna answer myself a couple years later after coming back to Dance 😅.
Not sure whether it was possible back then, but now it's with a dance.run binding coupled with a code arg.
The following snippet dynamically creates a menu with an item for each homerow key (colemak), show's the content of each register and either yanks into the register or pastes from it:

  // yank to register menu
  {
    "key": "shift+y",
    "command": "dance.run",
    "args": {
      "code": [
        "const registers = 'arstneio';",
        "const items = {};",
        "for (register of registers) {",
        "   items[register] = { text: await Registers.value(register, 0), command: 'dance.selections.saveText…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SecretPocketCat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant