Open fcying opened 4 years ago
I'm not sure I understand. So you have a text file with the following text:
\e[00;32m2020-07-22 22:46:19.260\e[00;34m TEST\e[0m end
And you want it to be highlighted as something along the lines of this:
Is this the behaviour you are looking for?
I want it to be highlighted like this:
\e[00;32m
\e[00;34m
\e[0m
is Escape sequences, it only set text color which after it, it does not show itself.
More explanation: ANSI_escape_code#Colors
+1 Very useful for coloring the output inside quickfix window.
This is somehow similar to html tags. The codes may appear in any order, these will produce the same output:
$ echo -en \
'\n^[[1m^[[34mTEST^[[0m' \
'\n^[[34m^[[1mTEST^[[0m' \
'\n^[[1;34mTEST^[[0m'
I want it to be highlighted like this:
\e[00;32m
\e[00;34m
\e[0m
is Escape sequences, it only set text color which after it, it does not show itself.More explanation: ANSI_escape_code#Colors
If you are looking for the text to change (\e[00;32m
to disappear, as in your screenshot and how a terminal displays it), then vim-hexokinase does not have this functionality currently since that would require use of :h :syn-conceal
. I'll mark this as a feature request and I may get to it, but to be honest I avoided adding any :h :syn-conceal
highlighters because the conceal api is quite painful to deal with.
If someone wants to try adding this functionality you can do so by extending https://github.com/rrethy/hexokinase and adding the ability to recognize ansi escapes codes, then you would add a highlighter based on :h hexokinase-custom-highlighters
.
Alternatively, Colorizer has this functionality.
At least highlighting would be nice to have, concealing may not be so important.
This would be a REALLY nice solution to https://github.com/Olical/conjure/issues/53 - I think I hacked colorizer or something to get it to do what I wanted, I think this plugin could be a massive improvement on that!
(conjure introduces a log that's kind of like a REPL and CAN contain ansi escape sequences, so having them displayed correctly is a really nice experience)
In my experience, AnsiEsc works but had a bunch of weird quirks, like it would break the rest of the syntax highlighting and vanish when you switched windows sometimes. I hacked it to get it to overlay the escape code colouring on top of my existing theme, you can find that hacked version here, maybe people can just use that: https://github.com/Olical/AnsiEsc
I think colorizer had a bunch of issues too, see the issue I linked for more info on the state of colouring and hiding ansi escape sequences in nvim.
This will be very nice to have, In my case only https://github.com/chrisbra/Colorizer supported this.
I try to use Hexokinase_palettes to set up ansi color, but not success. Can you help me see how to set this situation?
text:
display in term:
color flag is
\e[
,00;32m
is color name, text after this flag add color(not display color flag),\e[0m
stop add color, or another color flag change the next text color\e[00;34m