Reading gnu-screen logs with vim

隐身守侯 提交于 2021-02-05 08:14:49

问题


Recently I've discovered a wonderful terminal multiplexing tool called gnu-screen. I'm satisfied with it completely. But I've encountered one inconvenience I'd like to improve.

'C-a H' command makes screen log everything to a log file called named 'screenlog.*'. But encodes control characters in a weird way. For example if you open the log file with 'less' you might see some cryptic characters and the log file is unreadable. You have to run 'less -r' or 'less --raw-control-chars' which helps to encode those control characters correctly.

So far so good. But if you want to edit the log or read it with vim then you encounter the same problem with control characters.

I've googled this problem and looked up at SO but I've been overwhelmed because there's so much info about vim and screen. Unfortunately I haven't found the solution yet.

Perhaps you know the solution for this problem or some workaround.

UPD Thanks to Frédéric Hamidi's comment I discovered those characters are the terminal escape sequences of font color, etc. Vim as an editor sees them and by default edits them. The plugin Frédéric suggested tells vim to interpret them.


回答1:


To provide an answer here and finally mark this fixed: The AnsiEsc plugin adds syntax highlighting for ANSI color sequences. So instead of seeing ^[[30m; the following text will be highlighting in the corresponding color, just like when using less --raw-control-chars.



来源:https://stackoverflow.com/questions/9428107/reading-gnu-screen-logs-with-vim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!