diff --git a/.config/kitty/keymap.conf b/.config/kitty/keymap.conf new file mode 100644 index 0000000..c03c2e4 --- /dev/null +++ b/.config/kitty/keymap.conf @@ -0,0 +1,49 @@ +# Window +map ctrl+\ new_window_with_cwd + +# Tab +map ctrl+1 goto_tab 1 +map ctrl+2 goto_tab 2 +map ctrl+3 goto_tab 3 +map ctrl+4 goto_tab 4 +map ctrl+t new_tab +map ctrl+w close_tab + +# Supper power keys +map ctrl+; kitten toggle_term.py + +# kitty-scrollback.nvim Kitten alias +# action_alias kitty_scrollback_nvim kitten /home/tieu/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py + +# Browse scrollback buffer in nvim +map kitty_mod+h kitty_scrollback_nvim +# Browse output of the last shell command in nvim +map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output +# Show clicked command output in nvim +# mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output + +# ---------- +# smart-split +map ctrl+j neighboring_window down +map ctrl+k neighboring_window up +map ctrl+h neighboring_window left +map ctrl+l neighboring_window right + +# Unset the mapping to pass the keys to neovim +map --when-focus-on var:IS_NVIM ctrl+j +map --when-focus-on var:IS_NVIM ctrl+k +map --when-focus-on var:IS_NVIM ctrl+h +map --when-focus-on var:IS_NVIM ctrl+l + +# the 3 here is the resize amount, adjust as needed +map alt+j kitten relative_resize.py down 3 +map alt+k kitten relative_resize.py up 3 +map alt+h kitten relative_resize.py left 3 +map alt+l kitten relative_resize.py right 3 + +map --when-focus-on var:IS_NVIM alt+j +map --when-focus-on var:IS_NVIM alt+k +map --when-focus-on var:IS_NVIM alt+h +map --when-focus-on var:IS_NVIM alt+l + +map f1 launch_tab nvim diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..e90165f --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,20 @@ +font_size 15 +window_padding_width 1 +background_opacity 1 + +font_family JetBrainsMono Nerd Font Mono + +tab_bar_edge top +tab_bar_style separator +tab_separator " " +tab_title_template " {index} {title[-20:]} {bell_symbol}" + +remember_window_size yes + +allow_remote_control yes +listen_on unix:@mykitty + +include theme.conf +include keymap.conf + +shell_integration enabled diff --git a/.config/kitty/theme.conf b/.config/kitty/theme.conf new file mode 100644 index 0000000..369da8d --- /dev/null +++ b/.config/kitty/theme.conf @@ -0,0 +1,49 @@ +# gruvbox dark by morhetz, https://github.com/morhetz/gruvbox +# This work is licensed under the terms of the MIT license. +# For a copy, see https://opensource.org/licenses/MIT. + +background #282828 +foreground #ebdbb2 + +cursor #928374 + +selection_foreground #928374 +selection_background #3c3836 + +color0 #282828 +color8 #928374 + +# red +color1 #cc241d +# light red +color9 #fb4934 + +# green +color2 #98971a +# light green +color10 #b8bb26 + +# yellow +color3 #d79921 +# light yellow +color11 #fabd2d + +# blue +color4 #458588 +# light blue +color12 #83a598 + +# magenta +color5 #b16286 +# light magenta +color13 #d3869b + +# cyan +color6 #689d6a +# lighy cyan +color14 #8ec07c + +# light gray +color7 #a89984 +# dark gray +color15 #928374 diff --git a/.config/kitty/toggle_term.py b/.config/kitty/toggle_term.py new file mode 100644 index 0000000..10b45e2 --- /dev/null +++ b/.config/kitty/toggle_term.py @@ -0,0 +1,33 @@ +from kittens.tui.handler import result_handler + + +def main(args): + pass + + +def toggle_term(boss): + tab = boss.active_tab + + all_another_wins = tab.all_window_ids_except_active_window + have_only_one = len(all_another_wins) == 0 + + if have_only_one: + boss.launch('--cwd=current', '--location=hsplit') + tab.neighboring_window("bottom") + else: + if tab.current_layout.name == 'stack': + tab.last_used_layout() + tab.neighboring_window("bottom") + else: + tab.neighboring_window("top") + tab.goto_layout('stack') + + +@result_handler(no_ui=True) +def handle_result(args, result, target_window_id, boss): + window = boss.window_id_map.get(target_window_id) + + if window is None: + return + + toggle_term(boss)