mirror of
https://github.com/firewalkwithm3/qmk_firmware.git
synced 2024-11-22 19:40:29 +08:00
[keymap] curly quotes (#9662)
Co-authored-by: Erovia <Erovia@users.noreply.github.com>
This commit is contained in:
parent
823165b9b7
commit
c50009d5d4
|
@ -49,7 +49,7 @@
|
||||||
#define bspc KC_BSPC
|
#define bspc KC_BSPC
|
||||||
#define caps KC_CAPS
|
#define caps KC_CAPS
|
||||||
#define comm KC_COMM
|
#define comm KC_COMM
|
||||||
#define dash A(KC_MINS)
|
#define dash A(KC_MINS) // en-dash (–); or with shift: em-dash (—)
|
||||||
#define scln KC_SCLN
|
#define scln KC_SCLN
|
||||||
#define slsh KC_SLSH
|
#define slsh KC_SLSH
|
||||||
#define spc KC_SPC
|
#define spc KC_SPC
|
||||||
|
@ -60,7 +60,6 @@
|
||||||
#define mins KC_MINS
|
#define mins KC_MINS
|
||||||
#define quot KC_QUOT
|
#define quot KC_QUOT
|
||||||
#define esc KC_ESC
|
#define esc KC_ESC
|
||||||
#define gbp A(KC_3)
|
|
||||||
|
|
||||||
#define down KC_DOWN
|
#define down KC_DOWN
|
||||||
#define home G(KC_LEFT)
|
#define home G(KC_LEFT)
|
||||||
|
@ -75,8 +74,8 @@
|
||||||
#define tabr G(S(KC_RBRC))
|
#define tabr G(S(KC_RBRC))
|
||||||
#define fwd G(KC_RBRC)
|
#define fwd G(KC_RBRC)
|
||||||
#define back G(KC_LBRC)
|
#define back G(KC_LBRC)
|
||||||
#define slup S(A(KC_UP))
|
#define slup S(A(KC_UP)) // Previous unread in Slack
|
||||||
#define sldn S(A(KC_DOWN))
|
#define sldn S(A(KC_DOWN)) // Next unread in Slack
|
||||||
|
|
||||||
#define ctl1 C(KC_1)
|
#define ctl1 C(KC_1)
|
||||||
#define ctl2 C(KC_2)
|
#define ctl2 C(KC_2)
|
||||||
|
@ -137,6 +136,7 @@ enum planck_layers {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum planck_keycodes {
|
enum planck_keycodes {
|
||||||
|
// ASCII
|
||||||
ampr = SAFE_RANGE,
|
ampr = SAFE_RANGE,
|
||||||
astr,
|
astr,
|
||||||
at,
|
at,
|
||||||
|
@ -158,6 +158,11 @@ enum planck_keycodes {
|
||||||
rprn,
|
rprn,
|
||||||
tild,
|
tild,
|
||||||
|
|
||||||
|
// Curly quotes
|
||||||
|
lcqt,
|
||||||
|
rcqt,
|
||||||
|
|
||||||
|
// "Smart" mods
|
||||||
cmd,
|
cmd,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -171,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
[SYMB] = LAYOUT_planck_grid(
|
[SYMB] = LAYOUT_planck_grid(
|
||||||
esc, n7, n5, n3, n1, n9, n8, n0, n2, n4, n6, dash,
|
esc, n7, n5, n3, n1, n9, n8, n0, n2, n4, n6, dash,
|
||||||
del, at, dlr, eql, lprn, lbrc, rbrc, rprn, astr, hash, plus, gbp,
|
lcqt, at, dlr, eql, lprn, lbrc, rbrc, rprn, astr, hash, plus, rcqt,
|
||||||
____, grv, pipe, bsls, lcbr, tild, circ, rcbr, ampr, exlm, perc, ____,
|
____, grv, pipe, bsls, lcbr, tild, circ, rcbr, ampr, exlm, perc, ____,
|
||||||
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____
|
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____
|
||||||
),
|
),
|
||||||
|
@ -191,78 +196,112 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
bool send_string_if_keydown(keyrecord_t *record, const char *s) {
|
bool send_string_if_keydown(
|
||||||
|
keyrecord_t *record,
|
||||||
|
const char *unshifted,
|
||||||
|
const char *shifted) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
send_string(s);
|
if (shifted) {
|
||||||
|
uint8_t shifts = get_mods() & MOD_MASK_SHIFT;
|
||||||
|
if (shifts) {
|
||||||
|
del_mods(shifts);
|
||||||
|
SEND_STRING(shifted);
|
||||||
|
add_mods(shifts);
|
||||||
|
} else {
|
||||||
|
SEND_STRING(unshifted);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SEND_STRING(unshifted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_keys_down = 0;
|
// Holding both cmd keys will instead register as cmd + ctl
|
||||||
|
bool smart_cmd(keyrecord_t *record) {
|
||||||
|
static int cmd_keys_down = 0;
|
||||||
|
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (cmd_keys_down == 0) {
|
||||||
|
register_code(KC_LCMD);
|
||||||
|
} else {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
}
|
||||||
|
cmd_keys_down++;
|
||||||
|
} else {
|
||||||
|
if (cmd_keys_down == 1) {
|
||||||
|
unregister_code(KC_LCMD);
|
||||||
|
} else {
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
}
|
||||||
|
cmd_keys_down--;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
// Override the defualt auto shifted symbols to use SEND_STRING See
|
// Override the defualt auto shifted symbols to use SEND_STRING See
|
||||||
// https://github.com/qmk/qmk_firmware/issues/4072
|
// https://github.com/qmk/qmk_firmware/issues/4072
|
||||||
case ampr:
|
case ampr:
|
||||||
return send_string_if_keydown(record, "&");
|
return send_string_if_keydown(record, "&", NULL);
|
||||||
case astr:
|
case astr:
|
||||||
return send_string_if_keydown(record, "*");
|
return send_string_if_keydown(record, "*", NULL);
|
||||||
case at:
|
case at:
|
||||||
return send_string_if_keydown(record, "@");
|
return send_string_if_keydown(record, "@", NULL);
|
||||||
case bsls:
|
case bsls:
|
||||||
return send_string_if_keydown(record, "\\");
|
return send_string_if_keydown(record, "\\", NULL);
|
||||||
case circ:
|
case circ:
|
||||||
return send_string_if_keydown(record, "^");
|
return send_string_if_keydown(record, "^", NULL);
|
||||||
case dlr:
|
case dlr:
|
||||||
return send_string_if_keydown(record, "$");
|
return send_string_if_keydown(record, "$", NULL);
|
||||||
case eql:
|
case eql:
|
||||||
return send_string_if_keydown(record, "=");
|
return send_string_if_keydown(record, "=", NULL);
|
||||||
case exlm:
|
case exlm:
|
||||||
return send_string_if_keydown(record, "!");
|
return send_string_if_keydown(record, "!", NULL);
|
||||||
case grv:
|
case grv:
|
||||||
return send_string_if_keydown(record, "`");
|
return send_string_if_keydown(record, "`", NULL);
|
||||||
case hash:
|
case hash:
|
||||||
return send_string_if_keydown(record, "#");
|
return send_string_if_keydown(record, "#", NULL);
|
||||||
case lbrc:
|
case lbrc:
|
||||||
return send_string_if_keydown(record, "[");
|
return send_string_if_keydown(record, "[", NULL);
|
||||||
case lcbr:
|
case lcbr:
|
||||||
return send_string_if_keydown(record, "{");
|
return send_string_if_keydown(record, "{", NULL);
|
||||||
case lprn:
|
case lprn:
|
||||||
return send_string_if_keydown(record, "(");
|
return send_string_if_keydown(record, "(", NULL);
|
||||||
case perc:
|
case perc:
|
||||||
return send_string_if_keydown(record, "%");
|
return send_string_if_keydown(record, "%", NULL);
|
||||||
case pipe:
|
case pipe:
|
||||||
return send_string_if_keydown(record, "|");
|
return send_string_if_keydown(record, "|", NULL);
|
||||||
case plus:
|
case plus:
|
||||||
return send_string_if_keydown(record, "+");
|
return send_string_if_keydown(record, "+", NULL);
|
||||||
case rbrc:
|
case rbrc:
|
||||||
return send_string_if_keydown(record, "]");
|
return send_string_if_keydown(record, "]", NULL);
|
||||||
case rcbr:
|
case rcbr:
|
||||||
return send_string_if_keydown(record, "}");
|
return send_string_if_keydown(record, "}", NULL);
|
||||||
case rprn:
|
case rprn:
|
||||||
return send_string_if_keydown(record, ")");
|
return send_string_if_keydown(record, ")", NULL);
|
||||||
case tild:
|
case tild:
|
||||||
return send_string_if_keydown(record, "~");
|
return send_string_if_keydown(record, "~", NULL);
|
||||||
|
|
||||||
|
// The macOS shortcuts for curly quotes are horrible, so this rebinds
|
||||||
|
// them so that shift toggles single–double instead of left–right, and
|
||||||
|
// then both varieties of left quote can share one key, and both
|
||||||
|
// varieties of right quote share another.
|
||||||
|
case lcqt:
|
||||||
|
return send_string_if_keydown(
|
||||||
|
record,
|
||||||
|
SS_LALT("]"), // left single quote (‘)
|
||||||
|
SS_LALT("[")); // left double quote (“)
|
||||||
|
case rcqt:
|
||||||
|
return send_string_if_keydown(
|
||||||
|
record,
|
||||||
|
SS_LALT(SS_LSFT("]")), // right single quote (’)
|
||||||
|
SS_LALT(SS_LSFT("["))); // right double quote (”)
|
||||||
|
|
||||||
// cmd + cmd -> cmd + ctl
|
// cmd + cmd -> cmd + ctl
|
||||||
case cmd:
|
case cmd:
|
||||||
if (record->event.pressed) {
|
return smart_cmd(record);
|
||||||
if (cmd_keys_down == 0) {
|
|
||||||
register_code(KC_LCMD);
|
|
||||||
} else {
|
|
||||||
register_code(KC_LCTL);
|
|
||||||
}
|
|
||||||
cmd_keys_down++;
|
|
||||||
} else {
|
|
||||||
if (cmd_keys_down == 1) {
|
|
||||||
unregister_code(KC_LCMD);
|
|
||||||
} else {
|
|
||||||
unregister_code(KC_LCTL);
|
|
||||||
}
|
|
||||||
cmd_keys_down--;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# callum's planck layout
|
# callum’s planck layout
|
||||||
|
|
||||||
This is a layout for the grid planck, built with a few ideals in mind:
|
This is a layout for the grid planck, built with a few ideals in mind:
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ This is a layout for the grid planck, built with a few ideals in mind:
|
||||||
|
|
||||||
- Symbols should be arranged so that the most frequently used are easiest to
|
- Symbols should be arranged so that the most frequently used are easiest to
|
||||||
reach. This includes numbers, and lower numbers are more commonly used than
|
reach. This includes numbers, and lower numbers are more commonly used than
|
||||||
higher ones. (number arrangement borrowed from [dustypomeleau's minidox
|
higher ones. (number arrangement borrowed from [dustypomeleau’s minidox
|
||||||
layout][].
|
layout][]).
|
||||||
|
|
||||||
[dustypomeleau's minidox layout]: https://github.com/qmk/qmk_firmware/tree/master/keyboards/minidox/keymaps/dustypomerleau
|
[dustypomeleau’s minidox layout]: https://github.com/qmk/qmk_firmware/tree/master/keyboards/minidox/keymaps/dustypomerleau
|
||||||
[keymap.c]: keymap.c
|
[keymap.c]: keymap.c
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
# Build Options
|
BOOTMAGIC_ENABLE = no
|
||||||
# change to "no" to disable the options, or define them in the Makefile in
|
MOUSEKEY_ENABLE = no
|
||||||
# the appropriate keymap folder that will get included automatically
|
CONSOLE_ENABLE = no
|
||||||
#
|
COMMAND_ENABLE = yes
|
||||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
MIDI_ENABLE = no
|
||||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
AUDIO_ENABLE = yes
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
RGBLIGHT_ENABLE = no
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|
||||||
MIDI_ENABLE = no # MIDI controls
|
|
||||||
AUDIO_ENABLE = yes # Audio output on port C6
|
|
||||||
UNICODE_ENABLE = no # Unicode
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
|
||||||
|
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|
||||||
|
|
Loading…
Reference in a new issue