From f186e25a190df8067df26eb6c04dc42890ef8328 Mon Sep 17 00:00:00 2001 From: rydesun Date: Mon, 24 Oct 2022 03:00:37 +0800 Subject: [PATCH] Rewrite kitty config --- .config/kitty/kitty.conf | 58 ++++++++++++++++++++------------- .config/kitty/open-actions.conf | 13 ++++---- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 8cda25f..4a04b8f 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -1,31 +1,45 @@ -# 主题 +# {{{ 主题 include themes/everforest.conf font_size 10 background_opacity 0.95 -scrollback_lines 10000 - -# 使用nvim查看缓冲区 -scrollback_pager nvim --cmd "let paging=1 | let ansi=1" -# 关闭响铃 +# 关闭响铃声音 enable_audio_bell no -window_alert_on_bell no - -# 按键映射 -map shift+ctrl+f scroll_page_down -map shift+ctrl+b scroll_page_up -kitten_alias hints hints --alphabet [;ajfkdlshgqweruiopzxcvnmbyt12345 -map ctrl+g>ctrl+g kitten hints --type=word --program - -map ctrl+g>shift+g kitten hints --type=word --program @ -map ctrl+g>ctrl+l kitten hints --type=line --program - -map ctrl+g>shift+l kitten hints --type=line --program @ -map ctrl+g>ctrl+u kitten hints --type=url --program - -map ctrl+g>shift+u kitten hints --type=url --program @ -map ctrl+g>ctrl+i kitten hints --type=ip --program - -map ctrl+g>shift+i kitten hints --type=ip --program @ -map ctrl+g>ctrl+n kitten hints --type=linenum nvim +{line} {path} -map ctrl+g>ctrl+y kitten hints --type=hyperlink # 优先使用Nerd font,会覆盖其他字体的字形 # 包含私用空间、中日韩兼容表意文字、字母表现形式、阿拉伯表现形式A symbol_map U+E000-U+FDFF Symbols Nerd Font +# }}} + +# {{{ Scrollback +# 可回滚的行数,原始值为2000 +scrollback_lines 20000 + +# 使用nvim作为pager +# 需要搭配我的neovim配置 +# https://github.com/rydesun/neovim-config/blob/master/init.lua#L3 +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-g组:hints +kitten_alias hints hints --alphabet [;ajfkdlshgqweruiopzxcvnmbyt12345 +# 插入单词 +map ctrl+g>ctrl+g kitten hints --type=word --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 +# 打开hyperlink (受open-actions.conf控制) +map ctrl+g>ctrl+l kitten hints --type=hyperlink +# }}} + +# vim: foldmethod=marker diff --git a/.config/kitty/open-actions.conf b/.config/kitty/open-actions.conf index dce5485..e718255 100644 --- a/.config/kitty/open-actions.conf +++ b/.config/kitty/open-actions.conf @@ -1,15 +1,14 @@ +# 直接编辑文本文件(带行号) protocol file fragment_matches [0-9]+ -action launch --type=overlay ${EDITOR} +${FRAGMENT} ${FILE_PATH} - -protocol file -mime text/html -action launch firefox ${FILE_PATH} +action launch --type=overlay $EDITOR +$FRAGMENT $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=overlay kitty +kitten icat --hold ${FILE_PATH} +action launch --type=tab kitty +kitten icat --hold $FILE_PATH