From 3c4f230af443ffd53b5bbd9470c82c79011149a5 Mon Sep 17 00:00:00 2001 From: rydesun Date: Mon, 24 Oct 2022 15:52:17 +0800 Subject: [PATCH] Rewrite kitty mappings --- .config/kitty/kitty.conf | 29 +++++++++++++++-------------- .config/kitty/open-actions.conf | 15 ++++++++++----- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 4a04b8f..554f786 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -5,6 +5,8 @@ background_opacity 0.95 # 关闭响铃声音 enable_audio_bell no +# 不在系统窗口上报警 +window_alert_on_bell no # 优先使用Nerd font,会覆盖其他字体的字形 # 包含私用空间、中日韩兼容表意文字、字母表现形式、阿拉伯表现形式A @@ -22,24 +24,23 @@ scrollback_pager nvim --cmd "let paging=1 | let ansi=1" # }}} # {{{ 按键 -# Shift-Ctrl组:可连续击键 -map shift+ctrl+f scroll_page_down -map shift+ctrl+b scroll_page_up +### ctrl+shift组:可连续击键 +map ctrl+shift+f scroll_page_down +map ctrl+shift+b scroll_page_up -# Ctrl-g组:hints -kitten_alias hints hints --alphabet [;ajfkdlshgqweruiopzxcvnmbyt12345 -# 插入单词 +### ctrl+g组:hints +kitten_alias hints hints --alphabet ;ajfkdlshgqweruiopzxcvnmtby1230[ +# 其他hints使用默认的ctrl+shift+p和ctrl+shift+e +# 插入 map ctrl+g>ctrl+g kitten hints --type=word --program - -# 复制单词 +map ctrl+g>ctrl+l kitten hints --type=line --program - +map ctrl+g>ctrl+u kitten hints --type=url --program - +# 复制 map ctrl+g>g kitten hints --type=word --program @ -# 编辑带行号的文件 -map ctrl+g>ctrl+n kitten hints --type=linenum ${EDITOR} +{line} {path} -# 打开路径 (xdg-open) -map ctrl+g>ctrl+o kitten hints --type=path -# 打开URL (xdg-open) -map ctrl+g>ctrl+u kitten hints --type=url +map ctrl+g>l kitten hints --type=line --program @ +map ctrl+g>u kitten hints --type=url --program @ # 打开hyperlink (受open-actions.conf控制) -map ctrl+g>ctrl+l kitten hints --type=hyperlink +map ctrl+g>ctrl+o kitten hints --type=hyperlink # }}} # vim: foldmethod=marker diff --git a/.config/kitty/open-actions.conf b/.config/kitty/open-actions.conf index e718255..27310eb 100644 --- a/.config/kitty/open-actions.conf +++ b/.config/kitty/open-actions.conf @@ -1,14 +1,19 @@ -# 直接编辑文本文件(带行号) +# 编辑带行号的文件 protocol file fragment_matches [0-9]+ -action launch --type=overlay $EDITOR +$FRAGMENT $FILE_PATH +action launch --type=overlay $EDITOR +$FRAGMENT "$FILE_PATH" -# 直接编辑文本文件 +# 在浏览器中打开html +protocol file +mime text/html +action launch --type=background xdg-open "$FILE_PATH" + +# 编辑文本文件 protocol file mime text/* -action launch --type=overlay $EDITOR $FILE_PATH +action launch --type=overlay $EDITOR "$FILE_PATH" # 在tab中查看图片 protocol file mime image/* -action launch --type=tab kitty +kitten icat --hold $FILE_PATH +action launch --type=tab kitty +kitten icat --hold "$FILE_PATH"