333fred layout update (#1971)

* Set up tap dance for layers on the lower button.

* Refactored code to share in the users directory between my two keyboard layouts.

* Small keyboard layout change.

* Updated documentation on oneshot usage in macros/tap dance.
This commit is contained in:
Fred Silberberg 2017-11-06 09:09:01 -08:00 committed by Jack Humbert
parent 16843bc8c9
commit 89357b96d4
11 changed files with 163 additions and 73 deletions

1
.gitignore vendored
View File

@ -46,6 +46,7 @@ cmake-build-debug
*.stackdump
util/Win_Check_Output.txt
# Let these ones be user specific, since we have so many different configurations
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/tasks.json
.vscode/last.sql

View File

@ -49,6 +49,8 @@ Once you have a good feel for how layers work and what you can do, you can get m
Layers stack on top of each other in numerical order. When determining what a keypress does, QMK scans the layers from the top down, stopping when it reaches the first active layer that is not set to `KC_TRNS`. As a result if you activate a layer that is numerically lower than your current layer, and your current layer (or another layer that is active and higher than your target layer) has something other than `KC_TRNS`, that is the key that will be sent, not the key on the layer you just activated. This is the cause of most people's "why doesn't my layer get switched" problem.
Sometimes, you might want to switch between layers in a macro or as part of a tap dance routine. `layer_on` activates a layer, and `layer_off` deactivates it. More layer-related functions can be found in [action_layer.h](../tmk_core/common/action_layer.h).
# Modifier keys
These functions allow you to combine a mod with a keycode. When pressed the keydown for the mod will be sent first, and then *kc* will be sent. When released the keyup for *kc* will be sent and then the mod will be sent.
@ -145,6 +147,8 @@ You can control the behavior of one shot keys by defining these in `config.h`:
* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](#mod-tap), not the `KC_*` codes.
* `OSL(layer)` - momentary switch to *layer*.
Sometimes, you want to activate a one-shot layer as part of a macro or tap dance routine. To do this, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`. For more complicated actions, take a look at the oneshot implementation in [`process_record`](../tmk_core/common/action.c#L429).
## Permissive Hold
As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:

View File

@ -5,7 +5,7 @@ This nyquist layout is based on my Ergodox Infinity Layout, which is [here](../.
## Layers
### QWERTY
The shift modifiers on this layer all use OSM to allow for quick single capitalization. Press and hold F to go to the VIM movement layer. Layer is also a one-shot layer toggle, and can be held down to type multiple characters on the Lower layer. Game is a regular toggle layer.
The shift modifiers on this layer all use OSM to allow for quick single capitalization. LwrVIM acts a combo one-shot toggle and momentary layer toggle. Tap once to make the next key be sent on the Lower. Hold to move to the Lower layer until release. Tap and hold (so press, release, press and hold) to move to the VIM layer until release. Game is a regular toggle layer.
```
Qwerty
@ -14,11 +14,11 @@ Qwerty
|------+------+------+------+------+------+------+------+------+------+------+------|
| Tab | Q | W | E | R | T | Y | U | I | O | P | \ |
|------+------+------+------+------+-------------+------+------+------+------+------|
| Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " |
| Esc | A | S | D | F | G | H | J | K | L | ; | " |
|------+------+------+------+------+------|------+------+------+------+------+------|
| Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift|
|------+------+------+------+------+------+------+------+------+------+------+------|
| Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Lock | = | Game | Del |
| Ctrl | Alt | F4 | GUI |LwrVIM| Bksp | Spc | Ent | Lock | = | RAlt | Del |
`-----------------------------------------------------------------------------------'
```
@ -36,7 +36,7 @@ Lower
|------+------+------+------+------+------|------+------+------+------+------+------|
| APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ |
|------+------+------+------+------+------+------+------+------+------+------+------|
| Pscr | | | | | | 0 | . | = | Prev | Next | Play |
| Pscr | | | | | GAME | 0 | . | = | Prev | Next | Play |
`-----------------------------------------------------------------------------------'
```

View File

@ -1,20 +1,18 @@
#include "nyquist.h"
#include "action_layer.h"
#include "action_util.h"
#include "eeconfig.h"
#include "333fred.h"
extern keymap_config_t keymap_config;
#define _QWERTY 0
#define _LOWER 1
#define _VIM 2
#define _GAME 3
enum custom_macros {
DLEFT,
DRIGHT,
PSCREEN_APP
};
// Tap dance for layer transitions
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
@ -27,22 +25,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | \ |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " |
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Alt | + | Game | Del |
* | Ctrl | Alt | F4 | GUI |Lwr/VM| Bksp | Spc | Ent | Lock | = | Alt | Del |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP( \
[BASE] = KEYMAP( \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \
KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \
KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_LOCK, KC_EQL, TG(_GAME), KC_DEL \
KC_LCTL, KC_LALT, KC_F4, KC_LGUI, TD(TD_SYM_VIM), KC_BSPC, KC_SPC, KC_ENT, KC_LOCK, KC_EQL, KC_RALT, KC_DEL \
),
/* Lower
/* Symbols
* ,-----------------------------------------------------------------------------------.
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
* |------+------+------+------+------+-------------+------+------+------+------+------|
@ -52,36 +50,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Pscr | | | | | | 0 | . | = | Prev | Next | Play |
* | Pscr | | | | | GAME | 0 | . | = | Prev | Next | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = KEYMAP( \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE, KC_7, KC_8, KC_9, KC_ASTR, KC_RPRN, KC_F12, \
_______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV, KC_4, KC_5, KC_6, KC_PLUS, KC_RCBR, KC_PIPE, \
M(PSCREEN_APP), KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_1, KC_2, KC_3, KC_BSLS, KC_VOLD, KC_VOLU, \
KC_PSCR, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \
[SYMB] = KEYMAP( \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE, KC_7, KC_8, KC_9, KC_ASTR, KC_RPRN, KC_F12, \
_______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV, KC_4, KC_5, KC_6, KC_PLUS, KC_RCBR, KC_PIPE, \
M(PSCREEN_APP), KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_1, KC_2, KC_3, KC_BSLS, KC_VOLD, KC_VOLU, \
KC_PSCR, _______, _______, _______, _______, TG(GAME), KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \
),
/* Vim Movement (Hold down F)
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* | | | | LSHFT| | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | DLeft|DRight| LCTRL| | | Left | Down | Up | Right| | |
* | | DLeft|DRight| LCTRL| LGUI | | Left | Down | Up | Right| | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | LShft| | | | | | | |
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_VIM] = KEYMAP( \
[VIM] = KEYMAP( \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, M(DLEFT), M(DRIGHT), KC_LCTL, KC_LGUI, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, M(DLEFT), M(DRIGHT), KC_LCTL, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______ \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/* Gaming mode (Raise)
@ -98,12 +96,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Enter| | Lock | Bksp | Alt | Spc | Lower| Left | Up | Down | Right|QWERTY|
* `-----------------------------------------------------------------------------------'
*/
[_GAME] = KEYMAP( \
[GAME] = KEYMAP( \
KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \
KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LGUI, \
KC_ENT, _______, KC_LOCK, KC_BSPC, KC_LALT, KC_SPC, OSL(_LOWER), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TO(_QWERTY) \
KC_ENT, _______, KC_LOCK, KC_BSPC, KC_LALT, KC_SPC, OSL(SYMB), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TO(BASE) \
)
};
@ -133,3 +131,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
}
return MACRO_NONE;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap_dance_process_record(keycode);
return true;
}

View File

@ -1,6 +1,7 @@
KEY_LOCK_ENABLE = yes
NKRO_ENABLE = yes
CONSOLE_ENABLE = yes
CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes
ifndef QUANTUM_DIR
include ../../../../Makefile

View File

@ -5,24 +5,23 @@
,--------------------------------------------------. ,--------------------------------------------------.
| ` | 1 | 2 | 3 | 4 | 5 | = | | L1 | 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| TAB | Q | W | E | R | T | L2 | | L2 | Y | U | I | O | P | \ |
| TAB | Q | W | E | R | T | L1 | | L2 | Y | U | I | O | P | \ |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| Esc | A | S | D |LT 3,F| G |------| |------| H | J | K | L |; / : | ' |
|--------+------+------+------+------+------| L1 | |TT(3) |------+------+------+------+------+--------|
| Esc | A | S | D | F | G |------| |------| H | J | K | L | ; | ' |
|--------+------+------+------+------+------| L2 | |TT(3) |------+------+------+------+------+--------|
| LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|LCTRL | F4 | F5 | LGUI | LALT | | Left | Down | Up | Right| RGUI |
`----------------------------------' `----------------------------------'
,-------------. ,-------------.
| Copy | Paste| | Alt |Ctrl/Esc|
| Copy | Paste| | Copy | Paste |
,------|------|------| |------+--------+------.
| | | PgUp | | PgDn | | |
| Bcksp|OSL(2)|------| |------| Ent |Space |
| | | Del | |OSL(2)| | |
| | VIM | Del | |OSL(2)| | |
`--------------------' `----------------------'
```
* Double-click `;` to get a `:`
* Press-and-hold `f` to go to the movement layer
* For a single tap or single hold, OSL behaves like OSL(SYMB). For a tap + hold, it behaves like MO(VIM).
### Keymap 1: Code Layer
```
@ -38,7 +37,7 @@
| | | | | | | F12 |GoToIm| FAR | | |
`----------------------------------' `----------------------------------'
,-------------. ,---------------.
|Format|Build | | Test | DTest |
|Format|Build | | Copy | Paste |
,------|------|------| |------+--------+------.
| | |Refact| |Sort U| | |
| | |------| |------| | |
@ -46,13 +45,11 @@
`--------------------' `----------------------'
```
* Build - Visualt Studio Build Solution. Sends `CTRL + SHFT + B`
* DTest - Visual Studio Debug Test. Sends `CTRL + R, CTRL + T`
* FAR - Visual Studio Find All References. Sends `CTRL + K, R`
* Format - Visual Studio Format. Sends `CTRL + K, CTRL + D`
* GoToIm - Visual Studio Go To Implementation. Sends `CTRL + F12`
* Refact - Visual Studio Refactor. Sends `CTRL + R, R`
* Sort U - Visual Studio Sort Usings. Sends `CTRL + R, CTRL + G`
* Test - Visual Studio Run Test. Sends `CTRL + R, T`
### Keymap 2: Symbol Layer
@ -105,9 +102,9 @@
,--------------------------------------------------. ,--------------------------------------------------.
| | | | | | | | | | | | | | | |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| |KOpen |KType | | | | | | | Copy | | | | Paste| |
| |KOpen |KType | LSFT | | | | | | Copy | | | | Paste| |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| |DLeft |DRight| LCTL | | |------| |------| Left | Down | Up | Right| | |
| |DLeft |DRight| LCTL | LGUI | |------| |------| Left | Down | Up | Right| | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| |SFT_TB| Tab | | | | | | | | | | | | |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
@ -117,7 +114,7 @@
| | | | Home | End |
,------|------|------| |------+------+------.
| | | | | | | |
| | LSFT |------| |------| | |
| | |------| |------| | |
| | | | | | | |
`--------------------' `--------------------'
```

View File

@ -2,12 +2,7 @@
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#define BASE 0 // default layer
#define CODE 1 // code layer
#define SYMB 2 // symbols
#define MDIA 3 // media keys
#define MOVE 4 // movement layer
#include "333fred.h"
enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
@ -48,20 +43,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | = | | L1 | 6 | 7 | 8 | 9 | 0 | - |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | TAB | Q | W | E | R | T | L2 | | L2 | Y | U | I | O | P | \ |
* | TAB | Q | W | E | R | T | L1 | | L2 | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Esc | A | S | D |LT 3,F| G |------| |------| H | J | K | L | ; | ' |
* |--------+------+------+------+------+------| L1 | |MO(3) |------+------+------+------+------+--------|
* |--------+------+------+------+------+------| L2 | |MO(3) |------+------+------+------+------+--------|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCTRL | F4 | F5 | LGUI | LALT | | Left | Down | Up | Right| RGUI |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Copy | Paste| | Alt | Lock |
* | Copy | Paste| | Copy | Paste |
* ,------|------|------| |------+--------+------.
* | | | PgUp | | PgDn | | |
* | Bcksp|OSL(2)|------| |------| Ent |Space |
* | | | Del | | RCtrl| | |
* | | VIM | Del | | RCtrl| | |
* `--------------------' `----------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
@ -69,22 +64,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
KC_ESC, KC_A, KC_S, KC_D, LT(MOVE, KC_F),KC_G,
OSM(MOD_LSFT), CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(CODE),
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(CODE),
KC_ESC, KC_A, KC_S, KC_D, LT(VIM, KC_F),KC_G,
OSM(MOD_LSFT), CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(SYMB),
OSM(MOD_LCTL), KC_F4, KC_F5, KC_LGUI,KC_LALT,
LCTL(KC_C),LCTL(KC_V),
KC_PGUP,
KC_BSPC,OSL(SYMB), KC_DEL,
LCTL(KC_C), LCTL(KC_V),
KC_PGUP,
KC_BSPC,TD(TD_SYM_VIM), KC_DEL,
// right hand
TG(CODE), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MO(MDIA), KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), OSM(MOD_RSFT),
KC_LEFT,KC_DOWN,KC_UP, KC_RIGHT, KC_RGUI,
KC_RALT, KC_LOCK,
LCTL(KC_C), LCTL(KC_V),
KC_PGDN,
KC_RCTL, KC_ENT, KC_SPC
KC_RCTL, KC_ENT, KC_SPC
),
/* Keymap 1: Code Layer
*
@ -100,10 +95,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | F12 |GoToIm| FAR | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,---------------.
* |Format|Build | | Test | DTest |
* |Format|Build | | Copy | Paste |
* ,------|------|------| |------+--------+------.
* | | |Refact| |Sort U| | |
* | | |------| |------| | |
* | |ACCESS|------| |------| | |
* | | | | | | | |
* `--------------------' `----------------------'
*/
@ -126,7 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F12, M(GO_TO_IMPL),M(FIND_ALL_REF),KC_TRNS, KC_TRNS,
M(TEST), M(DEBUG_TEST),
LCTL(KC_C), LCTL(KC_V),
M(REMOVE_SORT_USINGS),
KC_TRNS, KC_TRNS, KC_TRNS
),
@ -218,9 +213,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | |KOpen |KType | | | | | | | Copy | | | | Paste| |
* | |KOpen |KType |LSHFT | | | | | | Copy | | | | Paste| |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | |DLeft |DRight|LCTRL |ACCESS| |------| |------| Left | Down | Up | Right| | |
* | |DLeft |DRight|LCTRL | LGUI | |------| |------| Left | Down | Up | Right| | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | |SFT_TB| TAB | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
@ -230,20 +225,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | Home | End |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | |LSHIFT|------| |------| | |
* | |ACCESS|------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
[MOVE] = LAYOUT_ergodox(
[VIM] = LAYOUT_ergodox(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, M(KEEPASS_OPEN),M(KEEPASS_TYPE),KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, M(DLEFT), M(DRIGHT), KC_LCTL, KC_TRNS, KC_TRNS,
KC_TRNS, M(KEEPASS_OPEN),M(KEEPASS_TYPE),KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, M(DLEFT), M(DRIGHT), KC_LCTL, KC_LGUI, KC_TRNS,
KC_TRNS, M(LSFT_TAB), KC_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_LSFT, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, LCTL(KC_C),KC_TRNS, KC_TRNS, KC_TRNS, LCTL(KC_V),KC_TRNS,
@ -349,6 +344,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap_dance_process_record(keycode);
switch (keycode) {
// dynamically generate these.
case EPRM:

View File

@ -3,6 +3,7 @@ LCD_ENABLE = yes
BACKLIGHT_ENABLE = yes
NKRO_ENABLE = yes
KEY_LOCK_ENABLE = yes
TAP_DANCE_ENABLE = yes

63
users/333fred/333fred.c Normal file
View File

@ -0,0 +1,63 @@
#include "333fred.h"
#include "quantum.h"
#include "action.h"
typedef enum {
SINGLE_TAP, SINGLE_HOLD, DOUBLE
} tap_dance_state_enum;
static tap_dance_state_enum tap_dance_state;
static bool tap_dance_active = false;
void tap_dance_layer_finished(qk_tap_dance_state_t *state, void *user_data) {
// Determine the current state
if (state->count == 1) {
if (state->interrupted || state->pressed == 0) tap_dance_state = SINGLE_TAP;
else tap_dance_state = SINGLE_HOLD;
} else {
// Handle any number of other taps as a VIM movement hold
tap_dance_state = DOUBLE;
}
switch (tap_dance_state) {
case SINGLE_TAP:
if (tap_dance_active) {
reset_oneshot_layer();
tap_dance_active = false;
} else {
set_oneshot_layer(SYMB, ONESHOT_START);
tap_dance_active = true;
}
break;
case SINGLE_HOLD:
layer_on(SYMB);
break;
case DOUBLE:
layer_on(VIM);
}
}
void tap_dance_layer_reset(qk_tap_dance_state_t *state, void *user_data) {
switch(tap_dance_state) {
case SINGLE_TAP:
clear_oneshot_layer_state(ONESHOT_PRESSED);
break;
case SINGLE_HOLD:
layer_off(SYMB);
break;
case DOUBLE:
layer_off(VIM);
break;
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_SYM_VIM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_layer_finished, tap_dance_layer_reset)
};
void tap_dance_process_record(uint16_t keycode) {
if (tap_dance_state == SINGLE_TAP && keycode != TD(TD_SYM_VIM)) {
tap_dance_active = false;
}
}

22
users/333fred/333fred.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef FRED_333
#define FRED_333
#include "quantum.h"
#define BASE 0
#define CODE 1 // code layer
#define SYMB 2
#define MDIA 3 // media keys
#define VIM 4
#define GAME 5
// Tap dance config shared between my keyboards
enum tap_dance_declarations {
TD_SYM_VIM = 0
};
void tap_dance_layer_finished(qk_tap_dance_state_t*, void*);
void tap_dance_layer_reset(qk_tap_dance_state_t*, void*);
void tap_dance_process_record(uint16_t);
#endif

2
users/333fred/rules.mk Normal file
View File

@ -0,0 +1,2 @@
SRC += 333fred.c