ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.84k stars 455 forks source link

feat(telescope): support live preview of currently selected colorscheme #1085

Closed Cyberczy closed 7 months ago

Cyberczy commented 7 months ago

When I use fc to switch colorschemes,I can't see the change in real time. So I made some changes

Cyberczy commented 7 months ago

https://github.com/ayamir/nvimdots/assets/109653523/a0c20e9a-3121-4aaf-bffe-adc8331af29f

Cyberczy commented 7 months ago

https://github.com/ayamir/nvimdots/assets/109653523/723b8990-07e4-4ae4-ac1e-6b9d79badfec

Cyberczy commented 7 months ago

事实上,alpha.lua也是需要改变的。

yup, I had that problem too,and I'll try to fix it later

CharlesChiuGit commented 7 months ago

nice work!

Cyberczy commented 7 months ago

In fact, alpha.lua is also needed to change.

I made the same change in alpha.lua, but it didn't work

Cyberczy commented 7 months ago

In fact, alpha.lua is also needed to change.

I made the same change in alpha.lua, but it didn't work

https://github.com/ayamir/nvimdots/assets/109653523/c1188fd6-ca91-408b-b161-84d00f711335

CharlesChiuGit commented 7 months ago

I change the lazy event of telescope.nvim to BufWinEnter, but it also wont change the colorscheme in realtime.

I also went dig some docs about alpha.nvim and telescope.nvim, can't find any useful info tho.

image

Cyberczy commented 7 months ago

I change the lazy event of telescope.nvim to BufWinEnter, but it also wont change the colorscheme in realtime.

I also went dig some docs about alpha.nvim and telescope.nvim, can't find any useful info tho.

image

I had the same problem when using nvim-tree nvim-tree

Cyberczy commented 7 months ago

https://github.com/ayamir/nvimdots/assets/109653523/bdc1f5d9-48ca-45c6-b0ce-f3f712400fb1

In this video, you can clearly see that the README.md file works properly, but the nvim-tree file does not

CharlesChiuGit commented 7 months ago

i think it's about special filetype, for example, alpha's bufer filetype is alpha and nvim-tree's bufer filetype is NvimTree.

image image

Cyberczy commented 7 months ago

yup, but I'm running out of ideas

CharlesChiuGit commented 7 months ago

https://github.com/nvim-telescope/telescope.nvim/blob/84c5a71d825b6687a55aed6f41e98b92fd8e5454/lua/telescope/builtin/__internal.lua#L974-L1019

it seems the cause of the issue.

Jint-lzxy commented 7 months ago

I made the same change in alpha.lua, but it didn't work

AFAIU this is the expected behavior under the current implementation. Since these buffers aren't included in the listed buffer list, there's no simple way to open such a buffer in another window, and setting the current colorscheme to itself in those buffers (e.g, running :colorscheme catppuccin again when the current colorscheme is already catppuccin) is usually not supported across implementations. And this is also the behavior when Telescope is first opened (because the caret defaults to point to the current active colorscheme.) The following one-liner intuitively demonstrates this:

nvim unlisted_buffer "+set nobuflisted | Telescope colorscheme enable_preview=true"

So I'm kinda on the fence about whether to include this patch in our defaults, because it doesn't work as expected in some (rather common) use cases.

Cyberczy commented 7 months ago

So I'm kinda on the fence about whether to include this patch in our defaults, because it doesn't work as expected in some (rather common) use cases.

Thank you no matter what

ayamir commented 7 months ago

I tend to merge it and add the exception situations to wiki.