fmt: clang-format

This commit is contained in:
♥ Minnie ♥ 2024-08-08 13:37:18 +08:00
parent 3bfec02cd2
commit aa206ced07
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
3 changed files with 202 additions and 157 deletions

View file

@ -1,4 +1,4 @@
// Dictionary management // clang-format off
// name result chord keys // name result chord keys
COMB(NE_ESC, KC_ESC, RCTL_T(KC_N), RSFT_T(KC_E)) COMB(NE_ESC, KC_ESC, RCTL_T(KC_N), RSFT_T(KC_E))

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
// By default, the firmware does not know which side is which; it needs some help to determine that. // By default, the firmware does not know which side is which; it needs some
// help to determine that.
#define MASTER_LEFT #define MASTER_LEFT
// Alternate way in QMK to enter the embedded mass storage UF2 boot-loader of the RP2040. // Alternate way in QMK to enter the embedded mass storage UF2 boot-loader of
// the RP2040.
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U
@ -13,8 +15,12 @@
#define ENABLE_COMPILE_KEYCODE #define ENABLE_COMPILE_KEYCODE
// Tap-Hold configuration for home row mods. // Tap-Hold configuration for home row mods.
#define TAPPING_TERM 175 // time window in which you need to release the key in order to register a tap #define TAPPING_TERM \
#define PERMISSIVE_HOLD // activates the modifier when another key is pressed and released while the mod-tap is held, regardless of the tapping term 175 // time window in which you need to release the key in order to register a
// tap
#define PERMISSIVE_HOLD // activates the modifier when another key is pressed
// and released while the mod-tap is held, regardless of
// the tapping term
#define QUICK_TAP_TERM 0 // disable the auto-repeat feature entirely #define QUICK_TAP_TERM 0 // disable the auto-repeat feature entirely
#define ACHORDION_STREAK // disables hold behaviors when in a typing streak #define ACHORDION_STREAK // disables hold behaviors when in a typing streak

View file

@ -17,22 +17,25 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
// Awesome features created by getreuer // Awesome features created by getreuer
#include "features/sentence_case.h"
#include "features/achordion.h" #include "features/achordion.h"
#include "features/select_word.h"
#include "features/layer_lock.h" #include "features/layer_lock.h"
#include "features/select_word.h"
#include "features/sentence_case.h"
// https://github.com/getreuer/qmk-keymap/tree/main/features // https://github.com/getreuer/qmk-keymap/tree/main/features
// Our super useful layers, why we run qmk exclusively. // Our super useful layers, why we run qmk exclusively.
enum layers { enum layers {
CANARY, // This layout is the result of collaboration between many of the top layout creators from the AKL community. CANARY, // This layout is the result of collaboration between many of the top
NAV, // Inspired by the colemak communities extend layer, Brings navigation and editing to the home position. // layout creators from the AKL community.
NAV, // Inspired by the colemak communities extend layer, Brings navigation
// and editing to the home position.
NUM, // Contains our numpad and function keys. NUM, // Contains our numpad and function keys.
SYM, // Contains our symbols. SYM, // Contains our symbols.
MOD, // Contains keyboard related modifications. MOD, // Contains keyboard related modifications.
}; };
// Combo dictionary management (layer names must be defined before engine include) // Combo dictionary management (layer names must be defined before engine
// include)
#include "g/keymap_combo.h" #include "g/keymap_combo.h"
// Our custom keycodes // Our custom keycodes
@ -53,8 +56,9 @@ enum custom_keycodes {
MG_XES, MG_XES,
}; };
// This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy layout. // This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy
// The magic key is triggered with the fn combo. Currently only SFB and some common words are considered. // layout. The magic key is triggered with the fn combo. Currently only SFB and
// some common words are considered.
// https://github.com/Ikcelaks/keyboard_layouts // https://github.com/Ikcelaks/keyboard_layouts
// This keymap uses home row mods. In addition to mods, I have home row // This keymap uses home row mods. In addition to mods, I have home row
@ -114,7 +118,8 @@ enum custom_keycodes {
#define WZ_CMOD LCTL(LSFT(KC_X)) // Wezterm activate copy mode. #define WZ_CMOD LCTL(LSFT(KC_X)) // Wezterm activate copy mode.
#define WZ_PSTE LCTL(LSFT(KC_V)) // Wezterm paste from clipboard. #define WZ_PSTE LCTL(LSFT(KC_V)) // Wezterm paste from clipboard.
//Keymaps // clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[CANARY] = LAYOUT_split_3x6_3( [CANARY] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------. //,-----------------------------------------------------. ,-----------------------------------------------------.
@ -176,8 +181,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
), ),
}; };
// clang-format on
// Bilateral combination exceptions // Bilateral combination exceptions
bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, uint16_t other_keycode, keyrecord_t* other_record) { bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t *tap_hold_record,
uint16_t other_keycode, keyrecord_t *other_record) {
switch (tap_hold_keycode) { switch (tap_hold_keycode) {
// Excempt some mod/layer taps. // Excempt some mod/layer taps.
case SPC_NAV: case SPC_NAV:
@ -191,7 +199,8 @@ bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, ui
return achordion_opposite_hands(tap_hold_record, other_record); return achordion_opposite_hands(tap_hold_record, other_record);
} }
bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods) { bool remember_last_key_user(uint16_t keycode, keyrecord_t *record,
uint8_t *remembered_mods) {
// Forget Shift on letter keys when Shift or AltGr are the only mods. // Forget Shift on letter keys when Shift or AltGr are the only mods.
switch (keycode) { switch (keycode) {
case KC_A ... KC_Z: case KC_A ... KC_Z:
@ -206,42 +215,71 @@ bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* reme
uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) { uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) {
switch (keycode) { switch (keycode) {
// Minimize SFB on canary layout // Minimize SFB on canary layout
case HRM_R: return KC_L; case HRM_R:
case KC_V: return KC_Y; return KC_L;
case HRM_S: return KC_Y; case KC_V:
case KC_Y: return KC_S; return KC_Y;
case KC_P: return KC_T; case HRM_S:
case HRM_I: return KC_U; return KC_Y;
case KC_U: return KC_I; case KC_Y:
case KC_O: return KC_E; return KC_S;
case HRM_E: return KC_O; case KC_P:
return KC_T;
case HRM_I:
return KC_U;
case KC_U:
return KC_I;
case KC_O:
return KC_E;
case HRM_E:
return KC_O;
// Remove problem scissors bigrams // Remove problem scissors bigrams
case KC_L: return KC_V; case KC_L:
return KC_V;
// Briefs // Briefs
case SPC_NAV: return MG_THE; case SPC_NAV:
case KC_COMM: return MG_BUT; return MG_THE;
case KC_B: return MG_BEFORE; case KC_COMM:
case KC_J: return MG_JUST; return MG_BUT;
case KC_M: return MG_MENT; case KC_B:
case HRM_N: return MG_NION; return MG_BEFORE;
case HRM_T: return MG_TMENT; case KC_J:
case KC_W: return MG_WHICH; return MG_JUST;
case KC_X: return MG_XES; case KC_M:
return MG_MENT;
case HRM_N:
return MG_NION;
case HRM_T:
return MG_TMENT;
case KC_W:
return MG_WHICH;
case KC_X:
return MG_XES;
// vim optimisations // vim optimisations
case HRM_C: return KC_W; // change word case HRM_C:
case HRM_D: return KC_W; // delete word return KC_W; // change word
case HRM_D:
return KC_W; // delete word
} }
return KC_TRNS; return KC_TRNS;
} }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_sentence_case(keycode, record)) { return false; } if (!process_sentence_case(keycode, record)) {
if (!process_achordion(keycode, record)) { return false; } return false;
if (!process_select_word(keycode, record, SELWORD)) { return false; } }
if (!process_layer_lock(keycode, record, LLOCK)) { return false; } if (!process_achordion(keycode, record)) {
return false;
}
if (!process_select_word(keycode, record, SELWORD)) {
return false;
}
if (!process_layer_lock(keycode, record, LLOCK)) {
return false;
}
if (record->event.pressed) { if (record->event.pressed) {
int rep_count = get_repeat_key_count(); int rep_count = get_repeat_key_count();
@ -283,7 +321,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
// Repeat key overrides. // Repeat key overrides.
switch (keycode) { switch (keycode) {
// Minimize SFB on canary layout // Minimize SFB on canary layout
case HRM_N: SEND_STRING(/*n*/"f"); return false; case HRM_N:
SEND_STRING(/*n*/ "f");
return false;
// Briefs // Briefs
case SPC_NAV: case SPC_NAV:
SEND_STRING(/* */ "for"); SEND_STRING(/* */ "for");
@ -313,9 +353,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
return true; return true;
} }
void matrix_scan_user(void) { void matrix_scan_user(void) { achordion_task(); }
achordion_task();
}
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
// Declare screen rotation for each half // Declare screen rotation for each half
@ -420,14 +458,15 @@ void oled_render_master(void) {
oled_write(" wpm", false); oled_write(" wpm", false);
} }
// Corne keyboard logo // Corne keyboard logo
void oled_render_logo(void) { void oled_render_logo(void) {
static const char PROGMEM crkbd_logo[] = { static const char PROGMEM crkbd_logo[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
0}; 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xc0, 0xc1,
0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc,
0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0};
oled_write_P(crkbd_logo, false); oled_write_P(crkbd_logo, false);
} }