mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 21:22:05 +00:00
UNICODE_MODE_VIM: switch from i_CTRL-V u
to i_CTRL-V U
This commit is contained in:
parent
1184864560
commit
fc09ffb34a
@ -207,7 +207,7 @@ Not currently implemented. If you're a BSD user and want to contribute support f
|
||||
|
||||
**Mode Name:** `UNICODE_MODE_VIM`
|
||||
|
||||
Vim supports input of unicode characters up to `U+FFFF`. To insert a unicode character, press `ctrl+v u` in insert mode. For more informaton, see `:h utf-8-typing`.
|
||||
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.
|
||||
|
||||
:::::
|
||||
|
||||
@ -225,8 +225,8 @@ Vim supports input of unicode characters up to `U+FFFF`. To insert a unicode cha
|
||||
|`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 input (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_VIM` |`UC_VIM`|Switch to vim input (`CTRL-V u`) |
|
||||
|`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}
|
||||
|
||||
@ -294,7 +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 u
|
||||
- **Vim**: Tap Ctrl+V, then Shift+U
|
||||
|
||||
This function is weakly defined, and can be overridden in user code.
|
||||
|
||||
|
@ -903,4 +903,4 @@ See also: [Unicode Support](features/unicode)
|
||||
|`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 input (`C-x-8 RET`) |
|
||||
|`QK_UNICODE_MODE_VIM` |`UC_VIM` |Switch to Vim input (`i_CTRL-V u`) |
|
||||
|`QK_UNICODE_MODE_VIM` |`UC_VIM` |Switch to Vim input (`i_CTRL-V U`) |
|
||||
|
@ -258,7 +258,7 @@ __attribute__((weak)) void unicode_input_start(void) {
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
tap_code16(LCTL(KC_V));
|
||||
tap_code16(KC_U);
|
||||
tap_code16(LSFT(KC_U));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ __attribute__((weak)) void unicode_input_finish(void) {
|
||||
tap_code16(KC_ENTER);
|
||||
break;
|
||||
case UNICODE_MODE_VIM:
|
||||
// It finishes by itself when 4 hex digits received
|
||||
// It finishes by itself when enough hex digits received
|
||||
break;
|
||||
}
|
||||
|
||||
@ -350,6 +350,16 @@ void register_hex(uint16_t hex) {
|
||||
}
|
||||
|
||||
void register_hex32(uint32_t hex) {
|
||||
// In vim, `i_CTRL-V U` waits for exactly 8 digits, so we send them all
|
||||
// @see `:h i_CTRL-V_digit`
|
||||
if (unicode_config.input_mode == UNICODE_MODE_VIM) {
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
uint8_t digit = ((hex >> (i * 4)) & 0xF);
|
||||
send_nibble(digit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool first_digit = true;
|
||||
bool needs_leading_zero = (unicode_config.input_mode == UNICODE_MODE_WINCOMPOSE);
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
|
Loading…
Reference in New Issue
Block a user