diff --git a/keyboards/blu/vimclutch/info.json b/keyboards/blu/vimclutch/info.json new file mode 100644 index 0000000000..33b126dc4e --- /dev/null +++ b/keyboards/blu/vimclutch/info.json @@ -0,0 +1,26 @@ +{ + "keyboard_name": "vimclutch", + "manufacturer": "blu", + "url": "https://github.com/blu006/vimclutch_hw", + "maintainer": "blu006", + "usb": { + "vid": "0xFEED", + "pid": "0x6060", + "device_version": "0.0.1" + }, + "development_board": "promicro", + "diode_direction": "ROW2COL", + "matrix_pins": { + "cols": ["B3", "B2", "B6"], + "rows": ["B5"] + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "k00", "x": 0, "y": 0, "matrix": [0, 0]}, + {"label": "k01", "x": 1, "y": 0, "matrix": [0, 1]}, + {"label": "k02", "x": 2, "y": 0, "matrix": [0, 2]} + ] + } + } +} diff --git a/keyboards/blu/vimclutch/keymaps/default/keymap.c b/keyboards/blu/vimclutch/keymaps/default/keymap.c new file mode 100644 index 0000000000..49eaa2b881 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/default/keymap.c @@ -0,0 +1,58 @@ +/* Copyright 2023 Brandon Lu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +enum layer_names { + _VC, + _VIM +}; + +enum my_keycodes { + USER_CLUTCH = QK_USER +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_VC] = LAYOUT( + TO(_VC), TO(_VIM), KC_F13 + ), + + [_VIM] = LAYOUT( + TO(_VC), TO(_VIM), USER_CLUTCH + ) +}; + +/* Layer-specific lighting */ +layer_state_t layer_state_set_user(layer_state_t state) { + writePin(F4, !layer_state_cmp(state, _VC)); + writePin(F5, !layer_state_cmp(state, _VIM)); + return state; +}; + +/* Define vim-clutching */ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case USER_CLUTCH: + if (record->event.pressed) { + tap_code_delay(KC_ESC, 50); + tap_code_delay(KC_A, 50); + } else { + tap_code_delay(KC_ESC, 50); + } + break; + } + return true; +}; diff --git a/keyboards/blu/vimclutch/keymaps/default/readme.md b/keyboards/blu/vimclutch/keymaps/default/readme.md new file mode 100644 index 0000000000..dfe9741ad4 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/default/readme.md @@ -0,0 +1,7 @@ +# Default keymap for the vim clutch + +The two enclosure tactile switches change between modes "voice chat" (default) and "vim clutch." + +The voice chat mode uses `F13` to activate or deactivate push-to-talk. + +The vim clutch uses the `ESC` and `a` keys to clutch into and out of vim. diff --git a/keyboards/blu/vimclutch/keymaps/vc_i/keymap.c b/keyboards/blu/vimclutch/keymaps/vc_i/keymap.c new file mode 100644 index 0000000000..b42f2ca0f0 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/vc_i/keymap.c @@ -0,0 +1,58 @@ +/* Copyright 2023 Brandon Lu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +enum layer_names { + _VC, + _VIM +}; + +enum my_keycodes { + USER_CLUTCH = QK_USER +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_VC] = LAYOUT( + TO(_VC), TO(_VIM), KC_F13 + ), + + [_VIM] = LAYOUT( + TO(_VC), TO(_VIM), USER_CLUTCH + ) +}; + +/* Layer-specific lighting */ +layer_state_t layer_state_set_user(layer_state_t state) { + writePin(F4, !layer_state_cmp(state, _VC)); + writePin(F5, !layer_state_cmp(state, _VIM)); + return state; +}; + +/* Define vim-clutching */ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case USER_CLUTCH: + if (record->event.pressed) { + tap_code_delay(KC_ESC, 50); + tap_code_delay(KC_I, 50); + } else { + tap_code_delay(KC_ESC, 50); + } + break; + } + return true; +}; diff --git a/keyboards/blu/vimclutch/keymaps/vc_i/readme.md b/keyboards/blu/vimclutch/keymaps/vc_i/readme.md new file mode 100644 index 0000000000..1c2506a060 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/vc_i/readme.md @@ -0,0 +1,7 @@ +# "Traditionalist" keymap for the vim clutch + +The two enclosure tactile switches change between modes "voice chat" (default) and "vim clutch." + +The voice chat mode uses `F13` to activate or deactivate push-to-talk. + +The vim clutch uses the `ESC` and `i` keys to clutch into and out of vim. diff --git a/keyboards/blu/vimclutch/keymaps/vim_ai/keymap.c b/keyboards/blu/vimclutch/keymaps/vim_ai/keymap.c new file mode 100644 index 0000000000..107ea4bfd1 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/vim_ai/keymap.c @@ -0,0 +1,67 @@ +/* Copyright 2021 John Mueller + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +enum layer_names { + _VIMA, + _VIMI +}; + +enum my_keycodes { + CLUTCH_A = QK_USER, + CLUTCH_I +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_VIMA] = LAYOUT( + TO(_VIMA), TO(_VIMI), CLUTCH_A + ), + + [_VIMI] = LAYOUT( + TO(_VIMA), TO(_VIMI), CLUTCH_I + ) +}; + +/* Layer-specific lighting */ +layer_state_t layer_state_set_user(layer_state_t state) { + writePin(F4, !layer_state_cmp(state, _VIMA)); + writePin(F5, !layer_state_cmp(state, _VIMI)); + return state; +}; + +/* Define vim-clutching */ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case CLUTCH_A: + if (record->event.pressed) { + tap_code_delay(KC_ESC, 50); + tap_code_delay(KC_A, 50); + } else { + tap_code_delay(KC_ESC, 50); + } + break; + case CLUTCH_I: + if (record->event.pressed) { + tap_code_delay(KC_ESC, 50); + tap_code_delay(KC_I, 50); + } else { + tap_code_delay(KC_ESC, 50); + } + break; + } + return true; +}; diff --git a/keyboards/blu/vimclutch/keymaps/vim_ai/readme.md b/keyboards/blu/vimclutch/keymaps/vim_ai/readme.md new file mode 100644 index 0000000000..b1521819f9 --- /dev/null +++ b/keyboards/blu/vimclutch/keymaps/vim_ai/readme.md @@ -0,0 +1,9 @@ +# Hardcore AI keymap for the vim clutch + +The two enclosure tactile switches change between different ways of using the vim clutch. + +The first vim clutch mode uses the `ESC` and `a` keys to clutch into and out of vim. + +The second vim clutch mode uses the `ESC` and `i` keys to clutch into and out of vim. + +These different modes can be combined with shift when using vim to jump to the end or the beginning of a line. The first mode with `a` jumps to the end. The second mode with `i` jumps to the beginning. diff --git a/keyboards/blu/vimclutch/readme.md b/keyboards/blu/vimclutch/readme.md new file mode 100644 index 0000000000..bbc6b98260 --- /dev/null +++ b/keyboards/blu/vimclutch/readme.md @@ -0,0 +1,36 @@ +# blu vimclutch + +[blu006](https://github.com/blu006)'s vimclutch implementation using QMK + +* Keyboard Maintainer: [blu006](https://github.com/blu006) +* Hardware Supported: [github link](https://github.com/blu006/vimclutch_hw) +* Hardware Vendors Listed on the Page + +This keyboard is designed to be placed from left-to-right with the USB-B micro port aligned to the left side and the widest side horizontally aligned. Some may call this the "transverse" orientation. The two tactile buttons are for layer switching and are numbered from left-to-right. The default state is for the leftmost layer to be active. With the default layout, this is the "voice chat" mode which uses `F13` as a push-to-talk button. + +On the default keymap, here's what happens with your clutch: +* On press, `ESC` and then `a` are pressed. +* On release, `ESC` is pressed + +You can also use the shift key on your keyboard to jump to the end of line. + +Here are some included keymaps and their modes to get you started: +* default: voice chat and vim clutch +* vc_i: the same as default but using `i` instead of `a` +* vim_ai: vim clutch only, selectable between `a` and `i` + +Also includes a mode for single-keypress in case of "push to talk clutch" + +Make example for this keyboard after setting up your development environment: + + make blu/vimclutch:default + +Flashing example for this keyboard: + + make blu/vimclutch:default + +## Bootloader + +Reset button on the reverse side of the enclosure for initializing flashing. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/blu/vimclutch/rules.mk b/keyboards/blu/vimclutch/rules.mk new file mode 100644 index 0000000000..837f4bffb5 --- /dev/null +++ b/keyboards/blu/vimclutch/rules.mk @@ -0,0 +1 @@ +# This file is intentionally left blank diff --git a/keyboards/blu/vimclutch/vimclutch.c b/keyboards/blu/vimclutch/vimclutch.c new file mode 100644 index 0000000000..5add11ee4f --- /dev/null +++ b/keyboards/blu/vimclutch/vimclutch.c @@ -0,0 +1,25 @@ +/* +Copyright 2023 Brandon Lu + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "quantum.h" + +void keyboard_pre_init_kb(void) +{ + setPinOutput(F4); + setPinOutput(F5); + + keyboard_pre_init_user(); +};