Kitty: [Question] How to use neovim (or vim) as scrollback pager?

Created on 31 Jan 2020  路  7Comments  路  Source: kovidgoyal/kitty

I've tried adding scrollback_pager nvim in kitty.conf but when I press kitty_mod+h I see the screen flash but no neovim.

PS: I recently stopped using tmux in favor of pure kitty and I very much like the idea of using neovim as the scrollback pager instead of tmux's built-in pager which is awkward and only has pseudo-vim key bindings.

Most helpful comment

Okay, thanks! Any reason why it doesn't/can't look at the user PATH?

BTW, if you are curious here's a preview of it working:

example

Still trying to perfect the command but here is what I have so far:

scrollback_pager /usr/local/bin/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 - "

I am making use of neovim's built-in terminal so it can handle the ANSI escape codes.

All 7 comments

You need to run vim in a mode where it understands ansi escape codes and
reads data from stdin. If you search the issues here you will find
examples of how to do that.

@kovidgoyal Kovid, just wanted to let you know that the reason scrollback_pager nvim was not working was because the nvim command was not found (see https://github.com/neovim/neovim/issues/11797#issuecomment-581088660)

Providing the full path to neovim via scrollback_pager /usr/local/bin/nvim works.

Any idea why this is the case?

Because it is not in the system wide PATH which is what kitty will see
when it tries to launch things.

Okay, thanks! Any reason why it doesn't/can't look at the user PATH?

BTW, if you are curious here's a preview of it working:

example

Still trying to perfect the command but here is what I have so far:

scrollback_pager /usr/local/bin/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 - "

I am making use of neovim's built-in terminal so it can handle the ANSI escape codes.

It does look at the user PATH. You are presumably talking about whatever
modifications you have made to PATH in your shell startup scripts. kitty
is not going to look at those. You need to make those modification
available to launchd if you want them to be used by GUI applications
like kitty.

Gotchya! Thanks for the explanation 馃憤

The terminal trick didn't work for me, so I modified it to use ft=man instead

scrollback_pager nvim -c 'setlocal ft=man nonumber nolist showtabline=0 foldcolumn=0' -c "autocmd VimEnter * normal G" -
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ulrar picture Ulrar  路  3Comments

hujianxin picture hujianxin  路  3Comments

lazarcf picture lazarcf  路  4Comments

hdriqi picture hdriqi  路  3Comments

wavexx picture wavexx  路  3Comments