{"action":"created","issue":{"url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/169","repository_url":"https://api.github.com/repos/jackhumbert/qmk_firmware","labels_url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/169/comments","events_url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/169/events","html_url":"https://github.com/jackhumbert/qmk_firmware/issues/169","id":137946846,"number":169,"title":"Implementing a leader key (Vim style)","user":{"login":"ezuk","id":1092548,"avatar_url":"https://avatars.githubusercontent.com/u/1092548?v=3","gravatar_id":"","url":"https://api.github.com/users/ezuk","html_url":"https://github.com/ezuk","followers_url":"https://api.github.com/users/ezuk/followers","following_url":"https://api.github.com/users/ezuk/following{/other_user}","gists_url":"https://api.github.com/users/ezuk/gists{/gist_id}","starred_url":"https://api.github.com/users/ezuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezuk/subscriptions","organizations_url":"https://api.github.com/users/ezuk/orgs","repos_url":"https://api.github.com/users/ezuk/repos","events_url":"https://api.github.com/users/ezuk/events{/privacy}","received_events_url":"https://api.github.com/users/ezuk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jackhumbert/qmk_firmware/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"jackhumbert","id":141431,"avatar_url":"https://avatars.githubusercontent.com/u/141431?v=3","gravatar_id":"","url":"https://api.github.com/users/jackhumbert","html_url":"https://github.com/jackhumbert","followers_url":"https://api.github.com/users/jackhumbert/followers","following_url":"https://api.github.com/users/jackhumbert/following{/other_user}","gists_url":"https://api.github.com/users/jackhumbert/gists{/gist_id}","starred_url":"https://api.github.com/users/jackhumbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackhumbert/subscriptions","organizations_url":"https://api.github.com/users/jackhumbert/orgs","repos_url":"https://api.github.com/users/jackhumbert/repos","events_url":"https://api.github.com/users/jackhumbert/events{/privacy}","received_events_url":"https://api.github.com/users/jackhumbert/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2016-03-02T18:00:51Z","updated_at":"2016-05-17T00:39:08Z","closed_at":"2016-05-17T00:39:08Z","body":"Another brainstorming session with @jackhumbert.\r\n\r\nThe idea would be to pick a modifier key, and have it double as a \"leader\", just like the Vim leader.\r\n\r\nLet's say I pick Ctrl. When held down, it's a Ctrl. But when tapped, and then followed in rapid succession by a number of other keys, that registers as leader + those keys.\r\n\r\nSo the algorithm would be:\r\n\r\n1. Tap the leader\r\n2. A timer starts (say, 600ms by default?)\r\n3. Anything I tap during this time is _not_ sent as a keystroke to the computer, but is saved in memory (so let's say \"wc\" is what I type)\r\n4. There's a `LEADER` lookup table. At the end of the timer, we go and look through that table for the substring I typed in (`wc`) and execute the macro that follows it.\r\n\r\nSo you could have `<leader>wc` to close the current window, `<leader>wm` to maximize it, etc. Or with media keys: `<leader>ms` (media stop) `<leader>mp` (media play) etc.\r\n\r\nYou could have multiple leader keys and multiple dictionaries.\r\n\r\nAnd then in the keymap, what this would look like is just as `LK0_LCTL` for one of the keys. This would make it work as Leader when tapped, and LCTRL when held. And then if you wanted, you can also have `LK1_NO` for example, which would make the key work as _just_ a leader when tapped, and have no hold action. This leader would point to the second subhash in dictionary. And somewhere in the file a data structure that looks something like:\r\n\r\n```\r\nLEADER_DICTIONARY = [ \r\n  LK0 = [ \r\n    wc: LALT(F4),\r\n    wm: LALT(F5),\r\n  ],\r\n  LK1 = [\r\n    e8b: cmk(\":8ball:\"), // cmk would be a function that transforms 8ball into Colemak-in-software mappings (if that makes sense) for people who have Colemak\r\n    etu: \":+1:\", // send these strings out, so I get \"emoji leader sequences\"\r\n  ]\r\n];\r\n```\r\n\r\nThis particular feature, though, only encompasses the idea of the leader key and multiple dictionaries.\r\n\r\nSending out strings from the dictionary, and the `cmk()` string transformation function, are out of scope for this -- just ideas for later maybe."},"comment":{"url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/comments/219589160","html_url":"https://github.com/jackhumbert/qmk_firmware/issues/169#issuecomment-219589160","issue_url":"https://api.github.com/repos/jackhumbert/qmk_firmware/issues/169","id":219589160,"user":{"login":"jackhumbert","id":141431,"avatar_url":"https://avatars.githubusercontent.com/u/141431?v=3","gravatar_id":"","url":"https://api.github.com/users/jackhumbert","html_url":"https://github.com/jackhumbert","followers_url":"https://api.github.com/users/jackhumbert/followers","following_url":"https://api.github.com/users/jackhumbert/following{/other_user}","gists_url":"https://api.github.com/users/jackhumbert/gists{/gist_id}","starred_url":"https://api.github.com/users/jackhumbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackhumbert/subscriptions","organizations_url":"https://api.github.com/users/jackhumbert/orgs","repos_url":"https://api.github.com/users/jackhumbert/repos","events_url":"https://api.github.com/users/jackhumbert/events{/privacy}","received_events_url":"https://api.github.com/users/jackhumbert/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T00:39:08Z","updated_at":"2016-05-17T00:39:08Z","body":"This has been merged into the base - we have some more ideas to implement (and docs to write), but I think we can close this for now."}}