Closed systemmonkey42 closed 2 years ago
thanks. I fixed the first part. The second, I cannot reproduce, seems to work with let g:colorizer_auto_filetype="text"
In contrast: g:colorizer_auto_color
should be either set to 1
or 0
. So can you please give correct reproduction steps?
Sorry, I gave up on colorizer because once I got it working I realised how many problems it had, and left it at that.
As an example, with a typical colored log file (The example I used is 56000 lines)
opening the file in vim, and executing
:AnsiESC
From the AnsiESC plugin produces clean highlighted text in about 0.05 seconds.
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
1 0.056895 0.003746 AnsiEsc#AnsiEsc()
1 0.028181 0.000053 <SNR>193_airline_refresh()
6 0.026611 0.005349 airline#highlighter#highlight()
When I reload the file, or split the buffer, the contents retain their color and formatting.
The same file, using :ColorHighlight
, stops after a minute with a vim error about time being exceeded and kills the operation
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
1 65.109219 1.297908 Colorizer#DoColor()
41578 63.512494 2.109064 <SNR>194_PreviewColorTerm()
41578 39.454725 0.756910 <SNR>194_SetMatcher()
Reloading files, or splitting buffers results in color highlighting being lost, escape characters reappear, and even forcing ':ColorHighlight!' restores colours, but the escape characters remain visible
Out if interest, what is the exact build version of VIM you are using? I will test with that version and compare.
Well, the ANSI terminal coloring was never really inscope for colorizer. I just added it because it seems to fit into it. I have noticed slowness myself with long terminal logfiles from e.g. CI output. So I suppose regexp parsing and creating several hundreds of matches may slow it down significantly.
If AnsiESC works, fine. I never really liked the :syntax
approach from it. But use whatever works for you best. And note, Vim is an editor, not something that should parse terminal output.
I've been unable to colorize text files with ANSI escape sequences.
It appears the following
doesn't do what it says it does.
Changing it to
allows files of type text to be highlighted, though its still not perfect because it doesn't work when type "text" is added to
g:colorizer_auto_color
(Need to manually run:ColorHighlight!
)What is the correct way to highlight files of type "text" without modifying the plugin?
Thanks