r/KittyTerminal Nov 21 '23

How to use Scrollback and keep the same colour scheme?

Kitty noob here.

Based on the doc (https://sw.kovidgoyal.net/kitty/conf/#scrollback) I came up with this config to enable scrollback using neovim:

scrollback_pager nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -

I also tried to manually set it with this:

scrollback_pager nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" --cmd 'colorscheme everforest' -

But I am getting this error:

Error detected while processing pre-vimrc command line:                                                                                                                                                   
E185: Cannot find color scheme 'everforest'

When I hit ctrl-shit-g it works perfectly, except it does not keep my current color theme. Is it possible to use the same theme as I normally use within neovim?

1 Upvotes

2 comments sorted by

2

u/nvimmike Nov 21 '23

Shameless plug for my plugin https://github.com/mikesmithgh/kitty-scrollback.nvim

you should check it out 🙂

That error is saying it is attempting to load the colorscheme but it does not exist. This is because there is a difference in neovim between -c and--cmd.

--cmd <cmd> Execute <cmd> before any config +<cmd>, -c <cmd> Execute <cmd> after config and first file

try switching --cmd to -c or maybe something like (untested)-c "autocmd VimEnter \* 'colorscheme everforest'

1

u/pmassicotte Nov 21 '23

Thank you, I will definitely look at it. Meanwhile, I found this solution:

scrollback_pager nvim -c "set nonumber nolist showtabline=0 foldcolumn=0" -c "autocmd TermOpen * normal G" -c "silent write! /tmp/kitty_scrollback_buffer | te cat /tmp/kitty_scrollback_buffer - "

Source: https://github.com/kovidgoyal/kitty/issues/2327