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
COMB(NE_ESC, KC_ESC, RCTL_T(KC_N), RSFT_T(KC_E))

View file

@ -1,9 +1,11 @@
#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
// 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_TIMEOUT 200U
@ -13,8 +15,12 @@
#define ENABLE_COMPILE_KEYCODE
// 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 PERMISSIVE_HOLD // activates the modifier when another key is pressed and released while the mod-tap is held, regardless of the tapping term
#define 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 ACHORDION_STREAK // disables hold behaviors when in a typing streak
@ -27,19 +33,19 @@
// RGB
#ifdef RGBLIGHT_ENABLE
#define RGBLIGHT_SLEEP
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
#define RGBLIGHT_LIMIT_VAL 120
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#define RGBLIGHT_SLEEP
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
#define RGBLIGHT_LIMIT_VAL 120
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#endif

View file

@ -17,22 +17,25 @@
#include QMK_KEYBOARD_H
// Awesome features created by getreuer
#include "features/sentence_case.h"
#include "features/achordion.h"
#include "features/select_word.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
// Our super useful layers, why we run qmk exclusively.
enum layers {
CANARY, // This layout is the result of collaboration between many of the top layout creators from the AKL community.
NAV, // Inspired by the colemak communities extend layer, Brings navigation and editing to the home position.
CANARY, // This layout is the result of collaboration between many of the top
// 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.
SYM, // Contains our symbols.
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"
// Our custom keycodes
@ -53,8 +56,9 @@ enum custom_keycodes {
MG_XES,
};
// This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy layout.
// The magic key is triggered with the fn combo. Currently only SFB and some common words are considered.
// This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy
// 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
// 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_PSTE LCTL(LSFT(KC_V)) // Wezterm paste from clipboard.
//Keymaps
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[CANARY] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
@ -176,8 +181,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
// clang-format on
// 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) {
// Excempt some mod/layer taps.
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);
}
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.
switch (keycode) {
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) {
switch (keycode) {
// Minimize SFB on canary layout
case HRM_R: return KC_L;
case KC_V: return KC_Y;
case HRM_S: return KC_Y;
case KC_Y: return KC_S;
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;
case HRM_R:
return KC_L;
case KC_V:
return KC_Y;
case HRM_S:
return KC_Y;
case KC_Y:
return KC_S;
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
case KC_L: return KC_V;
case KC_L:
return KC_V;
// Briefs
case SPC_NAV: return MG_THE;
case KC_COMM: return MG_BUT;
case KC_B: return MG_BEFORE;
case KC_J: return MG_JUST;
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;
case SPC_NAV:
return MG_THE;
case KC_COMM:
return MG_BUT;
case KC_B:
return MG_BEFORE;
case KC_J:
return MG_JUST;
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
case HRM_C: return KC_W; // change word
case HRM_D: return KC_W; // delete word
case HRM_C:
return KC_W; // change word
case HRM_D:
return KC_W; // delete word
}
return KC_TRNS;
}
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
if (!process_sentence_case(keycode, record)) { 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; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_sentence_case(keycode, record)) {
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) {
int rep_count = get_repeat_key_count();
@ -252,59 +290,61 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
return false;
// Magic key briefs
case MG_THE:
SEND_STRING(/* */"the");
SEND_STRING(/* */ "the");
return false;
case MG_BUT:
SEND_STRING(/*,*/" but");
SEND_STRING(/*,*/ " but");
return false;
case MG_BEFORE:
SEND_STRING(/*b*/"efore");
SEND_STRING(/*b*/ "efore");
return false;
case MG_JUST:
SEND_STRING(/*j*/"ust");
SEND_STRING(/*j*/ "ust");
return false;
case MG_MENT:
SEND_STRING(/*m*/"ent");
SEND_STRING(/*m*/ "ent");
return false;
case MG_NION:
SEND_STRING(/*n*/"ion");
SEND_STRING(/*n*/ "ion");
return false;
case MG_TMENT:
SEND_STRING(/*t*/"ment");
SEND_STRING(/*t*/ "ment");
return false;
case MG_WHICH:
SEND_STRING(/*w*/"hich");
SEND_STRING(/*w*/ "hich");
return false;
case MG_XES:
SEND_STRING(/*x*/"es");
SEND_STRING(/*x*/ "es");
return false;
}
if (rep_count > 0) {
// Repeat key overrides.
switch (keycode) {
// Minimize SFB on canary layout
case HRM_N: SEND_STRING(/*n*/"f"); return false;
case HRM_N:
SEND_STRING(/*n*/ "f");
return false;
// Briefs
case SPC_NAV:
SEND_STRING(/* */"for");
SEND_STRING(/* */ "for");
return false;
case KC_COMM:
SEND_STRING(/*,*/" and");
SEND_STRING(/*,*/ " and");
return false;
case HRM_A:
SEND_STRING(/*a*/"nd");
SEND_STRING(/*a*/ "nd");
return false;
case HRM_I:
SEND_STRING(/*i*/"ng");
SEND_STRING(/*i*/ "ng");
return false;
case KC_Y:
SEND_STRING(/*y*/"ou");
SEND_STRING(/*y*/ "ou");
return false;
case KC_B:
SEND_STRING(/*b*/"ecause");
SEND_STRING(/*b*/ "ecause");
return false;
case KC_W:
SEND_STRING(/*w*/"ould");
SEND_STRING(/*w*/ "ould");
return false;
}
}
@ -313,9 +353,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
return true;
}
void matrix_scan_user(void) {
achordion_task();
}
void matrix_scan_user(void) { achordion_task(); }
#ifdef OLED_ENABLE
// Declare screen rotation for each half
@ -420,14 +458,15 @@ void oled_render_master(void) {
oled_write(" wpm", false);
}
// Corne keyboard logo
void oled_render_logo(void) {
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,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 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};
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0,
0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
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);
}