chore: updates
This commit is contained in:
parent
b88cf78d26
commit
06e4ee6088
23 changed files with 340 additions and 2363 deletions
1
.config/kitty/.jukit/.jukit_info.json
Normal file
1
.config/kitty/.jukit/.jukit_info.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"terminal": "tmux"}
|
File diff suppressed because it is too large
Load diff
9
.config/kitty/neighboring_window.py
Normal file
9
.config/kitty/neighboring_window.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
def main():
|
||||
pass
|
||||
|
||||
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
boss.active_tab.neighboring_window(args[1])
|
||||
|
||||
|
||||
handle_result.no_ui = True
|
46
.config/kitty/pass_keys.py
Normal file
46
.config/kitty/pass_keys.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import re
|
||||
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
|
||||
|
||||
def is_window_vim(window, vim_id):
|
||||
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)
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
mods, key = parse_shortcut(key_mapping)
|
||||
event = KeyEvent(
|
||||
mods=mods,
|
||||
key=key,
|
||||
shift=bool(mods & 1),
|
||||
alt=bool(mods & 2),
|
||||
ctrl=bool(mods & 4),
|
||||
super=bool(mods & 8),
|
||||
hyper=bool(mods & 16),
|
||||
meta=bool(mods & 32),
|
||||
).as_window_system_event()
|
||||
|
||||
return window.encoded_key(event)
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
direction = args[2]
|
||||
key_mapping = args[3]
|
||||
vim_id = args[4] if len(args) > 4 else "n?vim"
|
||||
|
||||
if window is None:
|
||||
return
|
||||
if is_window_vim(window, vim_id):
|
||||
for keymap in key_mapping.split(">"):
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
else:
|
||||
boss.active_tab.neighboring_window(direction)
|
Loading…
Add table
Add a link
Reference in a new issue