diff options
author | xton <cmdpix@mac.com> | 2018-05-14 06:02:06 +0200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-05-14 06:02:06 +0200 |
commit | 47f03bd5a4195c44fe7d6fbca0ba8b66cd3da0fa (patch) | |
tree | abecbaa7f3030979f198c3dfd35e9bc5569ac13e | |
parent | 70e60b0a0cbcc000b0192cec8d32a2745a0b25fa (diff) | |
download | qmk_firmware-47f03bd5a4195c44fe7d6fbca0ba8b66cd3da0fa.tar.gz qmk_firmware-47f03bd5a4195c44fe7d6fbca0ba8b66cd3da0fa.tar.xz |
Xton has a dz60 (#2952)
* FORK!
* WIP - just how i like it
* empty
* more movement
* mouse keys
* more vimminess
* append/insert shift
* WIP - vim macros
* blocked out layer below in cmd mode.
also, about to restart my cmd approach.
* WIP - new vim layer
ripoff of the ergodox one, but rewritten as a state machine.
* debugged some, got key repeat working
* moooar coverage
* moooar coverage
* regular vis mode
* basically done with basics.
* some refactoring
- common movement sequences into helper function
- added some rgb controls
* modkey passthru feature
* stdized on cmd-left/right instead of ctrl-a/e
sadly. as there's no reliable shift-ctrl-e
* indicator lights
* moved vim layer into userspace
* cleaned up some yanking edge cases
* docs and some tweaks to layerescapes
* updated/added license strings
* updated comments
* moved config changes to keymap
* spurious changes removed
* cleanup pass, HT drashna for suggestions
- used _keymap() pattern to better modularize event processing in userspace
- made some static things static
- removed unused function
- improved reset.
* dz60 started. keymaps done.
* bugfixes: missing state change in d-, lspace should toggle vim mode.
* Caps lock indicator -> vim indicator.
And adjusted mousekey settings.
* don't actually need the second move trigger and it makes typing less responsive.
* some oppurtunistic bugfixing from my other keyboard (sorry)
* added readme for my dz60 keymap.
* bugfixing and comments updated (niu_mini)
* cleanup as suggested from review
-rw-r--r-- | keyboards/dz60/keymaps/xtonhasvim/config.h | 17 | ||||
-rw-r--r-- | keyboards/dz60/keymaps/xtonhasvim/keymap.c | 92 | ||||
-rw-r--r-- | keyboards/dz60/keymaps/xtonhasvim/readme.md | 10 | ||||
-rw-r--r-- | keyboards/niu_mini/keymaps/xtonhasvim/keymap.c | 24 | ||||
-rw-r--r-- | users/xtonhasvim/xtonhasvim.c | 9 |
5 files changed, 140 insertions, 12 deletions
diff --git a/keyboards/dz60/keymaps/xtonhasvim/config.h b/keyboards/dz60/keymaps/xtonhasvim/config.h new file mode 100644 index 000000000..b1f549e0b --- /dev/null +++ b/keyboards/dz60/keymaps/xtonhasvim/config.h @@ -0,0 +1,17 @@ +#ifndef CONFIG_KEYMAP_H +#define CONFIG_KEYMAP_H + +#include "../../config.h" + +// help for fast typist+dual function keys? +#define PERMISSIVE_HOLD + +/* speed up mousekeys a bit */ +#define MOUSEKEY_DELAY 50 +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_MAX_SPEED 8 +#define MOUSEKEY_TIME_TO_MAX 30 +#define MOUSEKEY_WHEEL_MAX_SPEED 8 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 40 + +#endif diff --git a/keyboards/dz60/keymaps/xtonhasvim/keymap.c b/keyboards/dz60/keymaps/xtonhasvim/keymap.c new file mode 100644 index 000000000..8a7419214 --- /dev/null +++ b/keyboards/dz60/keymaps/xtonhasvim/keymap.c @@ -0,0 +1,92 @@ +#include QMK_KEYBOARD_H +#include "xtonhasvim.h" + +enum layers { + _QWERTY, + _FUN, + _MOVE, + _MOUSE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(_MOVE,KC_SCLN), KC_QUOT, KC_ENT, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LALT, KC_LGUI, VIM_START, TG(_MOUSE), KC_SPC, KC_RGUI, KC_RALT, X_____X, KC_RCTL, MO(_FUN)), + + [_FUN] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL, + _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, RESET, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, BL_STEP, _______, _______, _______, _______, _______, _______, + TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_MOVE] = LAYOUT( + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X, X_____X, + _______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______, + TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + + [_MOUSE] = LAYOUT( + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, X_____X, KC_MS_UP, X_____X, X_____X, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_UP, KC_MS_WH_RIGHT, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X,KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, X_____X, X_____X, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, X_____X, X_____X, X_____X, + _______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______, + TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_EDIT] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + TO(_QWERTY), _______, _______, VIM_START, _______, _______, _______, _______, _______, _______, _______), + + [_CMD] = LAYOUT( + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, VIM_W, VIM_E, X_____X, X_____X, VIM_Y, VIM_U, VIM_I, VIM_O, VIM_P, X_____X, X_____X, X_____X, + VIM_ESC, VIM_A, VIM_S, VIM_D, X_____X, VIM_G, VIM_H, VIM_J, VIM_K, VIM_L, X_____X, X_____X, X_____X, + VIM_SHIFT, X_____X, X_____X, VIM_X, VIM_C, VIM_V, VIM_B, X_____X, X_____X, VIM_COMMA, VIM_PERIOD, X_____X, VIM_SHIFT,X_____X, + TO(_QWERTY), _______, _______, TO(_QWERTY), X_____X, X_____X, _______, _______, _______, _______, _______), + +}; + +#define LED_BIT 1 << 2 +#define LED_MASK ~(1 << 2) + +void user_led_on(void) { + DDRB |= LED_BIT; + PORTB &= LED_MASK; +} + +void user_led_off(void) { + DDRB &= ~LED_BIT; + PORTB &= LED_MASK; +} + +void matrix_init_user(void) { + user_led_off(); +} + +uint32_t layer_state_set_user(uint32_t state) { + static uint32_t last_state = 0; + + if(last_state != state) { + switch (biton32(state)) { + case _CMD: + user_led_on(); + break; + default: + user_led_off(); + break; + } + last_state = state; + } + return state; +} + + diff --git a/keyboards/dz60/keymaps/xtonhasvim/readme.md b/keyboards/dz60/keymaps/xtonhasvim/readme.md new file mode 100644 index 000000000..5d0e38a3e --- /dev/null +++ b/keyboards/dz60/keymaps/xtonhasvim/readme.md @@ -0,0 +1,10 @@ +# Xton has a DZ60 and it's Vimtastic! + +Mine has a split spacebar, no arrowkeys and an opaque case. Changes from the default layout: + +* Vim mode toggled by hitting left spacebar (see `users/xtonhasvim`). Reusing the capslock LED to indicate VIM is on. +* Momentary directional control by holding down `;`. +* Mousekeys toggled with middle space button. +* Escape is dual-function with control (which replaces capslock AS IT SHOULD BE). +* Bottom left key is the "halp my kb doesn't work" key that always dumps you back to QWERTY. + diff --git a/keyboards/niu_mini/keymaps/xtonhasvim/keymap.c b/keyboards/niu_mini/keymaps/xtonhasvim/keymap.c index 6c17df52a..6a23c0a2c 100644 --- a/keyboards/niu_mini/keymaps/xtonhasvim/keymap.c +++ b/keyboards/niu_mini/keymaps/xtonhasvim/keymap.c @@ -65,16 +65,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 | | | Home | End | | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | Next | Vol- | Vol+ | Play | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | + * | | Bail | | | | | | | | Bail | | * `-----------------------------------------------------------------------------------' */ [_LOWER] = { {KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_BSPC}, {KC_DEL, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_HOME, KC_END, _______}, - {_______, TO(_QWERTY), _______, _______, _______, _______, _______, OSL(_ADJUST), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, X_____X, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}, + {X_____X, TO(_QWERTY), _______, _______, _______, KC_BSPC, KC_BSPC, OSL(_ADJUST), _______, _______, TO(_QWERTY), X_____X} }, /* Raise @@ -83,16 +83,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | Next | Vol- | Vol+ | Play | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | + * | | Bail | | | | | | | | Bail | | * `-----------------------------------------------------------------------------------' */ [_RAISE] = { {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSPC}, {KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGUP, KC_PGDN, _______}, - {_______, TO(_QWERTY), _______, _______, OSL(_ADJUST), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}, + {X_____X, TO(_QWERTY), _______, _______, OSL(_ADJUST), X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X} }, @@ -104,14 +104,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+------+------+------+------+------|------+------+------+------+------+------| * |RGBMode+|Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | |Lite- | * |--------+------+------+------+------+------+------+------+------+------+------+------| - * | RGB | | | | | | | | | | | + * | RGB | Bail | | | | | | | | Bail | | * `-------------------------------------------------------------------------------------' */ [_ADJUST] = { {RGB_MODE_PLAIN, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL }, {RGB_MODE_REVERSE, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, RGB_VAI}, {RGB_MODE_FORWARD, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, RGB_VAD}, - {RGB_TOG, TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + {RGB_TOG, TO(_QWERTY), _______, _______, _______, _______, _______, _______, _______, _______, TO(_QWERTY), X_____X} }, @@ -121,7 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {TO(_QWERTY), X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X}, {_______, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X}, {_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______}, - {X_____X, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), _______} + {X_____X, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X} }, /* mouse layer @@ -130,7 +130,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {TO(_QWERTY), X_____X, X_____X, KC_MS_UP, X_____X, X_____X, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_UP, KC_MS_WH_RIGHT, X_____X, X_____X }, {_______, X_____X, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, X_____X, X_____X, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, X_____X, X_____X}, {_______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______}, - {_______, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), _______} + {_______, TO(_QWERTY), _______, _______, _______, X_____X, X_____X, _______, _______, _______, TO(_QWERTY), X_____X} }, /* vim edit mode. just has an escape -> _CMD key */ diff --git a/users/xtonhasvim/xtonhasvim.c b/users/xtonhasvim/xtonhasvim.c index 0ec331b68..a2ff2fa31 100644 --- a/users/xtonhasvim/xtonhasvim.c +++ b/users/xtonhasvim/xtonhasvim.c @@ -384,6 +384,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { simple_movement(keycode); CMD(KC_X); yank_was_lines = false; + vstate = VIM_START; break; case VIM_D: CMD(KC_LEFT); @@ -467,6 +468,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { SHIFT(KC_LEFT); // select to start of next word RELEASE(KC_LALT); break; + case VIM_P: + CMD(KC_V); + vstate = VIM_START; + break; case VIM_Y: CMD(KC_C); TAP(KC_RIGHT); @@ -525,6 +530,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { TAP(KC_RIGHT); vstate = VIM_START; break; + case VIM_P: + CMD(KC_V); + vstate = VIM_START; + break; case VIM_V: case VIM_ESC: TAP(KC_RIGHT); |