Vim key nav

main
Ashelyn Dawn 3 years ago
parent 89efb51f24
commit b687e34fe4

@ -247,8 +247,67 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
}
default:
return true; //Process all other keycodes normally
break; //Process all other keycodes normally
}
if (keycode == KC_LGUI) {
if (record->event.pressed && !gui_key_down) {
gui_key_down = true;
} else if (!record->event.pressed && gui_key_down) {
if (gui_combo_pressed) {
unregister_code(KC_LGUI);
} else if (!gui_disable_tap) {
tap_code(KC_LGUI);
}
gui_key_down = false;
gui_combo_pressed = false;
gui_disable_tap = false;
}
return false;
}
if (!gui_key_down){
return true;
}
// Vim keys
if(!gui_combo_pressed) {
uint16_t target = 0;
if(keycode == KC_H){
target = KC_LEFT;
}
if(keycode == KC_J){
target = KC_DOWN;
}
if(keycode == KC_K){
target = KC_UP;
}
if(keycode == KC_L){
target = KC_RIGHT;
}
if (target != 0) {
if(record->event.pressed) {
register_code(target);
gui_disable_tap = true;
} else {
unregister_code(target);
}
return false;
}
}
if(!gui_combo_pressed) {
gui_combo_pressed = true;
register_code(KC_LGUI);
}
return true;
}
void set_layer_color(int layer) {

@ -29,3 +29,7 @@ enum layout_names {
extern bool g_suspend_state;
extern rgb_config_t rgb_matrix_config;
bool disable_layer_color;
bool gui_key_down;
bool gui_combo_pressed;
bool gui_disable_tap;
Loading…
Cancel
Save