Upgrade to Pro — share decks privately, control downloads, hide ads and more …

キーボードをカスタムしてプログラミング環境を良くした話 / Improved programm...

キーボードをカスタムしてプログラミング環境を良くした話 / Improved programming environment with customizing keybords

2018/09/08 builderscon tokyo 2018 の LT スライドです。
Elixir の `|>` 演算子を1キー押すだけで入力できるようにする話です。

Takayuki Matsubara

September 08, 2018
Tweet

More Decks by Takayuki Matsubara

Other Decks in Programming

Transcript

  1. 3

  2. !

  3. QMK ͰಠࣗΩʔϚοϓ࡞Δ४උ # fork ͨ͠΋ͷΛ clone ͢Δͷ͕ΦεεϝͰ͢ $ git clone

    [email protected]:qmk/qmk_firmware.git $ cd qmk_firmware # ରԠ͢ΔΩʔϘʔυͷ keymap.c Λมߋ͢Δײ͡ɻ # ҎԼ͸ Infinity ErgoDox ͷྫ $ cp -r keyboards/ergodox_infinity/keymaps/{default,your_own} $ vi keyboards/ergodox_infinity/keymaps/your_own/keymap.c
  4. QMK Λ࢖͏͜ͱͰΩʔϚοϓม͑ΒΕΔ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap

    0: Basic layer * * ,--------------------------------------------------. ,--------------------------------------------------. * | Esc | 1 | 2 | 3 | 4 | 5 | Del | | |> | 6 | 7 | 8 | 9 | 0 | - | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | Tab | Q | W | E | R | T | ` | | ' | Y | U | I | O | P | BkSp | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | LCtrl | A | S | D | F | G |------| |------| H | J | K | L |; / L1| Enter | * |--------+------+------+------+------+------| Hyper| | B |------+------+------+------+------+--------| * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * |Grv/L1| Meh |AltShf| LALT | LGui| | \ | = | [ | ] | ~L1 | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. * | Up | Down | | Left | Right | * ,------|------|------| |------+--------+------. * | | | Home | | PgUp | | | * | Space| LANG1|------| |------| LANG2 |Enter | * | | | End | | PgDn | | /L2 | * `--------------------' `----------------------' */ https://github.com/ma2gedev/qmk_firmware/blob/ma2gedev/keyboards/ergodox/keymaps/ma2gedev/keymap.c
  5. ͞ΒʹϚΫϩͷػೳ͕͋Γ·͢ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {

    switch(id) { case 0: if (record->event.pressed) { SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); } break; /* লུ */ } return MACRO_NONE; };
  6. ϚΫϩΛ௥Ճ͢Δ͜ͱͰύΠϓԋࢉࢠΛ ࣮ݱͯ͠Έ·͠ΐ͏ /* @action_get_macro ʹҎԼΛ௥Ճ */ case 2: if (record->event.pressed)

    { // For Elixir pipe operator SEND_STRING ("|>"); } break; /* keymaps ͷ഑ྻͰΧελϚΠζ͍ͨ͠ΩʔͷϚοϐϯάΛҎԼʹมߋ */ KEYMAP(..., M(2), ...)
  7. !!!