macvim-dev / macvim-dev/macvim
FZF/bat preview pane is not loading the correct color scheme
还没有人认领这个 Issue。
- 主要语言
- Vim Script
- 星标
- 7.9k
- 派生
- 691
- PR 合并指标
- 30 天内没有已合并 PR
描述
Describe the bug
Neovim has known color scheme issue with bat's preview utility which is usually used together with fzf.vim. Basically, Neovim unsets the COLORTERM envvar which bat relies on. This was fixed already on Neovim's nigthly builds.
https://github.com/sharkdp/bat/issues/634
https://github.com/neovim/neovim/issues/10836
Since I'm not using the Neovim nightly builds yet, my workaround is to add this in the .vimrc which also works:
let $FZF_PREVIEW_COMMAND="COLORTERM=truecolor bat --style=numbers --color=always --line-range :500 {}
Recently, tinkering with MacVim also since it's a great, fast, and lightweight alternative for quick preview of files/folders when I'm not in the terminal. Much better than Sublime Text, VC Code, or Atom. Just surprised that the fzf's preview again has an issue even I have the Neovim's workaround already, that is, the MacVim app renders the wrong color scheme:

Expected behavior
My Vim/Neovim shares common settings, and MacVim shares it also via .vimrc. Likewise, I use the One Dark theme, and the same file/folder has no color scheme issue in Vim:

No issue in Neovim as well:

Workaround
Interestingly, if I add this in the setting, the MacVim app will have the expected behavior:
let $BAT_THEME="TwoDark
Environment:
- Vim version [8.2] / Neovim [0.4.4] / MacVim [Snapshot 170]
- OS: [macOS 10.14.6 Mojave]
- Terminal: [Alacritty]
Additional context
My Vim/Neovim/MacVim shares the same settings, so it's kinda strange if MacVim is the odd man out. I set this export BAT_THEME="TwoDark" envvar in my .zshrc file which Vim/Neovim most likely recognizes, but MacVim seems to not utilize.
Thanks
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用共享的 .vimrc 和 .zshrc 中的环境设置在 MacVim 中复现预览行为,尤其是 FZF_PREVIEW_COMMAND 和 BAT_THEME。使用相同的文件和主题,将 MacVim 的结果与 Vim 和 Neovim 进行比较;当 fzf/bat 预览无需 workaround 即呈现预期的配色方案时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- macos, vim
- 领域
- desktop
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100