macvim-dev / macvim-dev/macvim

FZF/bat preview pane is not loading the correct color scheme

Đang mở
#1,177 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Vim Script
Star
7.9k
Fork
691
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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:
macvim issue

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:
Screen Shot 2021-03-23 at 8 21 22 PM

No issue in Neovim as well:
Screen Shot 2021-03-23 at 8 22 00 PM

Workaround
Interestingly, if I add this in the setting, the MacVim app will have the expected behavior:
let $BAT_THEME="TwoDark

Screen Shot 2021-03-23 at 8 26 55 PM

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi xem trước trong MacVim với .vimrc dùng chung và các thiết lập môi trường từ .zshrc, đặc biệt là FZF_PREVIEW_COMMAND và BAT_THEME. So sánh kết quả của MacVim với Vim và Neovim bằng cùng một tệp và theme; hoàn thành có nghĩa là phần xem trước fzf/bat hiển thị color scheme như mong đợi mà không cần workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
macos, vim
Lĩnh vực
desktop
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.