aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-03-10 05:19:51 +1100
committerJack Humbert <jack.humb@gmail.com>2018-03-09 13:19:51 -0500
commit0603dcb1be324e2a9500b5c97d405e93c895b476 (patch)
treee9a7f97006d7123ef274a8fbec2acdd9c4cd4b95
parent33134730047934639c98b766edf8e971833e930f (diff)
downloadqmk_firmware-0603dcb1be324e2a9500b5c97d405e93c895b476.tar.gz
qmk_firmware-0603dcb1be324e2a9500b5c97d405e93c895b476.zip
qwerty_code_friendly: minor updates (#2494)
* qwerty_code_friendly: minor updates - Correct mistake in ascii keymap. - Make lower right key delete again, but make it configurable. - Make double shift for double quotes optional. * qwerty_code_friendly: shift users title-caps
-rw-r--r--layouts/community/ergodox/qwerty_code_friendly/keymap.c101
-rw-r--r--layouts/community/ergodox/qwerty_code_friendly/readme.md32
2 files changed, 102 insertions, 31 deletions
diff --git a/layouts/community/ergodox/qwerty_code_friendly/keymap.c b/layouts/community/ergodox/qwerty_code_friendly/keymap.c
index 788c37d6e..f79a17290 100644
--- a/layouts/community/ergodox/qwerty_code_friendly/keymap.c
+++ b/layouts/community/ergodox/qwerty_code_friendly/keymap.c
@@ -12,6 +12,9 @@
12/* Personal preference (enable by passing EXTRAFLAGS=... to make). */ 12/* Personal preference (enable by passing EXTRAFLAGS=... to make). */
13/* #define CFQ_USE_MOMENTARY_LAYER_KEYS */ 13/* #define CFQ_USE_MOMENTARY_LAYER_KEYS */
14 14
15/* Holding right/left or left/right shift for single or double quote pair */
16/* #define CFQ_USE_SHIFT_QUOTES */
17
15#define CFQ_USE_DYNAMIC_MACRO 18#define CFQ_USE_DYNAMIC_MACRO
16 19
17#if !defined(CFQ_USER_KEY0) 20#if !defined(CFQ_USER_KEY0)
@@ -21,10 +24,10 @@
21# define CFQ_USER_KEY1 CFQ_KC_FN1 24# define CFQ_USER_KEY1 CFQ_KC_FN1
22#endif 25#endif
23#if !defined(CFQ_USER_KEY2) 26#if !defined(CFQ_USER_KEY2)
24# define CFQ_USER_KEY2 KC_LT 27# define CFQ_USER_KEY2 KC_INS
25#endif 28#endif
26#if !defined(CFQ_USER_KEY3) 29#if !defined(CFQ_USER_KEY3)
27# define CFQ_USER_KEY3 KC_GT 30# define CFQ_USER_KEY3 KC_NLCK
28#endif 31#endif
29#if !defined(CFQ_USER_KEY4) 32#if !defined(CFQ_USER_KEY4)
30# define CFQ_USER_KEY4 KC_BSPC 33# define CFQ_USER_KEY4 KC_BSPC
@@ -38,6 +41,9 @@
38#if !defined(CFQ_USER_KEY7) 41#if !defined(CFQ_USER_KEY7)
39# define CFQ_USER_KEY7 CFQ_KC_FN3 42# define CFQ_USER_KEY7 CFQ_KC_FN3
40#endif 43#endif
44#if !defined(CFQ_USER_KEY8)
45# define CFQ_USER_KEY8 KC_DEL
46#endif
41 47
42#ifndef CFQ_WORD_A 48#ifndef CFQ_WORD_A
43#define CFQ_WORD_A "" 49#define CFQ_WORD_A ""
@@ -118,14 +124,29 @@
118#define CFQ_WORD_Z "" 124#define CFQ_WORD_Z ""
119#endif 125#endif
120 126
121static const char *cfq_word_lut[26] = { 127/* lower and title capitals versions (setup at start). */
122 CFQ_WORD_A, CFQ_WORD_B, CFQ_WORD_C, CFQ_WORD_D, CFQ_WORD_E, CFQ_WORD_F, 128static char *cfq_word_lut[2][26] = {
123 CFQ_WORD_G, CFQ_WORD_H, CFQ_WORD_I, CFQ_WORD_J, CFQ_WORD_K, CFQ_WORD_L, 129 {
124 CFQ_WORD_M, CFQ_WORD_N, CFQ_WORD_O, CFQ_WORD_P, CFQ_WORD_Q, CFQ_WORD_R, 130 CFQ_WORD_A, CFQ_WORD_B, CFQ_WORD_C, CFQ_WORD_D, CFQ_WORD_E, CFQ_WORD_F,
125 CFQ_WORD_S, CFQ_WORD_T, CFQ_WORD_U, CFQ_WORD_V, CFQ_WORD_W, CFQ_WORD_X, 131 CFQ_WORD_G, CFQ_WORD_H, CFQ_WORD_I, CFQ_WORD_J, CFQ_WORD_K, CFQ_WORD_L,
126 CFQ_WORD_Y, CFQ_WORD_Z, 132 CFQ_WORD_M, CFQ_WORD_N, CFQ_WORD_O, CFQ_WORD_P, CFQ_WORD_Q, CFQ_WORD_R,
133 CFQ_WORD_S, CFQ_WORD_T, CFQ_WORD_U, CFQ_WORD_V, CFQ_WORD_W, CFQ_WORD_X,
134 CFQ_WORD_Y, CFQ_WORD_Z,
135 },
136 {NULL}
127}; 137};
128 138
139/* Storage for title-caps strings. */
140static char cfq_word_lut_title_caps[
141 sizeof(CFQ_WORD_A) + sizeof(CFQ_WORD_B) + sizeof(CFQ_WORD_C) + sizeof(CFQ_WORD_D) +
142 sizeof(CFQ_WORD_E) + sizeof(CFQ_WORD_F) + sizeof(CFQ_WORD_G) + sizeof(CFQ_WORD_H) +
143 sizeof(CFQ_WORD_I) + sizeof(CFQ_WORD_J) + sizeof(CFQ_WORD_K) + sizeof(CFQ_WORD_L) +
144 sizeof(CFQ_WORD_M) + sizeof(CFQ_WORD_N) + sizeof(CFQ_WORD_O) + sizeof(CFQ_WORD_P) +
145 sizeof(CFQ_WORD_Q) + sizeof(CFQ_WORD_R) + sizeof(CFQ_WORD_S) + sizeof(CFQ_WORD_T) +
146 sizeof(CFQ_WORD_U) + sizeof(CFQ_WORD_V) + sizeof(CFQ_WORD_W) + sizeof(CFQ_WORD_X) +
147 sizeof(CFQ_WORD_Y) + sizeof(CFQ_WORD_Z)
148];
149
129#define BASE 0 /* default layer */ 150#define BASE 0 /* default layer */
130#define SYMB 1 /* symbols */ 151#define SYMB 1 /* symbols */
131#define MDIA 2 /* media keys */ 152#define MDIA 2 /* media keys */
@@ -186,13 +207,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
186 * |--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------| 207 * |--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------|
187 * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | 208 * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
188 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 209 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
189 * | LCtl |Super | Alt | ~L1 |Space | | Left | Down | Up |Right | Ins | 210 * | LCtl |Super | Alt | ~L1 |Space | | Left | Down | Up |Right | Del |
190 * `----------------------------------' `----------------------------------' 211 * `----------------------------------' `----------------------------------'
191 * ,-------------. ,-------------. 212 * ,-------------. ,-------------.
192 * | < | > | | Home | End | 213 * | Ins |NumClk| | Home | End |
193 * ,------+------+------| |------+------+------. 214 * ,------+------+------| |------+------+------.
194 * | | |CapsLk| | PgUp | | | 215 * | | |CapsLk| | PgUp | | |
195 * |BSpace| Del |------| |------| ~L2 |Space | 216 * |BSpace| Del |------| |------| ~L2 |Enter |
196 * | | | ~L3 | | PgDn | | | 217 * | | | ~L3 | | PgDn | | |
197 * `--------------------' `--------------------' 218 * `--------------------' `--------------------'
198 * 219 *
@@ -207,7 +228,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
207 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 228 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
208 * | | | | | | | | | | | | | | | | 229 * | | | | | | | | | | | | | | | |
209 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 230 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
210 * | | | | USR1 | | | | | | | | 231 * | | | | USR1 | | | | | | | USR8 |
211 * `----------------------------------' `----------------------------------' 232 * `----------------------------------' `----------------------------------'
212 * ,-------------. ,-------------. 233 * ,-------------. ,-------------.
213 * | USR2 | USR3 | | | | 234 * | USR2 | USR3 | | | |
@@ -235,7 +256,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
235 KC_RPRN, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 256 KC_RPRN, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
236 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 257 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
237 KC_RBRC, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, 258 KC_RBRC, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
238 KC_LEFT, KC_DOWN,KC_UP, KC_RGHT, KC_INS, 259 KC_LEFT, KC_DOWN,KC_UP, KC_RGHT, CFQ_USER_KEY8,
239 KC_HOME, KC_END, 260 KC_HOME, KC_END,
240 KC_PGUP, 261 KC_PGUP,
241 KC_PGDN, CFQ_KC_FN2, KC_ENT 262 KC_PGDN, CFQ_KC_FN2, KC_ENT
@@ -380,6 +401,15 @@ const uint16_t PROGMEM fn_actions[] = {
380 [3] = ACTION_LAYER_TAP_TOGGLE(WORD), /* FN3 - Momentary Layer 3 (Words) */ 401 [3] = ACTION_LAYER_TAP_TOGGLE(WORD), /* FN3 - Momentary Layer 3 (Words) */
381}; 402};
382 403
404
405 #define WITHOUT_MODS(...) \
406 do { \
407 uint8_t _real_mods = get_mods(); \
408 clear_mods(); \
409 { __VA_ARGS__ } \
410 set_mods(_real_mods); \
411 } while (0)
412
383bool process_record_user(uint16_t keycode, keyrecord_t *record) { 413bool process_record_user(uint16_t keycode, keyrecord_t *record) {
384#ifdef CFQ_USE_DYNAMIC_MACRO 414#ifdef CFQ_USE_DYNAMIC_MACRO
385 if (!process_record_dynamic_macro(keycode, record)) { 415 if (!process_record_dynamic_macro(keycode, record)) {
@@ -468,27 +498,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
468 return false; 498 return false;
469 } 499 }
470 break; 500 break;
501#ifdef CFQ_USE_SHIFT_QUOTES
471 case KC_LSHIFT: /* '' */ 502 case KC_LSHIFT: /* '' */
472 if (record->event.pressed && (keyboard_report->mods & (MOD_BIT(KC_RSFT)))) { 503 if (record->event.pressed && (keyboard_report->mods & (MOD_BIT(KC_RSFT)))) {
473 clear_mods(); 504 WITHOUT_MODS({
474 SEND_STRING("''" SS_TAP(X_LEFT) SS_DOWN(X_RSHIFT) SS_DOWN(X_LSHIFT)); 505 SEND_STRING("''" SS_TAP(X_LEFT) SS_DOWN(X_RSHIFT) SS_DOWN(X_LSHIFT));
506 });
475 return false; 507 return false;
476 } 508 }
477 break; 509 break;
478 case KC_RSHIFT: /* "" */ 510 case KC_RSHIFT: /* "" */
479 if (record->event.pressed && (keyboard_report->mods & (MOD_BIT(KC_LSFT)))) { 511 if (record->event.pressed && (keyboard_report->mods & (MOD_BIT(KC_LSFT)))) {
480 clear_mods(); 512 WITHOUT_MODS({
481 SEND_STRING("\x22\x22" SS_TAP(X_LEFT) SS_DOWN(X_LSHIFT) SS_DOWN(X_RSHIFT)); 513 SEND_STRING("\x22\x22" SS_TAP(X_LEFT) SS_DOWN(X_LSHIFT) SS_DOWN(X_RSHIFT));
514 });
482 return false; 515 return false;
483 } 516 }
484 break; 517 break;
485 518#endif /* CFQ_USE_SHIFT_QUOTES */
486 case M_WORD_A...M_WORD_Z: 519 case M_WORD_A...M_WORD_Z:
487 { 520 {
488 const char *word = cfq_word_lut[keycode - M_WORD_A]; 521 uint8_t shift_index = (keyboard_report->mods & (MOD_BIT(KC_RSFT) | MOD_BIT(KC_LSFT))) ? 1 : 0;
522 const char *word = cfq_word_lut[shift_index][keycode - M_WORD_A];
489 if (record->event.pressed) { 523 if (record->event.pressed) {
490 if (*word) { 524 if (*word) {
491 send_string(word); 525 WITHOUT_MODS({
526 send_string(word);
527 });
492 } 528 }
493 return false; 529 return false;
494 } 530 }
@@ -502,6 +538,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
502/* Runs just one time when the keyboard initializes. */ 538/* Runs just one time when the keyboard initializes. */
503void matrix_init_user(void) { 539void matrix_init_user(void) {
504 540
541 /* Duplicate 'cfq_word_lut[0][...]' into 'cfq_word_lut[1][...]' */
542 {
543 char *d = cfq_word_lut_title_caps;
544 for (uint16_t i = 0; i < 26; i++) {
545 char *s = cfq_word_lut[0][i];
546 cfq_word_lut[1][i] = d;
547 while ((*d++ = *s++)) {}
548 }
549 }
550 /* Title caps. */
551 for (uint16_t i = 0; i < 26; i++) {
552 char *w = cfq_word_lut[1][i];
553 bool prev_is_alpha = false;
554 if (*w) {
555 while (*w) {
556 bool is_lower = (*w >= 'a' && *w <= 'z');
557 bool is_upper = (*w >= 'A' && *w <= 'Z');
558 if (prev_is_alpha == false && is_lower) {
559 *w -= ('a' - 'A');
560 }
561 prev_is_alpha = is_lower || is_upper;
562 w++;
563 }
564 }
565 }
505}; 566};
506 567
507/* Runs constantly in the background, in a loop. */ 568/* Runs constantly in the background, in a loop. */
diff --git a/layouts/community/ergodox/qwerty_code_friendly/readme.md b/layouts/community/ergodox/qwerty_code_friendly/readme.md
index 231123b78..29a04e689 100644
--- a/layouts/community/ergodox/qwerty_code_friendly/readme.md
+++ b/layouts/community/ergodox/qwerty_code_friendly/readme.md
@@ -3,6 +3,9 @@
3- This layout aims to balance muscle memory from a typical QWERTY layout 3- This layout aims to balance muscle memory from a typical QWERTY layout
4 with having keys used for software development easily accessible. 4 with having keys used for software development easily accessible.
5 5
6 The this layout is a normalized qwerty,
7 with some configurable keys left thumb cluster so you can use it more as needed.
8
6- Arrow keys follow VIM convention 9- Arrow keys follow VIM convention
7 (the media layer even uses arrow keys for HJKL). 10 (the media layer even uses arrow keys for HJKL).
8 11
@@ -21,13 +24,6 @@
21 however using the larger thumb cluster 24 however using the larger thumb cluster
22 ended up being more of a reach while typing. 25 ended up being more of a reach while typing.
23 26
24- There is a handy shortcut for writing quotes that inserts the cursor
25 between the quotation marks.
26
27 Holding LShift, then RShift types: "" (then presses left).
28
29 Holding RShift, then LShift types: '' (then presses left).
30
31## Configuration 27## Configuration
32 28
33Some optional behavior is configurable without editing the code 29Some optional behavior is configurable without editing the code
@@ -37,6 +33,14 @@ using `CFQ_` prefixed defines which can be set by passing `EXTRAFLAGS` to make.
37 (0..7) are used for custom-keys 33 (0..7) are used for custom-keys
38- `CFQ_USE_MOMENTARY_LAYER_KEYS` 34- `CFQ_USE_MOMENTARY_LAYER_KEYS`
39 is used to prevent layer keys from toggling when tapped. 35 is used to prevent layer keys from toggling when tapped.
36- `CFQ_USE_SHIFT_QUOTES`
37 an optional handy shortcut for writing quotes that inserts the
38 cursor between the quotation marks.
39
40 Holding LShift, then RShift types: "" (then presses left).
41
42 Holding RShift, then LShift types: '' (then presses left).
43
40- `CFQ_WORD_[A-Z]` 44- `CFQ_WORD_[A-Z]`
41 defines can bind a key to an entire user defined word. 45 defines can bind a key to an entire user defined word.
42 46
@@ -54,13 +58,13 @@ using `CFQ_` prefixed defines which can be set by passing `EXTRAFLAGS` to make.
54|--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------| 58|--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------|
55| LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | 59| LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
56`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 60`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
57 | LCtl |Super | Alt | ~L1 |Space | | Left | Down | Up |Right | Ins | 61 | LCtl |Super | Alt | ~L1 |Space | | Left | Down | Up |Right | Del |
58 `----------------------------------' `----------------------------------' 62 `----------------------------------' `----------------------------------'
59 ,-------------. ,-------------. 63 ,-------------. ,-------------.
60 | < | > | | Home | End | 64 | Ins |NumClk| | Home | End |
61 ,------+------+------| |------+------+------. 65 ,------+------+------| |------+------+------.
62 | | |CapsLk| | PgUp | | | 66 | | |CapsLk| | PgUp | | |
63 |BSpace| Del |------| |------| ~L2 |Space | 67 |BSpace| Del |------| |------| ~L2 |Enter |
64 | | | ~L3 | | PgDn | | | 68 | | | ~L3 | | PgDn | | |
65 `--------------------' `--------------------' 69 `--------------------' `--------------------'
66 70
@@ -75,7 +79,7 @@ Optional overrides: see CFQ_USER_KEY# defines.
75|--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 79|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
76| | | | | | | | | | | | | | | | 80| | | | | | | | | | | | | | | |
77`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 81`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
78 | | | | USR1 | | | | | | | | 82 | | | | USR1 | | | | | | | USR8 |
79 `----------------------------------' `----------------------------------' 83 `----------------------------------' `----------------------------------'
80 ,-------------. ,-------------. 84 ,-------------. ,-------------.
81 | USR2 | USR3 | | | | 85 | USR2 | USR3 | | | |
@@ -166,6 +170,12 @@ eg: `-DCFQ_WORD_E=\"my@email.com\"`
166 170
167## Changelog 171## Changelog
168 172
173- 2018/03/08
174 Add `CFQ_USE_SHIFT_QUOTES` option.
175 Add `CFQ_USER_KEY8` key.
176
177 When holding shift `CFQ_WORD_[A-Z]` use title caps.
178
169- 2018/03/06 179- 2018/03/06
170 Add layer for user defined words (replaces `CFQ_USE_EXPEREMENTAL_LAYER`). 180 Add layer for user defined words (replaces `CFQ_USE_EXPEREMENTAL_LAYER`).
171 181