🎹 Keymap update
- Remove Ctrl+Shift+h map for scrollback - Map kittyscrollback to F1 - Replace instances of Ctrl+Shift with kitty_mod - Switch to MunsMan/kitty-navigator.nvim - Ctrl+Shift+<vim-motions> hard-coded for switching windows - Mappings now properly integrate with nvim
This commit is contained in:
+10
-7
@@ -3,10 +3,15 @@ import re
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
|
||||
VIM_ID = "n?vim"
|
||||
|
||||
def is_window_vim(window, vim_id):
|
||||
|
||||
def is_window_vim(window):
|
||||
fp = window.child.foreground_processes
|
||||
return any(re.search(vim_id, p['cmdline'][0] if len(p['cmdline']) else '', re.I) for p in fp)
|
||||
return any(
|
||||
re.search(VIM_ID, p["cmdline"][0] if len(p["cmdline"]) else "", re.I)
|
||||
for p in fp
|
||||
)
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
@@ -31,15 +36,13 @@ def main():
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
direction = args[1]
|
||||
key_mapping = args[2]
|
||||
vim_id = args[3] if len(args) > 3 else "n?vim"
|
||||
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
direction = args[2]
|
||||
key_mapping = args[3]
|
||||
|
||||
if window is None:
|
||||
return
|
||||
if is_window_vim(window, vim_id):
|
||||
if is_window_vim(window):
|
||||
for keymap in key_mapping.split(">"):
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
|
||||
Reference in New Issue
Block a user