Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(previewer): improve bat theme #557

Merged
merged 179 commits into from
Jan 29, 2024
Merged

feat(previewer): improve bat theme #557

merged 179 commits into from
Jan 29, 2024

Conversation

linrongbin16
Copy link
Owner

@linrongbin16 linrongbin16 commented Jan 18, 2024

The tmTheme

  1. the .tmTheme: https://www.sublimetext.com/docs/color_schemes_tmtheme.html
  2. convert tmTheme to vim:
    1. https://github.com/ku1ik/coloration/blob/eca9d85b4df41dd2399e0065714fc8715306f591/lib/coloration/writers/vim_theme_writer.rb
    2. https://gist.github.com/jojonas/fb7a26ccdaa721afa3fe
  3. convert vim syntax to tmTheme: https://stackoverflow.com/questions/28592093/converting-emacs-vim-highlighting-to-textmate-for-sublimetext
  4. sublime tmTheme:
    1. globals: https://www.sublimetext.com/docs/color_schemes.html#global-settings
    2. minimal coverage: https://www.sublimetext.com/docs/scope_naming.html#minimal-scope-coverage

Theme Implementations

  1. base16 theme:
    1. bat base16 theme: https://github.com/sharkdp/bat/blob/master/assets/themes/base16.tmTheme
    2. vim-base16: https://github.com/chriskempson/base16-vim/
    3. textmate-base16: https://github.com/chriskempson/base16-textmate/blob/master/Themes/base16-default-dark.tmTheme
  2. dracula theme:
    1. tmTheme: https://github.com/dracula/sublime/blob/09faa29057c3c39e9a45f3a51a5e262375e3bf9f/Dracula.tmTheme
    2. vim:
  3. rose-pine theme:
    1. sublime: https://github.com/rose-pine/sublime-text/blob/main/rose-pine.sublime-color-scheme
    2. vim: https://github.com/rose-pine/vim/blob/main/colors/rosepine.vim
  4. catppuccin theme:
    1. sublime: https://github.com/catppuccin/sublime-text/blob/main/Catppuccin%20Mocha.sublime-color-scheme
    2. vim: https://github.com/catppuccin/vim/blob/main/colors/catppuccin_mocha.vim

Regresion test

Platforms

  • windows
  • macOS
  • linux

Tasks

  • FzfxFiles
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-R to switch between restricted/unrestricted mode, and the lines count is consistent when press multiple times.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file, and open the test/hello world.txt, test/goodbye world/goodbye.lua files.
    • Both fd and find works.
  • FzfxLiveGrep
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-R to switch between restricted/unrestricted mode, and the lines count is consistent when press multiple times.
    • Use -w to match word only, use -g *.lua to search only lua files.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file, and open the test/hello world.txt, test/goodbye world/goodbye.lua files.
    • Both rg and grep works.
  • FzfxBuffers
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-D to delete buffers, and delete the test/hello world.txt, test/goodbye world/goodbye.lua buffers.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file.
  • FzfxGFiles
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-W to switch between workspace/current folder mode.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file.
  • FzfxGLiveGrep
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file.
  • FzfxGStatus
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-W to switch between workspace/current folder mode.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file.
    • Both with/without delta works.
  • FzfxGBranches
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-R/CTRL-O to switch between local/remote branches.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to checkout branch.
  • FzfxGCommits
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-A to switch between git repo commits/current buffer commits.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to copy commit hash.
    • Both with/without delta works.
  • FzfxGBlame
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to copy commit hash.
    • Both with/without delta works.
  • FzfxLspDiagnostics
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-W to switch between workspace/current buffer diagnostics.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file.
  • FzfxLspDefinitions, FzfxLspTypeDefinitions, FzfxLspReferences, FzfxLspImplementations
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Go to definitions/references (this is the most 2 easiest use case when developing this lua plugin with lua_ls).
    • Press ESC to quit, ENTER to open file.
  • FzfxLspIncomingCalls, FzfxLspOutgoingCalls
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Go to incoming/outgoing calls.
    • Press ESC to quit, ENTER to open file.
  • FzfxCommands
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-E/CTRL-A to switch between user/ex/all vim commands.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to feed vim command.
  • FzfxKeyMaps
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-O/CTRL-I/CTRL-A/CTRL-V to switch between normal/insert/visual/all vim key mappings.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to feed vim keys.
  • FzfxFileExplorer
    • Press CTRL-J/CTRL-K to move down/up and preview contents.
    • Press CTRL-U/CTRL-R to switch between filter/include hidden files mode.
    • Press ALT-L/ALT-H to cd into folder and cd upper folder.
    • Use V/W/P/R variants (visual selection, cursor word, yank text, resume last).
    • Press ESC to quit, ENTER to open file, and open the test/hello world.txt, test/goodbye world/goodbye.lua files.
    • All eza/lsd/ls works.

@github-actions github-actions bot added the feat label Jan 18, 2024
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 134 lines in your changes are missing coverage. Please review.

Comparison is base (e5df3c5) 77.19% compared to head (4fa4ee2) 76.23%.

Files Patch % Lines
lua/fzfx/lib/bat_themes.lua 61.95% 113 Missing ⚠️
lua/fzfx/detail/bat_helpers.lua 47.05% 18 Missing ⚠️
lua/fzfx/helper/previewers.lua 66.66% 2 Missing ⚠️
lua/fzfx/detail/fzf_helpers.lua 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #557      +/-   ##
==========================================
- Coverage   77.19%   76.23%   -0.96%     
==========================================
  Files          48       50       +2     
  Lines        5512     5850     +338     
==========================================
+ Hits         4255     4460     +205     
- Misses       1257     1390     +133     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@linrongbin16 linrongbin16 changed the title feat(previewer): auto-generate theme for bat feat(previewer): improve bat theme Jan 18, 2024
@savchenko
Copy link
Contributor

that's exactly I am doing in this PR.
For now it looks 85% close to nvim highlighting.

This would be huge! Please keep it, at least as a function that user can call independently to generate a bat theme from their nVim colourscheme. Happy to test on my heavily modified Kanagawa theme.

@linrongbin16
Copy link
Owner Author

Hope there's experts who knows well on both tmTheme and Neovim highlights and save me.

I will merge this into main branch now. it's so difficult to make the highlights 100% same between nvim and bat previewer.

@linrongbin16 linrongbin16 merged commit 36e4c29 into main Jan 29, 2024
9 checks passed
@linrongbin16 linrongbin16 deleted the feat-custom-bat-theme branch January 29, 2024 10:08
This was referenced Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants