Skip to content

Commit

Permalink
kitty: Use nvim for scrollback_pager
Browse files Browse the repository at this point in the history
The `scrollback_pager` script was taken from kovidgoyal/kitty#719 comment:
<kovidgoyal/kitty#719 (comment)>

* Change font size
* Remove some window options
  • Loading branch information
rafamadriz committed Apr 30, 2023
1 parent cc2d43a commit 65cd165
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 28 deletions.
55 changes: 27 additions & 28 deletions private_dot_config/kitty/kitty.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions private_dot_config/kitty/scrollback_pager.sh
Original file line number Diff line number Diff line change
@@ -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 <silent> q :qa!<CR>" \
-c "xmap / <esc>/\\%V" \
-c "set scrollback=100000 termguicolors laststatus=0 cursorline" \
-c "autocmd TermEnter * stopinsert" \
-c "autocmd TermClose * ${AUTOCMD_TERMCLOSE_CMD}" \
-c 'terminal sed </dev/fd/63 -e "s/'$'\x1b'']8;;file:[^\]*[\]//g" && sleep 0.01 && printf "'$'\x1b'']2;"' 63<&0 0</dev/null

0 comments on commit 65cd165

Please sign in to comment.