From 65cd165fc4fb7cfae68db8ad33051667dbd52f9d Mon Sep 17 00:00:00 2001 From: Rafael Madriz Date: Sun, 30 Apr 2023 10:38:52 -0300 Subject: [PATCH] kitty: Use nvim for `scrollback_pager` The `scrollback_pager` script was taken from kovidgoyal/kitty#719 comment: * Change font size * Remove some window options --- private_dot_config/kitty/kitty.conf | 55 ++++++++++---------- private_dot_config/kitty/scrollback_pager.sh | 22 ++++++++ 2 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 private_dot_config/kitty/scrollback_pager.sh diff --git a/private_dot_config/kitty/kitty.conf b/private_dot_config/kitty/kitty.conf index 6ce70193..100bc1bb 100644 --- a/private_dot_config/kitty/kitty.conf +++ b/private_dot_config/kitty/kitty.conf @@ -7,47 +7,46 @@ font_family JetBrainsMono Nerd Font # font_family CaskaydiaCove Nerd Font -font_size 12 +font_size 11.5 # options: never, always, cursor disable_ligatures cursor # ========================================================= # Windows -remember_window_size no -initial_window_width 1000 -initial_window_height 550 -window_padding_width 0.5 +# remember_window_size no +# initial_window_width 1000 +# initial_window_height 550 +# window_padding_width 0.5 enabled_layouts * # ========================================================= # Settings -update_check_interval 0 -enable_audio_bell no -allow_remote_control yes -strip_trailing_spaces smart -mouse_hide_wait 3.0 -open_url_with default -copy_on_select yes -sync_to_monitor yes -inactive_text_alpha 0.9 -linux_display_server auto +update_check_interval 0 +enable_audio_bell no +allow_remote_control yes +strip_trailing_spaces smart +mouse_hide_wait 3.0 +open_url_with default +copy_on_select yes +sync_to_monitor yes +inactive_text_alpha 0.9 +linux_display_server auto +scrollback_pager ~/.config/kitty/scrollback_pager.sh 'INPUT_LINE_NUMBER' 'CURSOR_LINE' 'CURSOR_COLUMN # ========================================================= # Maps kitty_mod ctrl+shift -map ctrl+shift+s paste_from_selection -map kitty_mod+enter new_window -map ctrl+shift+w close_window -map super+] next_window -map kitty_mod+] next_window -map super+[ previous_window -map super+alt+] move_window_forward -map super+alt+[ move_window_backward -map ctrl+alt+p last_used_layout -map super+t new_tab_with_cwd -# map ctrl+f launch --type=overlay --stdin-source=@screen_scrollback /usr/bin/fzf --no-sort --no-mouse --exact -i -# map f1 create_marker -# map f2 remove_marker +map ctrl+shift+s paste_from_selection +map kitty_mod+enter new_window +map ctrl+shift+w close_window +map super+] next_window +map kitty_mod+] next_window +map super+[ previous_window +map super+alt+] move_window_forward +map super+alt+[ move_window_backward +map ctrl+alt+p last_used_layout +map super+t new_tab_with_cwd + # ========================================================= # Theme diff --git a/private_dot_config/kitty/scrollback_pager.sh b/private_dot_config/kitty/scrollback_pager.sh new file mode 100644 index 00000000..251806b6 --- /dev/null +++ b/private_dot_config/kitty/scrollback_pager.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# source: https://github.com/kovidgoyal/kitty/issues/719#issuecomment-952039731 + +set -eu + +if [ "$#" -eq 3 ]; then + INPUT_LINE_NUMBER=${1:-0} + CURSOR_LINE=${2:-1} + CURSOR_COLUMN=${3:-1} + AUTOCMD_TERMCLOSE_CMD="call cursor(max([0,${INPUT_LINE_NUMBER}-1])+${CURSOR_LINE}, ${CURSOR_COLUMN})" +else + AUTOCMD_TERMCLOSE_CMD="normal G" +fi + +exec nvim \ + -u NONE \ + -c "map q :qa!" \ + -c "xmap / /\\%V" \ + -c "set scrollback=100000 termguicolors laststatus=0 cursorline" \ + -c "autocmd TermEnter * stopinsert" \ + -c "autocmd TermClose * ${AUTOCMD_TERMCLOSE_CMD}" \ + -c 'terminal sed