3

I have a Rails application with logs that I used to check with vim. I saw a lot of ugly codes like ^[[1m^[[35m, that I found out it´s ansi color codes.

I didn´t want to remove then but use them, so I installed the Charles Campbell AnsiEsc.vim plugin for that.

Although I don´t see any colors, it´s fine because I don´t see all the ugly codes anymore, except that I still see some of them like : ^[[1m^[[35m

Update: Following @Christian suggestions, I have also installed Colorizer plugin. Probably, I´m doing something wrong but I still have the same issue. This is and example of file with vim, and the output I got when running colorizer:

D, [2015-12-29T11:59:43.258643 #7341] DEBUG -- :   ^[[1m^[[36m (0.1ms)^[[0m  ^[[1mCOMMIT^[[0m
:ColorHighlight
Cannot fork
Colorizer: Some error occured here:  ColorTerm 
Press ENTER or type command to continue
Rober
  • 5,868
  • 17
  • 58
  • 110
  • I'm curious, can you open the logs with `less -R` and see the colors? If so, do the ansi escapes that are still shown in vim get interpereted by less? – Randy Morris Nov 25 '15 at 15:33
  • Can't you just use a pager? Editors are for editing, not viewing. – romainl Nov 25 '15 at 16:01
  • 1
    @RandyMorris yes, I see the colors perfect with a less -R and I don´t see these codes. I only see them when vim. – Rober Dec 02 '15 at 20:02

1 Answers1

1

You can use the AnsiEsc plugin or my Colorizer plugin for coloring the Ansi Escape sequences. Both plugins should also hide the non-visible parts of the Escape Sequences.

Christian Brabandt
  • 8,038
  • 1
  • 28
  • 32
  • Dear, I read your answer, and it makes no sense to suggest an approach that I´m already using. If you want to help, try to help taking the context into account. Would be great that you recognize, you just read the first line. Finally, If you were the one that click on -1, let me tell you, you don´t have any reason. My question is right, is your answer what is useless. – Rober Dec 02 '15 at 20:08
  • Dear, have you tried my plugin? I have been working hard to make this plugin and try to colorize all different kindds of things. I would be nice of you to take this into account, before you accuse me that I don't know of what I am talking about. BTW: If you use any of the plugins, and have an issue with that, you should better ask the author of the plugins (and I do actively support my plugins and offer you my help **hint**) – Christian Brabandt Dec 02 '15 at 20:11
  • That is an interesting error. Please consider opening an issue at my plugins github page and please add a sample logfile. BTW: The initial error seems to come from vim itsself, calling the shell. So please check your 'shell' settings. – Christian Brabandt Dec 29 '15 at 12:23
  • I´m sorry. I´m not Unix skilled. I wouldn´t know what to check in my shell. – Rober Dec 29 '15 at 15:54
  • what i meant was to check the different shell settings for vim. E.g. did you set some of them? What Vim version is this? Gui or terminal Vim? Can you check when starting with vim -u NONE -N and then manually source Colorizer/plugin/ColorizerPlugin.vim (`:so Colorizer/plugin/ColorizerPlugin.vim`)? – Christian Brabandt Dec 29 '15 at 20:20
  • Doesn't seem to work well on actual log files in production, maybe on small files. I ran :ColorHighlight on my log file and vim has been stuck at 100% CPU for 10 minutes now... – Hackeron May 22 '22 at 11:27