Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blu vimclutch #20060

Merged
merged 14 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions keyboards/blu/vimclutch/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"keyboard_name": "vimclutch",
"manufacturer": "blu",
"url": "https://github.com/blu006/vimclutch_hw",
"maintainer": "blu006",
"usb": {
"vid": "0xFEED",
"pid": "0x6060",
"device_version": "0.0.1"
},
"processor": "atmega32u4",
"bootloader": "caterina",
blu006 marked this conversation as resolved.
Show resolved Hide resolved
"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]}
]
}
}
}
58 changes: 58 additions & 0 deletions keyboards/blu/vimclutch/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
};
7 changes: 7 additions & 0 deletions keyboards/blu/vimclutch/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -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.
58 changes: 58 additions & 0 deletions keyboards/blu/vimclutch/keymaps/vc_i/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
};
7 changes: 7 additions & 0 deletions keyboards/blu/vimclutch/keymaps/vc_i/readme.md
Original file line number Diff line number Diff line change
@@ -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.
67 changes: 67 additions & 0 deletions keyboards/blu/vimclutch/keymaps/vim_ai/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
};
9 changes: 9 additions & 0 deletions keyboards/blu/vimclutch/keymaps/vim_ai/readme.md
Original file line number Diff line number Diff line change
@@ -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.
36 changes: 36 additions & 0 deletions keyboards/blu/vimclutch/readme.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions keyboards/blu/vimclutch/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is intentionally left blank
25 changes: 25 additions & 0 deletions keyboards/blu/vimclutch/vimclutch.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"

void keyboard_pre_init_kb(void)
{
setPinOutput(F4);
setPinOutput(F5);

keyboard_pre_init_user();
};