Skip to content

Is there an easier way to make mappings with modifiers? #475

Answered by rosshadden
rosshadden asked this question in Q&A
Discussion options

You must be logged in to vote

What if we were to add a fork variant that accepted an arbitrary number of branches?
Think of fork as if and multi-fork (or whatever) as a switch.

(fork-multi-or-whatever
  (cmd nu -c "~/bin/screenshot select")
  (lctl rctl) (cmd nu -c "~/bin/screenshot full")
  (lalt ralt) (cmd nu -c "~/bin/screenshot window")
  (lsft rsft) (cmd nu -c "~/bin/screenshot screen")
)

Maybe some token should be used for the first branch too, like a _ or XX or some other nil kind of placeholder, to make all arguments pairs for parsing reasons.

Or fork itself could be changed to accept more pair arguments.

(fork
  (cmd nu -c "~/bin/screenshot select")
  (cmd nu -c "~/bin/screenshot full") (lctl rctl)
  (cmd nu…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@jtroo
Comment options

Comment options

You must be logged in to vote
5 replies
@jtroo
Comment options

@rosshadden
Comment options

@jtroo
Comment options

@rosshadden
Comment options

@rosshadden
Comment options

Answer selected by rosshadden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants