-
Notifications
You must be signed in to change notification settings - Fork 22
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
Highlights are based on the literal syntax only, hence often incorrect #66
Comments
To properly support both strictly correct highlighting which works with custom log formats, Flog would have to implement a parser for the I think the added complexity would not be worth it, even if I were not trying to keep Flog light, and there could be a performance hit as well. The simple highlight groups are the tradeoff for custom log formats. One thing you could do is use the AnsiEsc plugin with Flog. This will use shell highlighting in Flog, however there will be a performance hit, and you will have to use color items (ex. There has been some interest as well in adding an option to insert hidden characters into the format to improve highlight groups. However, you would have to include these characters in your output format as well. Let me know what you think of this option. Finally I have made some syntax fixes based on your example. This eliminates ref highlighting sometimes when it can, and it eliminates a bug as well. I know none of this is exactly what you want to see, but I hope it helps. |
Thank you @rbong for the detailed and fast response. I understand this would be tricky and difficult to implement. Given that the content of commit logs are not generated by the plugin but by That said, using |
The only viable true solution right now is to use hidden characters. Because I am not very interested in this feature, I can't think of a nice user experience, and the last time I benchmarked inserting a ton of hidden characters into the output it was not performant, I'm unlikely to fix this issue unless if there's a lot of support. Also AnsiEsc support has been removed from v2 since the biggest reason it was implemented (graph branch color) has been resolved. If there is interest in bringing it back, I may just implement Ansi code highlighting myself since it would be much more controlled and performant. |
Performance is no longer such an issue, but only in Neovim, so I will implement this in |
I'm realizing re-implementing ANSI escape codes is not the right way to implement this feature.
The solution will be better but may still include hidden characters. Still thinking about the correct interface. |
I added accurate commit highlighting to v3. It works in both Vim and Neovim. It's off by default. It uses custom concealed escape codes. Enable it with: let g:flog_enable_dynamic_commit_hl = 1 Pros:
Cons:
For me, because I am happy with the performance on scroll in v2 anyways on my machine (PLEASE post an issue with your specs if you are not), I am going with this implementation, but leaving it off by default because of the performance issue. If you have any feedback, issues, or questions, please post in the v3 issue or start a new issue. |
Highlights in vim-flog buffers are based on the syntax only rather than its structure (as per the git log format), which can be incorrect if commit messages contain some characters as shown in the above screenshot. Although the commit messages in the screenshot are written a bit artificially, I can see similar issues on several in-the-wild git repositories.
For example:
[
alphanumericwords]
: recognized as commit hash(
...something ...)
: recognized as refspec{
...something ...}
: recognized as authorsSo any parenthesis, brackets, braces in a commit message will be recognized by flog. Or, if the format string doesn't wrap the commit hash (
%h
) with[...]
, it won't be highlighted asflogHash
. Similar things can be said forflogAuthor
without{...}
, etc.Would it be possible to improve syntax for the highlights so that it could be agnostic to the specific git log format used by Flog (i.e., the
-format
args)?The text was updated successfully, but these errors were encountered: