mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 21:22:05 +00:00
Merge 6fcc2ba921
into 507c948ed8
This commit is contained in:
commit
a4fa90a423
0
data/constants/keycodes/keycodes_0.0.8.hjson
Normal file
0
data/constants/keycodes/keycodes_0.0.8.hjson
Normal file
11
data/constants/keycodes/keycodes_0.0.8_quantum.hjson
Normal file
11
data/constants/keycodes/keycodes_0.0.8_quantum.hjson
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"keycodes": {
|
||||
"0x7C38": {
|
||||
"group": "quantum",
|
||||
"key": "QK_UNICODE_MODE_VIM",
|
||||
"aliases": [
|
||||
"UC_VIM"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -42,6 +42,8 @@ Add the following to your `config.h`:
|
||||
|`UNICODE_SONG_BSD` |*n/a* |The song to play when the BSD input mode is selected |
|
||||
|`UNICODE_SONG_WIN` |*n/a* |The song to play when the Windows input mode is selected |
|
||||
|`UNICODE_SONG_WINC`|*n/a* |The song to play when the WinCompose input mode is selected|
|
||||
|`UNICODE_SONG_EMACS`|*n/a* |The song to play when the Emacs input mode is selected |
|
||||
|`UNICODE_SONG_VIM` |*n/a* |The song to play when the Vim input mode is selected |
|
||||
|
||||
## Input Subsystems {#input-subsystems}
|
||||
|
||||
@ -201,6 +203,12 @@ Emacs supports code point input with the `insert-char` command.
|
||||
|
||||
Not currently implemented. If you're a BSD user and want to contribute support for this input mode, please [feel free](../contributing)!
|
||||
|
||||
==== VIM
|
||||
|
||||
**Mode Name:** `UNICODE_MODE_VIM`
|
||||
|
||||
Vim supports input of all the unicode characters. For more information check `:h i_CTRL-V_digit`. In Vim unicode mode, keyboard sends `ctrl+v`, `shift+u`, and then digits of the unicode point.
|
||||
|
||||
:::::
|
||||
|
||||
## Keycodes {#keycodes}
|
||||
@ -217,7 +225,8 @@ Not currently implemented. If you're a BSD user and want to contribute support f
|
||||
|`QK_UNICODE_MODE_WINDOWS` |`UC_WIN` |Switch to Windows input |
|
||||
|`QK_UNICODE_MODE_BSD` |`UC_BSD` |Switch to BSD input (not implemented) |
|
||||
|`QK_UNICODE_MODE_WINCOMPOSE`|`UC_WINC`|Switch to Windows input using WinCompose |
|
||||
|`QK_UNICODE_MODE_EMACS` |`UC_EMAC`|Switch to emacs (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_EMACS` |`UC_EMAC`|Switch to Emacs input (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_VIM` |`UC_VIM`|Switch to Vim input (`CTRL-V U`) |
|
||||
|
||||
## API {#api}
|
||||
|
||||
@ -285,6 +294,7 @@ Begin the Unicode input sequence. The exact behavior depends on the currently se
|
||||
- **WinCompose**: Tap `UNICODE_KEY_WINC`, then U
|
||||
- **HexNumpad**: Hold Left Alt, then tap Numpad +
|
||||
- **Emacs**: Tap Ctrl+X, then 8, then Enter
|
||||
- **Vim**: Tap Ctrl+V, then Shift+U
|
||||
|
||||
This function is weakly defined, and can be overridden in user code.
|
||||
|
||||
@ -299,6 +309,7 @@ Complete the Unicode input sequence. The exact behavior depends on the currently
|
||||
- **WinCompose**: Tap Enter
|
||||
- **HexNumpad**: Release Left Alt
|
||||
- **Emacs**: Tap Enter
|
||||
- **Vim**: Do nothing
|
||||
|
||||
This function is weakly defined, and can be overridden in user code.
|
||||
|
||||
@ -313,6 +324,7 @@ Cancel the Unicode input sequence. The exact behavior depends on the currently s
|
||||
- **WinCompose**: Tap Escape
|
||||
- **HexNumpad**: Release Left Alt
|
||||
- **Emacs**: Tap Ctrl+G
|
||||
- **Vim**: Do nothing
|
||||
|
||||
This function is weakly defined, and can be overridden in user code.
|
||||
|
||||
|
@ -945,4 +945,5 @@ See also: [Unicode Support](features/unicode)
|
||||
|`QK_UNICODE_MODE_WINDOWS` |`UC_WIN` |Switch to Windows input |
|
||||
|`QK_UNICODE_MODE_BSD` |`UC_BSD` |Switch to BSD input (not implemented) |
|
||||
|`QK_UNICODE_MODE_WINCOMPOSE`|`UC_WINC`|Switch to Windows input using WinCompose |
|
||||
|`QK_UNICODE_MODE_EMACS` |`UC_EMAC`|Switch to emacs (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_EMACS` |`UC_EMAC`|Switch to Emacs input (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_VIM` |`UC_VIM` |Switch to Vim input (`i_CTRL-V U`) |
|
||||
|
@ -120,6 +120,9 @@ void user_oled_magic(void) {
|
||||
case UNICODE_MODE_EMACS:
|
||||
oled_write_P(PSTR("emacs"), false);
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
oled_write_P(PSTR("vim"), false);
|
||||
break;
|
||||
default:
|
||||
oled_write_ln_P(PSTR("not supported"), false);
|
||||
}
|
||||
|
@ -26,11 +26,11 @@
|
||||
#pragma once
|
||||
// clang-format off
|
||||
|
||||
#define QMK_KEYCODES_VERSION "0.0.7"
|
||||
#define QMK_KEYCODES_VERSION_BCD 0x00000007
|
||||
#define QMK_KEYCODES_VERSION "0.0.8"
|
||||
#define QMK_KEYCODES_VERSION_BCD 0x00000008
|
||||
#define QMK_KEYCODES_VERSION_MAJOR 0
|
||||
#define QMK_KEYCODES_VERSION_MINOR 0
|
||||
#define QMK_KEYCODES_VERSION_PATCH 7
|
||||
#define QMK_KEYCODES_VERSION_PATCH 8
|
||||
|
||||
enum qk_keycode_ranges {
|
||||
// Ranges
|
||||
@ -725,6 +725,7 @@ enum qk_keycode_defines {
|
||||
QK_UNICODE_MODE_BSD = 0x7C35,
|
||||
QK_UNICODE_MODE_WINCOMPOSE = 0x7C36,
|
||||
QK_UNICODE_MODE_EMACS = 0x7C37,
|
||||
QK_UNICODE_MODE_VIM = 0x7C38,
|
||||
QK_HAPTIC_ON = 0x7C40,
|
||||
QK_HAPTIC_OFF = 0x7C41,
|
||||
QK_HAPTIC_TOGGLE = 0x7C42,
|
||||
@ -1413,6 +1414,7 @@ enum qk_keycode_defines {
|
||||
UC_BSD = QK_UNICODE_MODE_BSD,
|
||||
UC_WINC = QK_UNICODE_MODE_WINCOMPOSE,
|
||||
UC_EMAC = QK_UNICODE_MODE_EMACS,
|
||||
UC_VIM = QK_UNICODE_MODE_VIM,
|
||||
HF_ON = QK_HAPTIC_ON,
|
||||
HF_OFF = QK_HAPTIC_OFF,
|
||||
HF_TOGG = QK_HAPTIC_TOGGLE,
|
||||
|
@ -64,6 +64,9 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
|
||||
case QK_UNICODE_MODE_EMACS:
|
||||
set_unicode_input_mode(UNICODE_MODE_EMACS);
|
||||
break;
|
||||
case QK_UNICODE_MODE_VIM:
|
||||
set_unicode_input_mode(UNICODE_MODE_VIM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,9 @@ static float song_winc[][2] = UNICODE_SONG_WINC;
|
||||
# ifdef UNICODE_SONG_EMACS
|
||||
static float song_emacs[][2] = UNICODE_SONG_EMACS;
|
||||
# endif
|
||||
# ifdef UNICODE_SONG_VIM
|
||||
static float song_vim[][2] = UNICODE_SONG_VIM;
|
||||
# endif
|
||||
|
||||
static void unicode_play_song(uint8_t mode) {
|
||||
switch (mode) {
|
||||
@ -129,6 +132,11 @@ static void unicode_play_song(uint8_t mode) {
|
||||
case UNICODE_MODE_EMACS:
|
||||
PLAY_SONG(song_emacs);
|
||||
break;
|
||||
# endif
|
||||
# ifdef UNICODE_SONG_VIM
|
||||
case UNICODE_MODE_VIM:
|
||||
PLAY_SONG(song_vim);
|
||||
break;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
@ -248,6 +256,10 @@ __attribute__((weak)) void unicode_input_start(void) {
|
||||
tap_code16(KC_8);
|
||||
tap_code16(KC_ENTER);
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
tap_code16(LCTL(KC_V));
|
||||
tap_code16(LSFT(KC_U));
|
||||
break;
|
||||
}
|
||||
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
@ -276,6 +288,9 @@ __attribute__((weak)) void unicode_input_finish(void) {
|
||||
case UNICODE_MODE_EMACS:
|
||||
tap_code16(KC_ENTER);
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
// It finishes by itself when enough hex digits received
|
||||
break;
|
||||
}
|
||||
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
@ -304,6 +319,9 @@ __attribute__((weak)) void unicode_input_cancel(void) {
|
||||
case UNICODE_MODE_EMACS:
|
||||
tap_code16(LCTL(KC_G)); // C-g cancels
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
// It looks like there is no way to cancel
|
||||
break;
|
||||
}
|
||||
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
@ -344,9 +362,13 @@ void register_hex32(uint32_t hex) {
|
||||
send_nibble_wrapper(0);
|
||||
}
|
||||
|
||||
// Always send digits (including zero) if we're down to the last
|
||||
// two bytes of nibbles.
|
||||
bool must_send = i < 4;
|
||||
bool must_send =
|
||||
// Always send digits (including zero) if we're down to the last
|
||||
// two bytes of nibbles.
|
||||
(i < 4)
|
||||
// In vim, `i_CTRL-V U` waits for exactly 8 digits, so we send them all
|
||||
// @see `:h i_CTRL-V_digit`
|
||||
|| (unicode_config.input_mode == UNICODE_MODE_VIM);
|
||||
|
||||
// If we've found a digit worth transmitting, do so.
|
||||
if (digit != 0 || !first_digit || must_send) {
|
||||
|
@ -46,6 +46,7 @@ enum unicode_input_modes {
|
||||
UNICODE_MODE_BSD, // BSD (not implemented)
|
||||
UNICODE_MODE_WINCOMPOSE, // Windows using WinCompose (https://github.com/samhocevar/wincompose)
|
||||
UNICODE_MODE_EMACS, // Emacs is an operating system in search of a good text editor
|
||||
UNICODE_MODE_VIM, // Vim or Neovim
|
||||
|
||||
UNICODE_MODE_COUNT // Number of available input modes (always leave at the end)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user