Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
parent
d10350cd2c
commit
bbf7a20b33
77 changed files with 2439 additions and 1950 deletions
|
|
@ -1,165 +1,297 @@
|
|||
# The Leader Key: A New Kind of Modifier
|
||||
# The Leader Key: A New Kind of Modifier :id=the-leader-key
|
||||
|
||||
If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen.
|
||||
If you're a Vim user, you probably know what a Leader key is. In contrast to [Combos](feature_combo.md), the Leader key allows you to hit a *sequence* of up to five keys instead, which triggers some custom functionality once complete.
|
||||
|
||||
That's what `QK_LEAD` does. Here's an example:
|
||||
## Usage :id=usage
|
||||
|
||||
1. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `QK_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else.
|
||||
2. Include the line `#define LEADER_TIMEOUT 300` in your `config.h`. This sets the timeout for the `QK_LEAD` key. Specifically, when you press the `QK_LEAD` key, you only have a certain amount of time to complete the Leader Key sequence. The `300` here sets that to 300ms, and you can increase this value to give you more time to hit the sequence. But any keys pressed during this timeout are intercepted and not sent, so you may want to keep this value low.
|
||||
* By default, this timeout is how long after pressing `QK_LEAD` to complete your entire sequence. This may be very low for some people. So you may want to increase this timeout. Optionally, you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped. This allows you to maintain a low value here, but still be able to use the longer sequences. To enable this option, add `#define LEADER_PER_KEY_TIMING` to your `config.h`.
|
||||
3. Within your `matrix_scan_user` function, add something like this:
|
||||
|
||||
```c
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
As you can see, you have a few functions. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_KEYS` for longer sequences.
|
||||
|
||||
Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
|
||||
|
||||
## Adding Leader Key Support
|
||||
|
||||
To enable Leader Key, add the following line to your keymap's `rules.mk`:
|
||||
Add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
LEADER_ENABLE = yes
|
||||
```
|
||||
|
||||
Place the following macro in your `keymap.c` or user space source file, before any functional code. It handles declaration of external variables that will be referenced by Leader Key codes that follows:
|
||||
Then add the `QK_LEAD` keycode to your keymap.
|
||||
|
||||
## Callbacks :id=callbacks
|
||||
|
||||
These callbacks are invoked when the leader sequence begins and ends. In the latter you can implement your custom functionality based on the contents of the sequence buffer.
|
||||
|
||||
```c
|
||||
LEADER_EXTERNS();
|
||||
void leader_start_user(void) {
|
||||
// Do something when the leader key is pressed
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
// Leader, f => Types the below string
|
||||
SEND_STRING("QMK is awesome.");
|
||||
} else if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
// Leader, d, d => Ctrl+A, Ctrl+C
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
} else if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
||||
// Leader, d, d, s => Types the below string
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
} else if (leader_sequence_two_keys(KC_A, KC_S)) {
|
||||
// Leader, a, s => GUI+S
|
||||
tap_code16(LGUI(KC_S));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Per Key Timing on Leader keys
|
||||
## Basic Configuration :id=basic-configuration
|
||||
|
||||
Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200wpm typing skills, we can enable per key timing to ensure that each key pressed provides us with more time to finish our stroke. This is incredibly helpful with leader key emulation of tap dance (read: multiple taps of the same key like C, C, C).
|
||||
### Timeout :id=timeout
|
||||
|
||||
This is the amount of time you have to complete a sequence once the leader key has been pressed. The default value is 300 milliseconds, but you can change this by adding the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define LEADER_TIMEOUT 350
|
||||
```
|
||||
|
||||
### Per-Key Timeout :id=per-key-timeout
|
||||
|
||||
Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200 wpm typing skills, you can enable per-key timing to ensure that each key pressed provides you with more time to finish the sequence. This is incredibly helpful with leader key emulation of tap dance (such as multiple taps of the same key like C, C, C).
|
||||
|
||||
To enable this, add the following to your `config.h`:
|
||||
|
||||
In order to enable this, place this in your `config.h`:
|
||||
```c
|
||||
#define LEADER_PER_KEY_TIMING
|
||||
```
|
||||
|
||||
After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms.
|
||||
After this, it's recommended that you lower your timeout below 300 ms:
|
||||
|
||||
```c
|
||||
#define LEADER_TIMEOUT 250
|
||||
```
|
||||
|
||||
Now, something like this won't seem impossible to do without a 1000MS leader key timeout:
|
||||
Now, something like this won't seem impossible to do without a 1000 millisecond timeout:
|
||||
|
||||
```c
|
||||
SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
|
||||
SEND_STRING("Per key timing is great!!!");
|
||||
if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
|
||||
SEND_STRING("Per key timing is great!!!");
|
||||
}
|
||||
```
|
||||
|
||||
## Infinite Leader key timeout
|
||||
### Disabling Initial Timeout :id=disabling-initial-timeout
|
||||
|
||||
Sometimes your leader key is not on a comfortable place as the rest of keys on your sequence. Imagine that your leader key is one of your outer top right keys, you may need to reposition your hand just to reach your leader key.
|
||||
This can make typing the entire sequence on time hard even if you are able to type most of the sequence fast. For example, if your sequence is `Leader + asd` typing `asd` fast is very easy once you have your hands in your home row. However starting the sequence in time after moving your hand out of the home row to reach the leader key and back is not.
|
||||
To remove the stress this situation produces to your hands you can enable an infinite timeout just for the leader key. This means that after you hit the leader key you will have an infinite amount of time to start the rest of the sequence, allowing you to proper position your hands on the best position to type the rest of the sequence comfortably.
|
||||
This infinite timeout only affects the leader key, so in our previous example of `Leader + asd` you will have an infinite amount of time between `Leader` and `a`, but once you start the sequence the timeout you have configured (global or per key) will work normally.
|
||||
This way you can configure a very short `LEADER_TIMEOUT` but still have plenty of time to position your hands.
|
||||
Sometimes your leader key may be too far away from the rest of the keys in the sequence. Imagine that your leader key is one of your outer top right keys - you may need to reposition your hand just to reach your leader key. This can make typing the entire sequence on time hard difficult if you are able to type most of the sequence fast. For example, if your sequence is `Leader + asd`, typing `asd` fast is very easy once you have your hands in your home row, but starting the sequence in time after moving your hand out of the home row to reach the leader key and back is not.
|
||||
|
||||
To remove the stress this situation produces to your hands, you can disable the timeout just for the leader key. Add the following to your `config.h`:
|
||||
|
||||
In order to enable this, place this in your `config.h`:
|
||||
```c
|
||||
#define LEADER_NO_TIMEOUT
|
||||
```
|
||||
|
||||
## Strict Key Processing
|
||||
Now, after you hit the leader key, you will have an infinite amount of time to start the rest of the sequence, allowing you to properly position your hands to type the rest of the sequence comfortably. This way you can configure a very short `LEADER_TIMEOUT`, but still have plenty of time to position your hands.
|
||||
|
||||
By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](mod_tap.md) and [`Layer Tap`](feature_layers.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users.
|
||||
### Strict Key Processing :id=strict-key-processing
|
||||
|
||||
While, this may be fine for most, if you want to specify the whole keycode (eg, `LT(3, KC_A)` from the example above) in the sequence, you can enable this by adding `#define LEADER_KEY_STRICT_KEY_PROCESSING` to your `config.h` file. This will then disable the filtering, and you'll need to specify the whole keycode.
|
||||
By default, only the "tap keycode" portions of [Mod-Taps](mod_tap.md) and [Layer Taps](feature_layers.md#switching-and-toggling-layers) are added to the sequence buffer. This means if you press eg. `LT(3, KC_A)` as part of a sequence, `KC_A` will be added to the buffer, rather than the entire `LT(3, KC_A)` keycode.
|
||||
|
||||
## Customization
|
||||
This gives a more expected behaviour for most users, however you may want to change this.
|
||||
|
||||
The Leader Key feature has some additional customization to how the Leader Key feature works. It has two functions that can be called at certain parts of the process. Namely `leader_start_user()` and `leader_end_user()`.
|
||||
|
||||
The `leader_start_user()` function is called when you tap the `QK_LEAD` key, and the `leader_end_user()` function is called when either the leader sequence is completed, or the leader timeout is hit.
|
||||
|
||||
You can add these functions to your code (`keymap.c` usually) to add feedback to the Leader sequences (such as beeping or playing music).
|
||||
To enable this, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
```
|
||||
|
||||
## Example :id=example
|
||||
|
||||
This example will play the Mario "One Up" sound when you hit `QK_LEAD` to start the leader sequence. When the sequence ends, it will play "All Star" if it completes successfully or "Rick Roll" you if it fails (in other words, no sequence matched).
|
||||
|
||||
```c
|
||||
#ifdef AUDIO_ENABLE
|
||||
float leader_start_song[][2] = SONG(ONE_UP_SOUND);
|
||||
float leader_succeed_song[][2] = SONG(ALL_STAR);
|
||||
float leader_fail_song[][2] = SONG(RICK_ROLL);
|
||||
#endif
|
||||
|
||||
void leader_start_user(void) {
|
||||
// sequence started
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_start_song);
|
||||
#endif
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
// sequence ended (no success/failure detection)
|
||||
}
|
||||
```
|
||||
bool did_leader_succeed = false;
|
||||
|
||||
### Example
|
||||
|
||||
This example will play the Mario "One Up" sound when you hit `QK_LEAD` to start the Leader Sequence, and will play "All Star" if it completes successfully or "Rick Roll" you if it fails.
|
||||
|
||||
```c
|
||||
bool did_leader_succeed;
|
||||
#ifdef AUDIO_ENABLE
|
||||
float leader_start[][2] = SONG(ONE_UP_SOUND );
|
||||
float leader_succeed[][2] = SONG(ALL_STAR);
|
||||
float leader_fail[][2] = SONG(RICK_ROLL);
|
||||
#endif
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
did_leader_succeed = leading = false;
|
||||
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("t")));
|
||||
did_leader_succeed = true;
|
||||
} else
|
||||
SEQ_TWO_KEYS(KC_E, KC_D) {
|
||||
SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
|
||||
did_leader_succeed = true;
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("t")));
|
||||
did_leader_succeed = true;
|
||||
} else if (leader_sequence_two_keys(KC_E, KC_D)) {
|
||||
SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
leader_end();
|
||||
}
|
||||
}
|
||||
|
||||
void leader_start_user(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_start);
|
||||
if (did_leader_succeed) {
|
||||
PLAY_SONG(leader_succeed_song);
|
||||
} else {
|
||||
PLAY_SONG(leader_fail_song);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (did_leader_succeed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_succeed);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_fail);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Keycodes :id=keycodes
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-----------------------|---------|-------------------------|
|
||||
|`QK_LEADER` |`QK_LEAD`|Begin the leader sequence|
|
||||
|
||||
## API :id=api
|
||||
|
||||
### `void leader_start_user(void)` :id=api-leader-start-user
|
||||
|
||||
User callback, invoked when the leader sequence begins.
|
||||
|
||||
---
|
||||
|
||||
### `void leader_end_user(void)` :id=api-leader-end-user
|
||||
|
||||
User callback, invoked when the leader sequence ends.
|
||||
|
||||
---
|
||||
|
||||
### `void leader_start(void)` :id=api-leader-start
|
||||
|
||||
Begin the leader sequence, resetting the buffer and timer.
|
||||
|
||||
---
|
||||
|
||||
### `void leader_end(void)` :id=api-leader-end
|
||||
|
||||
End the leader sequence.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_active(void)` :id=api-leader-sequence-active
|
||||
|
||||
Whether the leader sequence is active.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_add(uint16_t keycode)` :id=api-leader-sequence-add
|
||||
|
||||
Add the given keycode to the sequence buffer.
|
||||
|
||||
If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-add-arguments
|
||||
|
||||
- `uint16_t keycode`
|
||||
The keycode to add.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-add-return
|
||||
|
||||
`true` if the keycode was added, `false` if the buffer is full.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_timed_out(void)` :id=api-leader-sequence-timed-out
|
||||
|
||||
Whether the leader sequence has reached the timeout.
|
||||
|
||||
If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_reset_timer(void)` :id=api-leader-reset-timer
|
||||
|
||||
Reset the leader sequence timer.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_one_key(uint16_t kc)` :id=api-leader-sequence-one-key
|
||||
|
||||
Check the sequence buffer for the given keycode.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-one-key-arguments
|
||||
|
||||
- `uint16_t kc`
|
||||
The keycode to check.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-one-key-return
|
||||
|
||||
`true` if the sequence buffer matches.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2)` :id=api-leader-sequence-two-keys
|
||||
|
||||
Check the sequence buffer for the given keycodes.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-two-keys-arguments
|
||||
|
||||
- `uint16_t kc1`
|
||||
The first keycode to check.
|
||||
- `uint16_t kc2`
|
||||
The second keycode to check.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-two-keys-return
|
||||
|
||||
`true` if the sequence buffer matches.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3)` :id=api-leader-sequence-three-keys
|
||||
|
||||
Check the sequence buffer for the given keycodes.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-three-keys-arguments
|
||||
|
||||
- `uint16_t kc1`
|
||||
The first keycode to check.
|
||||
- `uint16_t kc2`
|
||||
The second keycode to check.
|
||||
- `uint16_t kc3`
|
||||
The third keycode to check.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-three-keys-return
|
||||
|
||||
`true` if the sequence buffer matches.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4)` :id=api-leader-sequence-four-keys
|
||||
|
||||
Check the sequence buffer for the given keycodes.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-four-keys-arguments
|
||||
|
||||
- `uint16_t kc1`
|
||||
The first keycode to check.
|
||||
- `uint16_t kc2`
|
||||
The second keycode to check.
|
||||
- `uint16_t kc3`
|
||||
The third keycode to check.
|
||||
- `uint16_t kc4`
|
||||
The fourth keycode to check.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-four-keys-return
|
||||
|
||||
`true` if the sequence buffer matches.
|
||||
|
||||
---
|
||||
|
||||
### `bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5)` :id=api-leader-sequence-five-keys
|
||||
|
||||
Check the sequence buffer for the given keycodes.
|
||||
|
||||
#### Arguments :id=api-leader-sequence-five-keys-arguments
|
||||
|
||||
- `uint16_t kc1`
|
||||
The first keycode to check.
|
||||
- `uint16_t kc2`
|
||||
The second keycode to check.
|
||||
- `uint16_t kc3`
|
||||
The third keycode to check.
|
||||
- `uint16_t kc4`
|
||||
The fourth keycode to check.
|
||||
- `uint16_t kc5`
|
||||
The fifth keycode to check.
|
||||
|
||||
#### Return Value :id=api-leader-sequence-five-keys-return
|
||||
|
||||
`true` if the sequence buffer matches.
|
||||
|
|
|
|||
|
|
@ -78,42 +78,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
)
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
void leader_end_user(void) {
|
||||
// qq, alt+f4 close window
|
||||
if (leader_sequence_two_keys(KC_Q, KC_Q)) {
|
||||
tap_code16(A(KC_F4));
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
// ee, open explorer
|
||||
if (leader_sequence_two_keys(KC_E, KC_E)) {
|
||||
tap_code16(G(KC_E));
|
||||
}
|
||||
|
||||
// qq, alt+f4 close window
|
||||
SEQ_TWO_KEYS(KC_Q, KC_Q) {
|
||||
tap_code16(A(KC_F4));
|
||||
}
|
||||
// rr, windows run prompt
|
||||
if (leader_sequence_two_keys(KC_R, KC_R)) {
|
||||
tap_code16(G(KC_R));
|
||||
}
|
||||
|
||||
// ee, open explorer
|
||||
SEQ_TWO_KEYS(KC_E, KC_E) {
|
||||
tap_code16(G(KC_E));
|
||||
}
|
||||
// ww, maximize window
|
||||
if (leader_sequence_two_keys(KC_W, KC_W)) {
|
||||
tap_code16(G(KC_UP));
|
||||
}
|
||||
|
||||
// rr, windows run prompt
|
||||
SEQ_TWO_KEYS(KC_R, KC_R) {
|
||||
tap_code16(G(KC_R));
|
||||
}
|
||||
// ss, minimize window
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
tap_code16(G(KC_DOWN));
|
||||
}
|
||||
|
||||
// ww, maximize window
|
||||
SEQ_TWO_KEYS(KC_W, KC_W) {
|
||||
tap_code16(G(KC_UP));
|
||||
}
|
||||
|
||||
// ss, minimize window
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
tap_code16(G(KC_DOWN));
|
||||
}
|
||||
|
||||
// <space><space>, toggle desktop
|
||||
SEQ_TWO_KEYS(KC_SPC, KC_SPC) {
|
||||
tap_code16(G(KC_D));
|
||||
}
|
||||
// <space><space>, toggle desktop
|
||||
if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
|
||||
tap_code16(G(KC_D));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,47 @@ void keyboard_post_init_keymap(void) {
|
|||
bspc_timer = 0;
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
void leader_end_user(void) {
|
||||
// layer navigation
|
||||
if (leader_sequence_one_key(KC_R)) { layer_invert(_RPT); }
|
||||
if (leader_sequence_one_key(KC_G)) { layer_invert(_GAME); }
|
||||
if (leader_sequence_one_key(KC_K)) { layer_invert(_KP); }
|
||||
if (leader_sequence_one_key(KC_KP_5)) { layer_invert(_KP); }
|
||||
|
||||
// tmux navigation
|
||||
if (leader_sequence_one_key(KC_L)) { SEND_STRING(SS_LCTL("a") "n"); }
|
||||
if (leader_sequence_one_key(KC_H)) { SEND_STRING(SS_LCTL("a") "p"); }
|
||||
if (leader_sequence_one_key(KC_N)) { SEND_STRING(SS_LCTL("a") "c"); }
|
||||
if (leader_sequence_one_key(KC_W)) { SEND_STRING(SS_LCTL("a") "x"); }
|
||||
if (leader_sequence_one_key(KC_MINS)) { SEND_STRING(SS_LCTL("a") "-"); }
|
||||
if (leader_sequence_one_key(KC_QUOT)) { SEND_STRING(SS_LCTL("a") "\""); }
|
||||
if (leader_sequence_one_key(KC_1)) { SEND_STRING(SS_LCTL("a") "1"); }
|
||||
if (leader_sequence_one_key(KC_2)) { SEND_STRING(SS_LCTL("a") "2"); }
|
||||
if (leader_sequence_one_key(KC_3)) { SEND_STRING(SS_LCTL("a") "3"); }
|
||||
if (leader_sequence_one_key(KC_4)) { SEND_STRING(SS_LCTL("a") "4"); }
|
||||
if (leader_sequence_one_key(KC_5)) { SEND_STRING(SS_LCTL("a") "5"); }
|
||||
if (leader_sequence_one_key(KC_6)) { SEND_STRING(SS_LCTL("a") "6"); }
|
||||
if (leader_sequence_one_key(KC_7)) { SEND_STRING(SS_LCTL("a") "7"); }
|
||||
if (leader_sequence_one_key(KC_8)) { SEND_STRING(SS_LCTL("a") "8"); }
|
||||
if (leader_sequence_one_key(KC_9)) { SEND_STRING(SS_LCTL("a") "9"); }
|
||||
|
||||
// secrets
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_M)) { send_secret_string(0); }
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) { send_secret_string(1); }
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) { send_secret_string(2); }
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_J)) { send_secret_string(3); }
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_K)) { send_secret_string(4); }
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_L)) { send_secret_string(5); }
|
||||
|
||||
// fast control-C
|
||||
if (leader_sequence_one_key(KC_C)) { tap_code16(C(KC_C)); }
|
||||
|
||||
// neovim: terminal escape
|
||||
if (leader_sequence_one_key(KC_BSLS)) {
|
||||
tap_code16(C(KC_BSLS));
|
||||
tap_code16(C(KC_N));
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_keymap(void) {
|
||||
if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) {
|
||||
|
|
@ -248,50 +288,6 @@ void matrix_scan_keymap(void) {
|
|||
bspc_timer = 0;
|
||||
register_code(KC_BSPC);
|
||||
}
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
// layer navigation
|
||||
SEQ_ONE_KEY(KC_R) { layer_invert(_RPT); }
|
||||
SEQ_ONE_KEY(KC_G) { layer_invert(_GAME); }
|
||||
SEQ_ONE_KEY(KC_K) { layer_invert(_KP); }
|
||||
SEQ_ONE_KEY(KC_KP_5) { layer_invert(_KP); }
|
||||
|
||||
// tmux navigation
|
||||
SEQ_ONE_KEY(KC_L) { SEND_STRING(SS_LCTL("a") "n"); }
|
||||
SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_LCTL("a") "p"); }
|
||||
SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LCTL("a") "c"); }
|
||||
SEQ_ONE_KEY(KC_W) { SEND_STRING(SS_LCTL("a") "x"); }
|
||||
SEQ_ONE_KEY(KC_MINS) { SEND_STRING(SS_LCTL("a") "-"); }
|
||||
SEQ_ONE_KEY(KC_QUOT) { SEND_STRING(SS_LCTL("a") "\""); }
|
||||
SEQ_ONE_KEY(KC_1) { SEND_STRING(SS_LCTL("a") "1"); }
|
||||
SEQ_ONE_KEY(KC_2) { SEND_STRING(SS_LCTL("a") "2"); }
|
||||
SEQ_ONE_KEY(KC_3) { SEND_STRING(SS_LCTL("a") "3"); }
|
||||
SEQ_ONE_KEY(KC_4) { SEND_STRING(SS_LCTL("a") "4"); }
|
||||
SEQ_ONE_KEY(KC_5) { SEND_STRING(SS_LCTL("a") "5"); }
|
||||
SEQ_ONE_KEY(KC_6) { SEND_STRING(SS_LCTL("a") "6"); }
|
||||
SEQ_ONE_KEY(KC_7) { SEND_STRING(SS_LCTL("a") "7"); }
|
||||
SEQ_ONE_KEY(KC_8) { SEND_STRING(SS_LCTL("a") "8"); }
|
||||
SEQ_ONE_KEY(KC_9) { SEND_STRING(SS_LCTL("a") "9"); }
|
||||
|
||||
// secrets
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_M) { send_secret_string(0); }
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { send_secret_string(1); }
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { send_secret_string(2); }
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_J) { send_secret_string(3); }
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_K) { send_secret_string(4); }
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_L) { send_secret_string(5); }
|
||||
|
||||
// fast control-C
|
||||
SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); }
|
||||
|
||||
// neovim: terminal escape
|
||||
SEQ_ONE_KEY(KC_BSLS) {
|
||||
tap_code16(C(KC_BSLS));
|
||||
tap_code16(C(KC_N));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
|
|||
|
|
@ -418,54 +418,52 @@ void ldrkey_send_curlybrace_wrap_selection(void) {
|
|||
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LGUI(SS_TAP(X_V)) SS_TAP(X_RIGHT)) : SEND_STRING(SS_LCTL(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LCTL(SS_TAP(X_V)) SS_TAP(X_RIGHT));
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
void leader_start_user(void) {
|
||||
isLeader = true;
|
||||
}
|
||||
|
||||
void matrix_scan_user(void)
|
||||
{
|
||||
LEADER_DICTIONARY()
|
||||
{
|
||||
leading = false;
|
||||
leader_end();
|
||||
void leader_end_user(void) {
|
||||
isLeader = false;
|
||||
|
||||
/* Sequences on layer _MAIN & _MAC */
|
||||
/* Sequences on layer _MAIN & _MAC */
|
||||
/* éÉ => LdrKey > / */
|
||||
SEQ_ONE_KEY(KC_SLSH) {
|
||||
if (leader_sequence_one_key(KC_SLSH)) {
|
||||
send_french_accent(_E, _ACUTE);
|
||||
}
|
||||
/* àÀ => LdrKey > A */
|
||||
SEQ_ONE_KEY(KC_A) {
|
||||
if (leader_sequence_one_key(KC_A)) {
|
||||
send_french_accent(_A, _GRAVE);
|
||||
}
|
||||
/* èÈ => LdrKey > E */
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
send_french_accent(_E, _GRAVE);
|
||||
}
|
||||
/* ùÙ => LdrKey > U */
|
||||
SEQ_ONE_KEY(KC_U) {
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
send_french_accent(_U, _GRAVE);
|
||||
}
|
||||
/* â => LdrKey > A > A */
|
||||
SEQ_TWO_KEYS(KC_A, KC_A) {
|
||||
if (leader_sequence_two_keys(KC_A, KC_A)) {
|
||||
send_french_accent(_A, _CIRCUMFLEX);
|
||||
}
|
||||
/* êÊ => LdrKey > E > E */
|
||||
SEQ_TWO_KEYS(KC_E, KC_E) {
|
||||
if (leader_sequence_two_keys(KC_E, KC_E)) {
|
||||
send_french_accent(_E, _CIRCUMFLEX);
|
||||
}
|
||||
/* îÎ => LdrKey > I > I */
|
||||
SEQ_TWO_KEYS(KC_I, KC_I) {
|
||||
if (leader_sequence_two_keys(KC_I, KC_I)) {
|
||||
send_french_accent(_I, _CIRCUMFLEX);
|
||||
}
|
||||
/* ôÔ => LdrKey > O > O */
|
||||
SEQ_TWO_KEYS(KC_O, KC_O) {
|
||||
if (leader_sequence_two_keys(KC_O, KC_O)) {
|
||||
send_french_accent(_O, _CIRCUMFLEX);
|
||||
}
|
||||
/* ûÛ => LdrKey > U > U */
|
||||
SEQ_TWO_KEYS(KC_U, KC_U) {
|
||||
if (leader_sequence_two_keys(KC_U, KC_U)) {
|
||||
send_french_accent(_U, _CIRCUMFLEX);
|
||||
}
|
||||
/* çÇ => LdrKey > C */
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
if (onMac) {
|
||||
SEND_STRING(SS_LALT("c"));
|
||||
} else {
|
||||
|
|
@ -473,247 +471,238 @@ void matrix_scan_user(void)
|
|||
}
|
||||
}
|
||||
/* CapsLock */
|
||||
SEQ_ONE_KEY(QK_LEAD) {
|
||||
if (leader_sequence_one_key(QK_LEAD)) {
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
/* ± => LdrKey > = > - */
|
||||
SEQ_TWO_KEYS(KC_EQL, KC_MINS) {
|
||||
if (leader_sequence_two_keys(KC_EQL, KC_MINS)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_EQL)))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P1) SS_UP(X_LALT));
|
||||
}
|
||||
/* ≤ => LdrKey > - > = */
|
||||
SEQ_TWO_KEYS(KC_MINS, KC_EQL) {
|
||||
if (leader_sequence_two_keys(KC_MINS, KC_EQL)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_COMM))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P3) SS_UP(X_LALT));
|
||||
}
|
||||
/* ≥ => LdrKey > = > = */
|
||||
SEQ_TWO_KEYS(KC_EQL, KC_EQL) {
|
||||
if (leader_sequence_two_keys(KC_EQL, KC_EQL)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_DOT))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P2) SS_UP(X_LALT));
|
||||
}
|
||||
/* <= => LdrKey > , > , */
|
||||
SEQ_TWO_KEYS(KC_COMM, KC_COMM) {
|
||||
if (leader_sequence_two_keys(KC_COMM, KC_COMM)) {
|
||||
SEND_STRING(SS_LSFT(SS_TAP(X_COMM)) SS_TAP(X_SPC) SS_TAP(X_EQL) SS_TAP(X_LEFT) SS_TAP(X_BSPC) SS_TAP(X_RIGHT));
|
||||
}
|
||||
/* => => LdrKey > . > . */
|
||||
SEQ_TWO_KEYS(KC_DOT, KC_DOT) {
|
||||
if (leader_sequence_two_keys(KC_DOT, KC_DOT)) {
|
||||
SEND_STRING("=>");
|
||||
}
|
||||
/* ", " => LdrKey > " " */
|
||||
SEQ_ONE_KEY(KC_SPC) {
|
||||
if (leader_sequence_one_key(KC_SPC)) {
|
||||
SEND_STRING(", ");
|
||||
}
|
||||
/* ". " => LdrKey > " " > " " */
|
||||
SEQ_TWO_KEYS(KC_SPC, KC_SPC) {
|
||||
if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
|
||||
SEND_STRING(". ");
|
||||
}
|
||||
/* Backward delete current word (on cursor) */
|
||||
SEQ_TWO_KEYS(KC_BSPC, KC_BSPC) {
|
||||
if (leader_sequence_two_keys(KC_BSPC, KC_BSPC)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_RIGHT)) SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT)) SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
|
||||
}
|
||||
/* Previous word delete */
|
||||
SEQ_ONE_KEY(KC_BSPC) {
|
||||
if (leader_sequence_one_key(KC_BSPC)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
|
||||
}
|
||||
/* Forward delete current word (on cursor) */
|
||||
SEQ_TWO_KEYS(KC_DEL, KC_DEL) {
|
||||
if (leader_sequence_two_keys(KC_DEL, KC_DEL)) {
|
||||
|
||||
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)) : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
|
||||
}
|
||||
/* Next word delete */
|
||||
SEQ_ONE_KEY(KC_DEL) {
|
||||
if (leader_sequence_one_key(KC_DEL)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)): SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
|
||||
}
|
||||
/* ` => LdrKey > Escape */
|
||||
SEQ_ONE_KEY(QK_GESC) {
|
||||
if (leader_sequence_one_key(QK_GESC)) {
|
||||
SEND_STRING("`");
|
||||
}
|
||||
/* ``` => LdrKey > Escape > Escape > Escape */
|
||||
SEQ_THREE_KEYS(QK_GESC, QK_GESC, QK_GESC) {
|
||||
if (leader_sequence_three_keys(QK_GESC, QK_GESC, QK_GESC)) {
|
||||
SEND_STRING("```");
|
||||
}
|
||||
/* Printscreen => LdrKey > Insert */
|
||||
SEQ_ONE_KEY(KC_INS) {
|
||||
if (leader_sequence_one_key(KC_INS)) {
|
||||
onMac ? SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4)))) : SEND_STRING(SS_TAP(X_PSCR));
|
||||
}
|
||||
/* Home => LdrKey > Page Up */
|
||||
SEQ_ONE_KEY(KC_PGUP) {
|
||||
if (leader_sequence_one_key(KC_PGUP)) {
|
||||
onMac ? SEND_STRING(SS_TAP(X_HOME)) : SEND_STRING(SS_LCTL(SS_TAP(X_HOME)));
|
||||
}
|
||||
/* End => LdrKey > Page Down */
|
||||
SEQ_ONE_KEY(KC_PGDN) {
|
||||
if (leader_sequence_one_key(KC_PGDN)) {
|
||||
onMac ? SEND_STRING(SS_TAP(X_END)) : SEND_STRING(SS_LCTL(SS_TAP(X_END)));
|
||||
}
|
||||
/* Close Curernt File/Tab => LdrKey > W */
|
||||
SEQ_ONE_KEY(KC_W) {
|
||||
if (leader_sequence_one_key(KC_W)) {
|
||||
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_W))) : SEND_STRING(SS_LCTL(SS_TAP(X_W)));
|
||||
}
|
||||
/* Close Current App => LdrKey > Q */
|
||||
SEQ_ONE_KEY(KC_Q) {
|
||||
if (leader_sequence_one_key(KC_Q)) {
|
||||
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4)));
|
||||
}
|
||||
/* " => LdrKey > ' */
|
||||
SEQ_ONE_KEY(KC_QUOT) {
|
||||
if (leader_sequence_one_key(KC_QUOT)) {
|
||||
SEND_STRING("\"");
|
||||
}
|
||||
/* "|" => LdrKey > ' > ' */
|
||||
SEQ_TWO_KEYS(KC_QUOT, KC_QUOT) {
|
||||
if (leader_sequence_two_keys(KC_QUOT, KC_QUOT)) {
|
||||
SEND_STRING("\"\"" SS_TAP(X_LEFT));
|
||||
}
|
||||
/* "X" wrap => LdrKey > ' > ' > ' */
|
||||
SEQ_THREE_KEYS(KC_QUOT, KC_QUOT, KC_QUOT) {
|
||||
if (leader_sequence_three_keys(KC_QUOT, KC_QUOT, KC_QUOT)) {
|
||||
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) "\"" SS_LALT(SS_TAP(X_RIGHT)) "\"") : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) "\"" SS_LCTL(SS_TAP(X_RIGHT)) "\"");
|
||||
}
|
||||
/* ( => LdrKey > Left Shift */
|
||||
SEQ_ONE_KEY(KC_LSFT) {
|
||||
if (leader_sequence_one_key(KC_LSFT)) {
|
||||
SEND_STRING("(");
|
||||
}
|
||||
/* ) => LdrKey > Right Shift */
|
||||
SEQ_ONE_KEY(KC_RSFT) {
|
||||
if (leader_sequence_one_key(KC_RSFT)) {
|
||||
SEND_STRING(")");
|
||||
}
|
||||
/* (|) => LdrKey > Left Shift > Left Shift */
|
||||
SEQ_TWO_KEYS(KC_LSFT, KC_LSFT) {
|
||||
if (leader_sequence_two_keys(KC_LSFT, KC_LSFT)) {
|
||||
ldrkey_send_paranthesis_wrap_ini();
|
||||
}
|
||||
/* (|) => LdrKey > Right Shift > Right Shift */
|
||||
SEQ_TWO_KEYS(KC_RSFT, KC_RSFT) {
|
||||
if (leader_sequence_two_keys(KC_RSFT, KC_RSFT)) {
|
||||
ldrkey_send_paranthesis_wrap_ini();
|
||||
}
|
||||
/* (X) wrap => LdrKey > Left Shift > W */
|
||||
SEQ_TWO_KEYS(KC_LSFT, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_LSFT, KC_W)) {
|
||||
ldrkey_send_paranthesis_wrap_word();
|
||||
}
|
||||
/* (X) wrap => LdrKey > Right Shift > W */
|
||||
SEQ_TWO_KEYS(KC_RSFT, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_RSFT, KC_W)) {
|
||||
ldrkey_send_paranthesis_wrap_word();
|
||||
}
|
||||
/* (X) wrap selection => LdrKey > Left Shift > W > W */
|
||||
SEQ_THREE_KEYS(KC_LSFT, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_LSFT, KC_W, KC_W)) {
|
||||
ldrkey_send_paranthesis_wrap_selection();
|
||||
}
|
||||
/* (X) wrap selection => LdrKey > Right Shift > W > W */
|
||||
SEQ_THREE_KEYS(KC_RSFT, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_RSFT, KC_W, KC_W)) {
|
||||
ldrkey_send_paranthesis_wrap_selection();
|
||||
}
|
||||
/* [ => LdrKey > Left CTL */
|
||||
SEQ_ONE_KEY(KC_LCTL) {
|
||||
if (leader_sequence_one_key(KC_LCTL)) {
|
||||
SEND_STRING("[");
|
||||
}
|
||||
/* ] => LdrKey > Right CTL */
|
||||
SEQ_ONE_KEY(KC_RCTL) {
|
||||
if (leader_sequence_one_key(KC_RCTL)) {
|
||||
SEND_STRING("]");
|
||||
}
|
||||
/* [|] => LdrKey > Left CTL > Left CTL */
|
||||
SEQ_TWO_KEYS(KC_LCTL, KC_LCTL) {
|
||||
if (leader_sequence_two_keys(KC_LCTL, KC_LCTL)) {
|
||||
ldrkey_send_bracket_wrap_ini();
|
||||
}
|
||||
/* [|] => LdrKey > Right CTL > Right CTL */
|
||||
SEQ_TWO_KEYS(KC_RCTL, KC_RCTL) {
|
||||
if (leader_sequence_two_keys(KC_RCTL, KC_RCTL)) {
|
||||
ldrkey_send_bracket_wrap_ini();
|
||||
}
|
||||
/* [X] wrap => LdrKey > Left CTL > W */
|
||||
SEQ_TWO_KEYS(KC_LCTL, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_LCTL, KC_W)) {
|
||||
ldrkey_send_bracket_wrap_word();
|
||||
}
|
||||
/* [X] wrap => LdrKey > Right CTL > W */
|
||||
SEQ_TWO_KEYS(KC_RCTL, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_RCTL, KC_W)) {
|
||||
ldrkey_send_bracket_wrap_word();
|
||||
}
|
||||
/* [X] wrap selection => LdrKey > Left CTL > W > W */
|
||||
SEQ_THREE_KEYS(KC_LCTL, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_LCTL, KC_W, KC_W)) {
|
||||
ldrkey_send_bracket_wrap_selection();
|
||||
}
|
||||
/* [X] wrap selection => LdrKey > Right CTL > W > W */
|
||||
SEQ_THREE_KEYS(KC_RCTL, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_RCTL, KC_W, KC_W)) {
|
||||
ldrkey_send_bracket_wrap_selection();
|
||||
}
|
||||
/* { => LdrKey > Left ALT */
|
||||
SEQ_ONE_KEY(KC_LALT) {
|
||||
if (leader_sequence_one_key(KC_LALT)) {
|
||||
SEND_STRING("{");
|
||||
}
|
||||
/* } => LdrKey > Right ALT */
|
||||
SEQ_ONE_KEY(KC_RALT) {
|
||||
if (leader_sequence_one_key(KC_RALT)) {
|
||||
SEND_STRING("}");
|
||||
}
|
||||
/* {|} => LdrKey > Left ALT > Left ALT */
|
||||
SEQ_TWO_KEYS(KC_LALT, KC_LALT) {
|
||||
if (leader_sequence_two_keys(KC_LALT, KC_LALT)) {
|
||||
ldrkey_send_curlybrace_wrap_ini();
|
||||
}
|
||||
/* {|} => LdrKey > Right ALT > Right ALT */
|
||||
SEQ_TWO_KEYS(KC_RALT, KC_RALT) {
|
||||
if (leader_sequence_two_keys(KC_RALT, KC_RALT)) {
|
||||
ldrkey_send_curlybrace_wrap_ini();
|
||||
}
|
||||
/* {X} wrap => LdrKey > Left ALT > W */
|
||||
SEQ_TWO_KEYS(KC_LALT, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_LALT, KC_W)) {
|
||||
ldrkey_send_curlybrace_wrap_word();
|
||||
}
|
||||
/* {X} wrap => LdrKey > Right ALT > W */
|
||||
SEQ_TWO_KEYS(KC_RALT, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_RALT, KC_W)) {
|
||||
ldrkey_send_curlybrace_wrap_word();
|
||||
}
|
||||
/* {X} wrap selection => LdrKey > Left ALT > W > W */
|
||||
SEQ_THREE_KEYS(KC_LALT, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_LALT, KC_W, KC_W)) {
|
||||
ldrkey_send_curlybrace_wrap_selection();
|
||||
}
|
||||
/* {X} wrap selection => LdrKey > Right ALT > W > W */
|
||||
SEQ_THREE_KEYS(KC_RALT, KC_W, KC_W) {
|
||||
if (leader_sequence_three_keys(KC_RALT, KC_W, KC_W)) {
|
||||
ldrkey_send_curlybrace_wrap_selection();
|
||||
}
|
||||
/* Select everything on this line before cursor => LdrKey > Left */
|
||||
SEQ_ONE_KEY(KC_LEFT) {
|
||||
if (leader_sequence_one_key(KC_LEFT)) {
|
||||
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME)));
|
||||
}
|
||||
/* Select everything on this line after cursor => LdrKey > Right */
|
||||
SEQ_ONE_KEY(KC_RIGHT) {
|
||||
if (leader_sequence_one_key(KC_RIGHT)) {
|
||||
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END)));
|
||||
}
|
||||
/* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */
|
||||
SEQ_TWO_KEYS(KC_LEFT, KC_LEFT) {
|
||||
if (leader_sequence_two_keys(KC_LEFT, KC_LEFT)) {
|
||||
onMac ? SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_TAP(X_END)));
|
||||
}
|
||||
/* Select everything on this line => LdrKey > Right > Left */
|
||||
SEQ_TWO_KEYS(KC_RIGHT, KC_LEFT) {
|
||||
if (leader_sequence_two_keys(KC_RIGHT, KC_LEFT)) {
|
||||
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_RIGHT) SS_LSFT(SS_LGUI(SS_TAP(X_LEFT))))) : SEND_STRING(SS_TAP(X_END) SS_LSFT(SS_TAP(X_HOME)));
|
||||
}
|
||||
/* Select 1x Page Up on the page before the cursor => LdrKey > Up */
|
||||
SEQ_ONE_KEY(KC_UP) {
|
||||
if (leader_sequence_one_key(KC_UP)) {
|
||||
SEND_STRING(SS_LSFT(SS_TAP(X_PGUP)));
|
||||
}
|
||||
/* Select 1x Page Down on the page after the cursor => LdrKey > Down */
|
||||
SEQ_ONE_KEY(KC_DOWN) {
|
||||
if (leader_sequence_one_key(KC_DOWN)) {
|
||||
SEND_STRING(SS_LSFT(SS_TAP(X_PGDN)));
|
||||
}
|
||||
/* Select everything on the page before the cursor => LdrKey > Up > Up */
|
||||
SEQ_TWO_KEYS(KC_UP, KC_UP) {
|
||||
if (leader_sequence_two_keys(KC_UP, KC_UP)) {
|
||||
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME))));
|
||||
}
|
||||
/* Select everything on the page after the cursor => LdrKey > Down > Down */
|
||||
SEQ_TWO_KEYS(KC_DOWN, KC_DOWN) {
|
||||
if (leader_sequence_two_keys(KC_DOWN, KC_DOWN)) {
|
||||
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END))));
|
||||
}
|
||||
/* HELPER => spit out the url of the layout description page on github */
|
||||
SEQ_FIVE_KEYS(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC) {
|
||||
if (leader_sequence_five_keys(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC)) {
|
||||
SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz");
|
||||
}
|
||||
/* google.ca => LdrKey > G > G */
|
||||
SEQ_TWO_KEYS(KC_G, KC_G) {
|
||||
if (leader_sequence_two_keys(KC_G, KC_G)) {
|
||||
SEND_STRING("https://google.ca" SS_TAP(X_ENT));
|
||||
}
|
||||
/* @gmail => LdrKey > M > L > T */
|
||||
SEQ_THREE_KEYS(KC_M, KC_L, KC_T) {
|
||||
if (leader_sequence_three_keys(KC_M, KC_L, KC_T)) {
|
||||
SEND_STRING("mailto." SS_TAP(X_D) SS_TAP(X_A) SS_TAP(X_N) SS_TAP(X_I) SS_TAP(X_E) SS_TAP(X_L) SS_TAP(X_R) SS_TAP(X_A) SS_TAP(X_C) SS_TAP(X_I) SS_TAP(X_N) SS_TAP(X_E) "@gmail.com");
|
||||
}
|
||||
/* Show Desktop => LdrKey > D */
|
||||
SEQ_ONE_KEY(KC_D) {
|
||||
if (leader_sequence_one_key(KC_D)) {
|
||||
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_SPC)) "Mission" SS_TAP(X_ENT)) : SEND_STRING(SS_LGUI(SS_TAP(X_D)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void leader_start_user(void) {
|
||||
isLeader = true;
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
isLeader = false;
|
||||
}
|
||||
|
||||
#endif /* LEADER */
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(TD(APMR_PIPE)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_U);
|
||||
|
||||
unregister_code(KC_U);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
LEADER_EXTERNS();
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
#include "../leader/leader_setup.c"
|
||||
|
||||
bool MATRIX_SCANNED = false;
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
|
|
@ -7,6 +5,16 @@ void matrix_scan_user(void) {
|
|||
rgblight_sethsv_noeeprom(HSV_GREEN);
|
||||
MATRIX_SCANNED = true;
|
||||
}
|
||||
|
||||
#include "../leader/leader_dictionary.c"
|
||||
};
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(TD(APMR_PIPE))) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_U);
|
||||
|
||||
unregister_code(KC_U);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,30 @@ uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||
}
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
SEND_STRING ("sudo -i\n");
|
||||
}
|
||||
if (leader_sequence_one_key(KC_H)) {
|
||||
SEND_STRING ("--help\n");
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
SEND_STRING(SS_LGUI("ac"));
|
||||
/* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
|
||||
}
|
||||
if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_A, KC_S)) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
if (is_alt_tab_active) {
|
||||
|
|
@ -253,31 +276,4 @@ void matrix_scan_user(void) {
|
|||
is_alt_tab_active = false;
|
||||
}
|
||||
}
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
SEND_STRING ("sudo -i\n");
|
||||
}
|
||||
SEQ_ONE_KEY(KC_H) {
|
||||
SEND_STRING ("--help\n");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
SEND_STRING(SS_LGUI("ac"));
|
||||
/* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,89 +49,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
)
|
||||
};
|
||||
|
||||
void matrix_init_user(void) {
|
||||
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
// Close a program in i3wm
|
||||
SEQ_ONE_KEY(KC_Q) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_Q);
|
||||
unregister_code(KC_Q);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Exit i3wm
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_E);
|
||||
unregister_code(KC_E);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Copy selected text in suckless terminal
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_C);
|
||||
unregister_code(KC_C);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Paste text in suckless terminal
|
||||
SEQ_ONE_KEY(KC_V) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_V);
|
||||
unregister_code(KC_V);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// FZF shortcut to fuzzy switch directories
|
||||
SEQ_ONE_KEY(KC_D) {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_C);
|
||||
unregister_code(KC_C);
|
||||
unregister_code(KC_LALT);
|
||||
}
|
||||
// Send keys to bring up fuzzy process kill
|
||||
SEQ_ONE_KEY(KC_K) {
|
||||
SEND_STRING("kill " SS_TAP(X_TAB));
|
||||
}
|
||||
// Send keys to start neovim and fuzzy search for filename
|
||||
SEQ_ONE_KEY(KC_T) {
|
||||
SEND_STRING("nvim ");
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_T);
|
||||
unregister_code(KC_T);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Switch between windows in tmux
|
||||
SEQ_ONE_KEY(KC_L) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_B);
|
||||
unregister_code(KC_B);
|
||||
unregister_code(KC_LCTL);
|
||||
register_code(KC_L);
|
||||
unregister_code(KC_L);
|
||||
}
|
||||
void leader_end_user() {
|
||||
// Close a program in i3wm
|
||||
if (leader_sequence_one_key(KC_Q)) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_Q);
|
||||
unregister_code(KC_Q);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Exit i3wm
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_E);
|
||||
unregister_code(KC_E);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Copy selected text in suckless terminal
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_C);
|
||||
unregister_code(KC_C);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Paste text in suckless terminal
|
||||
if (leader_sequence_one_key(KC_V)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_V);
|
||||
unregister_code(KC_V);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// FZF shortcut to fuzzy switch directories
|
||||
if (leader_sequence_one_key(KC_D)) {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_C);
|
||||
unregister_code(KC_C);
|
||||
unregister_code(KC_LALT);
|
||||
}
|
||||
// Send keys to bring up fuzzy process kill
|
||||
if (leader_sequence_one_key(KC_K)) {
|
||||
SEND_STRING("kill " SS_TAP(X_TAB));
|
||||
}
|
||||
// Send keys to start neovim and fuzzy search for filename
|
||||
if (leader_sequence_one_key(KC_T)) {
|
||||
SEND_STRING("nvim ");
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_T);
|
||||
unregister_code(KC_T);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Switch between windows in tmux
|
||||
if (leader_sequence_one_key(KC_L)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_B);
|
||||
unregister_code(KC_B);
|
||||
unregister_code(KC_LCTL);
|
||||
register_code(KC_L);
|
||||
unregister_code(KC_L);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,25 +42,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT,
|
||||
_______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
|
||||
|
||||
/*void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_RSFT) {
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
register_code(KC_H);
|
||||
unregister_code(KC_H);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -181,15 +181,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_U) {
|
||||
SEND_STRING(":luvu:\n");
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
SEND_STRING(":luvu:\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,38 +255,29 @@ L06 -> <TBD>: UNSPECIFIED
|
|||
|
||||
};
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_1)) {
|
||||
// ¯\_(ツ)_/¯
|
||||
unicode_input_start(); register_hex(0xaf); unicode_input_finish();
|
||||
register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0xaf); unicode_input_finish();
|
||||
}
|
||||
|
||||
if (leader_sequence_one_key(KC_2)) {
|
||||
// 凸(ツ)凸
|
||||
unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void) {
|
||||
set_unicode_input_mode(UNICODE_MODE_LINUX);
|
||||
};
|
||||
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY (KC_1) {
|
||||
// ¯\_(ツ)_/¯
|
||||
unicode_input_start(); register_hex(0xaf); unicode_input_finish();
|
||||
register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0xaf); unicode_input_finish();
|
||||
}
|
||||
|
||||
SEQ_ONE_KEY (KC_2) {
|
||||
// 凸(ツ)凸
|
||||
unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
|
||||
register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
|
||||
unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@ enum custom_keycodes {
|
|||
#define MW_L KC_MS_WH_LEFT
|
||||
#define MW_R KC_MS_WH_RIGHT
|
||||
|
||||
//// only uncomment the below line when you enable leader key in rules.mk
|
||||
//LEADER_EXTERNS();
|
||||
|
||||
//Tap Dance Declarations
|
||||
enum {
|
||||
TD_SCL = 0
|
||||
|
|
|
|||
|
|
@ -76,68 +76,62 @@ static bool wiggle_mouse;
|
|||
static uint16_t wiggle_timer;
|
||||
static uint16_t next_wiggle;
|
||||
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(QK_LEAD) {
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
|
||||
SEQ_FOUR_KEYS(KC_I, KC_D, KC_L, KC_E) {
|
||||
wiggle_mouse = !wiggle_mouse;
|
||||
wiggle_timer = timer_read();
|
||||
}
|
||||
|
||||
SEQ_TWO_KEYS(KC_O, KC_K) {
|
||||
send_unicode_string("👍");
|
||||
}
|
||||
|
||||
SEQ_THREE_KEYS(KC_S, KC_A, KC_D) {
|
||||
send_unicode_string("😞");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_C, KC_H, KC_E, KC_C, KC_K) {
|
||||
send_unicode_string("✅");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_C, KC_R, KC_O, KC_S, KC_S) {
|
||||
send_unicode_string("❎");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_T, KC_H, KC_A, KC_N, KC_K) {
|
||||
send_unicode_string("🙏");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_S, KC_M, KC_I, KC_L, KC_E) {
|
||||
send_unicode_string("😊");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_P, KC_A, KC_R, KC_T, KC_Y) {
|
||||
send_unicode_string("🎉");
|
||||
}
|
||||
|
||||
SEQ_FOUR_KEYS(KC_E, KC_Y, KC_E, KC_S) {
|
||||
send_unicode_string("(ಠ_ಠ)");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_M, KC_A, KC_G, KC_I, KC_C) {
|
||||
send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_T, KC_A, KC_B, KC_L, KC_E) {
|
||||
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_S, KC_H, KC_R, KC_U, KC_G) {
|
||||
send_unicode_string("¯\\_(ツ)_/¯");
|
||||
}
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(QK_LEAD)) {
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
|
||||
if (leader_sequence_four_keys(KC_I, KC_D, KC_L, KC_E)) {
|
||||
wiggle_mouse = !wiggle_mouse;
|
||||
wiggle_timer = timer_read();
|
||||
}
|
||||
|
||||
if (leader_sequence_two_keys(KC_O, KC_K)) {
|
||||
send_unicode_string("👍");
|
||||
}
|
||||
|
||||
if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
|
||||
send_unicode_string("😞");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_C, KC_H, KC_E, KC_C, KC_K)) {
|
||||
send_unicode_string("✅");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_C, KC_R, KC_O, KC_S, KC_S)) {
|
||||
send_unicode_string("❎");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_T, KC_H, KC_A, KC_N, KC_K)) {
|
||||
send_unicode_string("🙏");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) {
|
||||
send_unicode_string("😊");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_P, KC_A, KC_R, KC_T, KC_Y)) {
|
||||
send_unicode_string("🎉");
|
||||
}
|
||||
|
||||
if (leader_sequence_four_keys(KC_E, KC_Y, KC_E, KC_S)) {
|
||||
send_unicode_string("(ಠ_ಠ)");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_M, KC_A, KC_G, KC_I, KC_C)) {
|
||||
send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_T, KC_A, KC_B, KC_L, KC_E)) {
|
||||
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
|
||||
}
|
||||
|
||||
if (leader_sequence_five_keys(KC_S, KC_H, KC_R, KC_U, KC_G)) {
|
||||
send_unicode_string("¯\\_(ツ)_/¯");
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
if (wiggle_mouse && timer_elapsed(wiggle_timer) > next_wiggle) {
|
||||
wiggle_timer = timer_read();
|
||||
|
||||
|
|
|
|||
|
|
@ -446,27 +446,18 @@ bool rgb_matrix_indicators_user(void) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef LEADER_ENABLE
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
SEND_STRING(SS_LCTL("v"));
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
SEND_STRING(SS_LCTL("v"));
|
||||
}
|
||||
if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -255,30 +255,19 @@ bool rgb_matrix_indicators_user(void) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef LEADER_ENABLE
|
||||
LEADER_EXTERNS();
|
||||
|
||||
//SEND_STRING seems to be local dependent.
|
||||
//For swiss-german layout I have to send "ctrl+." to get ":"
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https");
|
||||
register_code(KC_LSFT);
|
||||
SEND_STRING(".77");
|
||||
unregister_code(KC_LSFT);
|
||||
SEND_STRING("start.duckduckgo.com\n");
|
||||
}
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
||||
SEND_STRING("https");
|
||||
register_code(KC_LSFT);
|
||||
SEND_STRING(".77");
|
||||
unregister_code(KC_LSFT);
|
||||
SEND_STRING("start.duckduckgo.com\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -256,6 +256,54 @@ static void set_rgb_layer(int layer) {
|
|||
}
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_K)) {
|
||||
layer_invert(_KP);
|
||||
}
|
||||
if (leader_sequence_one_key(KC_G)) {
|
||||
layer_invert(_GAME);
|
||||
}
|
||||
if (leader_sequence_one_key(KC_KP_5)) {
|
||||
layer_invert(_KP);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_1)) {
|
||||
send_secret_string(0);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_2)) {
|
||||
send_secret_string(1);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_3)) {
|
||||
send_secret_string(2);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_4)) {
|
||||
send_secret_string(3);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_5)) {
|
||||
send_secret_string(4);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_6)) {
|
||||
send_secret_string(5);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_M)) {
|
||||
send_secret_string(0);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) {
|
||||
send_secret_string(1);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) {
|
||||
send_secret_string(2);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_J)) {
|
||||
send_secret_string(3);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_K)) {
|
||||
send_secret_string(4);
|
||||
}
|
||||
if (leader_sequence_two_keys(KC_SCLN, KC_L)) {
|
||||
send_secret_string(5);
|
||||
}
|
||||
}
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_keymap(void) {
|
||||
// force numlock on upon startup
|
||||
|
|
@ -264,8 +312,6 @@ void matrix_init_keymap(void) {
|
|||
}
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_keymap(void) {
|
||||
if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) {
|
||||
|
|
@ -282,56 +328,6 @@ void matrix_scan_keymap(void) {
|
|||
else
|
||||
rgb_matrix_set_color(15, 0, 0, 0);
|
||||
}
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_K) {
|
||||
layer_invert(_KP);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_G) {
|
||||
layer_invert(_GAME);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_KP_5) {
|
||||
layer_invert(_KP);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_1) {
|
||||
send_secret_string(0);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_2) {
|
||||
send_secret_string(1);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_3) {
|
||||
send_secret_string(2);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_4) {
|
||||
send_secret_string(3);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_5) {
|
||||
send_secret_string(4);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_6) {
|
||||
send_secret_string(5);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_M) {
|
||||
send_secret_string(0);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_COMM) {
|
||||
send_secret_string(1);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_DOT) {
|
||||
send_secret_string(2);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_J) {
|
||||
send_secret_string(3);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_K) {
|
||||
send_secret_string(4);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_SCLN, KC_L) {
|
||||
send_secret_string(5);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
|
|
|
|||
|
|
@ -130,18 +130,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_TWO_KEYS(KC_G, KC_P) {
|
||||
SEND_STRING("git push");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_G, KC_F, KC_P) {
|
||||
SEND_STRING("git push --force-with-lease");
|
||||
}
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_two_keys(KC_G, KC_P)) {
|
||||
SEND_STRING("git push");
|
||||
}
|
||||
if (leader_sequence_three_keys(KC_G, KC_F, KC_P)) {
|
||||
SEND_STRING("git push --force-with-lease");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,39 +50,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
//Leader maps
|
||||
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
// Anything you can do in a macro.
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
//tableflip (LEADER - TF)
|
||||
SEQ_TWO_KEYS(KC_T, KC_F) {
|
||||
if (leader_sequence_two_keys(KC_T, KC_F)) {
|
||||
set_unicode_input_mode(UNICODE_MODE_MACOS);
|
||||
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
|
||||
}
|
||||
//screencap (LEADER - SC)
|
||||
SEQ_TWO_KEYS(KC_S, KC_C) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4))));
|
||||
if (leader_sequence_two_keys(KC_S, KC_C)) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4))));
|
||||
}
|
||||
//screencap (LEADER - TM)
|
||||
SEQ_TWO_KEYS(KC_T, KC_M) {
|
||||
if (leader_sequence_two_keys(KC_T, KC_M)) {
|
||||
set_unicode_input_mode(UNICODE_MODE_MACOS);
|
||||
register_unicode(0x2122); // ™
|
||||
}
|
||||
/*
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
|
||||
if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
||||
SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
//change colors and rgb modes on layer change
|
||||
|
|
|
|||
|
|
@ -157,47 +157,41 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
LEADER_EXTERNS();
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
// Screenshot
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
tap_code16(G(C(S(KC_4))));
|
||||
}
|
||||
// Record Screen
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
tap_code16(S(G(KC_5)));
|
||||
}
|
||||
// 1Pass browser
|
||||
SEQ_ONE_KEY(KC_A) {
|
||||
tap_code16(G(A(KC_BSLS)));
|
||||
}
|
||||
// 1Pass mini
|
||||
SEQ_TWO_KEYS(KC_A, KC_A) {
|
||||
tap_code16(G(KC_BSLS));
|
||||
}
|
||||
// Comment out
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
tap_code16(G(KC_SLSH));
|
||||
}
|
||||
// Spotlight
|
||||
SEQ_ONE_KEY(KC_SPC) {
|
||||
tap_code16(G(KC_SPC));
|
||||
}
|
||||
// Auto format
|
||||
SEQ_ONE_KEY(KC_ENT) {
|
||||
tap_code16(S(G(A(KC_F))));
|
||||
}
|
||||
// Focus file tree
|
||||
SEQ_ONE_KEY(KC_TAB) {
|
||||
tap_code16(G(KC_1));
|
||||
}
|
||||
// Caps-lock
|
||||
SEQ_TWO_KEYS(KC_TAB, KC_TAB) {
|
||||
tap_code16(KC_CAPS);
|
||||
}
|
||||
void leader_end_user(void) {
|
||||
// Screenshot
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
tap_code16(G(C(S(KC_4))));
|
||||
}
|
||||
// Record Screen
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
tap_code16(S(G(KC_5)));
|
||||
}
|
||||
// 1Pass browser
|
||||
if (leader_sequence_one_key(KC_A)) {
|
||||
tap_code16(G(A(KC_BSLS)));
|
||||
}
|
||||
// 1Pass mini
|
||||
if (leader_sequence_two_keys(KC_A, KC_A)) {
|
||||
tap_code16(G(KC_BSLS));
|
||||
}
|
||||
// Comment out
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
tap_code16(G(KC_SLSH));
|
||||
}
|
||||
// Spotlight
|
||||
if (leader_sequence_one_key(KC_SPC)) {
|
||||
tap_code16(G(KC_SPC));
|
||||
}
|
||||
// Auto format
|
||||
if (leader_sequence_one_key(KC_ENT)) {
|
||||
tap_code16(S(G(A(KC_F))));
|
||||
}
|
||||
// Focus file tree
|
||||
if (leader_sequence_one_key(KC_TAB)) {
|
||||
tap_code16(G(KC_1));
|
||||
}
|
||||
// Caps-lock
|
||||
if (leader_sequence_two_keys(KC_TAB, KC_TAB)) {
|
||||
tap_code16(KC_CAPS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue