NvChad / base46

NvChad's base46 theme plugin with caching ( Total re-write )
Other
210 stars 203 forks source link

color scheme issue when nvim is set as man pager #240

Closed xorgal closed 1 year ago

xorgal commented 1 year ago

Describe the bug

When nvim is set as MANPAGER and opening single man page all works good. But, when opening another man page in a new buffer or just opening empty one then colors are being reset.

To Reproduce Set nvim as default pager export MANPAGER='nvim +Man!' and open it man nvim Open reference to another man page or just make a new buffer.

Expected behavior Do not change color scheme.

Screenshots If applicable, add screenshots to help explain your problem.

nvim man 1 nvim man 2

Desktop (please complete the following information):

siduck commented 1 year ago
vim.api.nvim_create_autocmd("StdinReadPre", {
  group = vim.api.nvim_create_augroup("stdinColors", {}),
  callback = function()
    vim.api.nvim_del_augroup_by_name "stdinColors"
    dofile(vim.g.base46_cache .. "syntax")
  end,
})

put this in custom/init.lua

teklabania commented 1 year ago

Thanks for your comment @siduck, but don't you think this is just a workaround? A change should be added to the code so everyone could benefit.

siduck commented 1 year ago

@teklabania very less people read man pages through nvim! or pipe stdin stuff into nvim so yea, but that solution isnt a workaround. I'd have done the same in core/utils.lua's (lazy_load) function

teklabania commented 1 year ago

@teklabania very less people read man pages through nvim!

Have you collected any statistics on this if you're so sure? ;)

Thanks for doing a change to core.

siduck commented 1 year ago

@teklabania very less people read man pages through nvim!

Have you collected any statistics on this if you're so sure? ;)

Thanks for doing a change to core.

i'm just assuming :p .

if there will be more 3 users who bring up this same issue then i'll consider adding this thing into core

xorgal commented 1 year ago

Actually, I do agree, nvim might not be the best candidate for viewing man pages. But sometimes it's very convenient to use multiple buffers when reading large page with plenty references.

Anyways, thanks for the fix @siduck, it did work indeed!