QMK "KC_LEAD" Users

What do you use for your leader key?

Good question! I use my leader key for a few operations I regularly use, but that would normally require three keys in a chord. I work in Linux, using i3wm as a window manager and tmux as a terminal multiplexer. Most of my leader maps are shortcuts for those environments. Here are a few I use regularly:

  • <leader>b -> CTRL-B, L -> switches to the last used tmux window
  • <leader>c -> CTRL-SHIFT-C -> Copy to clipboard
  • <leader>v -> CTRL-SHIFT-V -> Paste from clipboard
  • <leader>q -> GUI-SHIFT-Q -> close current window in i3wm
  • <leader>e -> GUI-SHIFT-E -> exit i3wm

Those are my most regularly used leader macros. Would love to hear what others are doing with theirs!

Thanks for the input @jmdaly. Linux and Vim user here and dabbled a little with both i3 and Tmux. Right now (experimenting) I think it’s going to be the ,< key for my leader and then I type the comma and greater than symbol from a layer with Tap Dance.

Here’s what I’m trying so far with the leader. Can’t stand to type parens etc.
<leader>t -> close chrome tab
<leader>p -> ()
<leader>b -> {}
<leader>k -> []
<leader>dd -> “when in a field” select all and backspace to clear field

What key do you have assigned as your leader?

So what’s the difference between a one shot layer and a leader key anyways?

I’m not well versed in one shot layers.

Leader Key lets the user assign up to 5 keystrokes as an identifier to what they want to happen.

For example you could assign <leader>close to close an app, tab etc. That command isn’t assigned to a particular key. It’s dependent on access to the leader key and the keystrokes that make up the identifier. As long as you can tap the leader, you can trigger your actions.

For example in my system <leader>t (simple one key activation) closes a browser tab. <leader>dd selects all text in a field and backspaces clearing the field.

The timing resets after each key press, if that feature is set within QMK. If per key timing was set to 500, the dd example above would provide 500ms of time before the letter d would need to by typed. After typing the first d, another 500ms of time would be available before needing to type the second d. If the sequence times out before the complete identifier is typed, nothing happens.

Per key timing really opens up a whole range of easy to remember triggers.

1 Like

I like the bracket mapping! Really cool idea. I’ve got used to space cadet shift for my parenthesis (tap left shift for ‘(’, tap right shift for ‘)’). But I like the leader idea for all the diferent brackets!

I have my leader key set to be the key immediately to the right of my spacebar. And, in vim, I use spacebar as my leader. How do you have leader mapped?

My Vim leader is also spacebar and I’m “trying” the ,< next to M for my QMK leader. I’ve always been horrible at touch typing CTL or ALT keys making them a poor choice for me for the QMK leader.

Are you familiar with QMK Combos? It appears to provide similar functionality to Leader Key without the need for the leader. I’m trying to get it to work so right now everything I know is from reading the docs on the QMK Combo page.

Combo is typicaly used with keys activated together - not a sequence of keys. I have tried using combos on my Gherkin mapping o+p combo to backspace - works great.

Well that explains a lot. When reading the docs I missed this key sentence, “It lets you hit multiple keys at once and produce a different effect.”.

I confess to looking around the docs looking for the per key term setting which the feature Leader Key has.

Thank you @BXO511 for clarifying and the tip on backspacing.

I use the leader key quite a lot, but I don’t like how the leader key itself times out. I hacked it to have an infinite amount of time for the leader key but the normal timeout for the rest of the sequence. This fixes my problems, but I’m curious to know if other users if the leader key will find it useful or not to push the PR a bit further

I’m not sure what you mean by “PR a bit further”. Leader Key has two timing settings that I know of. #define LEADER_PER_KEY_TIMING and #define LEADER_TIMEOUT, both set in config.h. When the per-key feature is set (optional), every key tap beginning with the leader itself resets the remaining time to whatever the timeout is set to. Mine is set to 500 because I felt like anything shorter made me rush. My understanding is that if I have a 3 character trigger plus original leader, I have 2 seconds (500 timeout setting) to complete the sequence before timing out.

Sorry for my lack of clarity. PR means pull request. I’ve open a pull request to QMK to add a new feature to the leader key, but that PR is a bit cold right now, without much comments from the QMK team. If the feature could be useful for other leader key users then I will try make QMK team to accept my pull request.
What the feature does is ignore the timeout for the leader key itself, and the rest behaves equally. So I’m your case you will have an infinite amount of time after pressing the leader key and 1.5 seconds to complete the rest of the sequence. Something like a mix between one shot layers and leader key.
What I want to know if other leader key users find this behavior useful or not.
Regards

To me that sounds like a great idea. The leader key could even be on another layer but the leader time kept small. How did you work around the leader key timeout?

I see, I didn’t know that leader keys allow more keystrokes. One shot layers are more akin to sticky keys. I have one set up that allows me to hit F-keys without having to hold down the layer switch key.

I’ve just started to look at oneshot layers and that seems to be a better, cleaner more sensible approach for my needs than combos. Something I’ve realized over the last week is QMK has multiple ways to complete similar actions.

What are sticky keys? I’ve seen those referenced in the docs but no details.

“Sticky keys” are implemented as One Shot Keys in QMK
https://beta.docs.qmk.fm/features/feature_advanced_keycodes#one-shot-keys

Sticky keys aren’t just a qmk thing: https://en.wikipedia.org/wiki/Sticky_keys

Well, if you are interested on the technical details, here is the PR: https://github.com/qmk/qmk_firmware/pull/6580

Basically I have edited the leader key feature to ignore the timeout if the sequence is empty, and only starts to count when the sequence is at least one.

Well, I use both and I see room for both. One shot layers are nice, sure, but the leader key allows for more complex interactions/more macros with less keys. Just to put an example, using just one key, on one shot layers you can only create one macro, for that key, using leader key you can create upt to 5 macros with just one key, depending on the number of times you hit that key. Not to mention that is much easier to remember that you hit leader->p->g for ps -ef | grep than to hit layer then the 5th key on the third row.

1 Like

Thank you for the perspective. Been so focused on QMK for specific project, hadn’t considered for use with terminal. My biggest issue with leader is lack of good leader key. Need custom board with split space bar.

Which do you use more often? Oneshot layers, oneshot keys or combos?