rkitover / vimpager

Use Vim as PAGER
http://www.vim.org/scripts/script.php?script_id=1723
Other
769 stars 72 forks source link

"Option not supported" when paging the contents of Kitty buffer #265

Open Hubro opened 1 year ago

Hubro commented 1 year ago

I'm using this keybind with Kitty:

map f1 launch --stdin-source=@screen_scrollback --type=overlay --stdin-add-formatting vimpager

This causes errors when vimpager starts:

Error detected while processing function AnsiEsc#AnsiEsc:
line  505:
E519: Option not supported: hl=8:Ignore,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:S
earch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,G:CursorLineSign,O:CursorLineFoldr:Question,s:Status
Line,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,
D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:Pme
nuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,0:Whitespace,I:NormalNC
Press ENTER or type command to continue
rkitover commented 1 year ago

I use kitty too, I'll take a look.

rkitover commented 1 year ago

The AnsiEsc support, to be honest, is only meant for simple things like Git diffs. And I haven't looked at or updated the version I have in many years. Dunno right now I'm going to do that soon, this project needs a lot of work in general.

If you don't really need AnsiEsc support, you can try turning it off with:

let g:vimpager.ansiesc = 0

.

I will look at whatever the bug is here a bit later.

rkitover commented 1 year ago

I tried your mapping, and it does run for me, although the AnsiEsc output is not ideal.

Did you install a different version of AnsiEsc with Plug or pathogen or something? Is your vim recent?

Hubro commented 1 year ago

Did you install a different version of AnsiEsc with Plug or pathogen or something? Is your vim recent?

I'm using NVIM v0.7.2, I just installed "rkitover/vimpager" using vim-plug. I haven't installed AnsiEsc separately.

It does "kind of" work for me too, after I move past the error:

image

image

Disabling ANSI support wouldn't be very useful, as it's really the only reason I'm trying vimpager :sweat_smile: Otherwise I would just pipe to nvim -, which is my current solution[1]. I'm just really tired of the terminal turning black/white any time I do. I'm basically trying to replicate the scrollback experience in Alacritty, which lets me scroll, select and copy from the history buffer using Vim keybindings.


rkitover commented 1 year ago

Disabling ANSI support wouldn't be very useful, as it's really the only reason I'm trying vimpager :sweat_smile:

The ANSI support in vimpager is generally very broken and is only meant for simple things like Git diffs/colordiff/etc.. As far as highlighting goes, the point of vimpager is to use Vim's powerful filetype detection and syntax highlighting support.

I haven't worked on this project in a while, but I might look into updating AnsiEsc in case it has gotten any better and/or fixing some things in it. Maybe there are better solutions now too, I may do some research. I'm not optimistic about this however and I'm not promising anything. AnsiEsc is a giant horrible hack, which I made even worse in my copy.

I'm basically trying to replicate the scrollback experience in Alacritty, which lets me scroll, select and copy from the history buffer using Vim keybindings.

Have you considered using the tmux scrollback support with something like:

set-window-option -g mode-keys vi

bind-key Escape copy-mode

# Add shift-page<up/down> bindings for scrolling.
bind-key -T root         -n S-PPage copy-mode -u
bind-key -T copy-mode-vi -n S-PPage send-keys -X page-up
bind-key -T copy-mode-vi -n S-NPage send-keys -X page-down

# Increase copy-mode buffer size.
set-option -g history-limit 300000

. This may give you most of what you want, you can copy and paste from the scrollback as well. This is from the tmux config I maintain here.