Closed Freed-Wu closed 1 year ago
I temporarily realize a plugin to do this work for me. If you realize it in vimtex, please apply this issue, and I'll solve the potential conflict.
I've added support for the fontawesome5
package now. Please test.
Also, thanks a bunch for providing a solution along with the issue report. I've more or less copied it, although I did found a few minor mistakes in the regexes. I also made some further improvements, I believe. I'll let you be the judge :)
Works great:
I have an advice:
Like https://github.com/lambdalisue/nerdfont.vim#contribution and https://github.com/voldikss/vim-browser-search/blob/master/assets/json/engines.json.
How about use a json to save the icons of fontawesome, then use
json_decode(join(readfile(s:json_path), ''))
?
Because these icons are only data, which use an independent data exchange format may be more reasonable.
Json can also be processed by other programs, such as json can be sorted more easily by jq -S .
if we want a sorted result?
or use other program to download data from the website and use the data to update the json if fontawesome add any new icons?
decode a json will cost a little time
Thanks for the advice. I agree in principle that having the data separated from the code is better. However, in this specific case, I believe it will bring little to no real advantage at a cost of slightly higher complexity. As a pragmatic plugin developer with not too much time, I'll therefore not do this. But I would be willing to consider a PR for something like this, if anyone (you) would be willing to help.
Notice that the order of the syntax match
statements is important, which is why I changed from the dictionary to a list. Specifically, the starred variant rules must come after the unstarred variants. Thus, the json_decode
should either read a list or be sorted after reading.
consider a PR for something like this
OK, I have tested a PR can work.
Cool! For future reference: #2528.
\usepackage{fontawesome5}
provides fontawesome 5 symbol in LaTeX. Older\usepackage{fontawesome}
provides fontawesome 4 symbol in LaTeX.Because https://github.com/FortAwesome/Font-Awesome#documentation, only conceal fontawesome5 is OK.
This is an example:
This is a full list (1440 icons, achieved from fontawesome5 documentation), their icons can be achieved from https://fontawesome.com/v5/cheatsheet/pro/solid: