ansi

ANSI Color Codes in VIM

不想你离开。 提交于 2019-11-29 21:20:11
I have a script that generates a log file with ANSI color codes in them like so: [2012-05-14 18:00:02] ^[[0mINF: -- Starting update script --^[[0m [2012-05-14 18:00:29] ^[[91mERR: Improper date, entry being ignored.^[[0m Is there any way to get Vim to understand these color codes? Thanks for any help. Use Charles Campbell's (Dr Chip) AnsiEsc plugin: http://www.vim.org/scripts/script.php?script_id=302 Before: :AnsiEsc<CR> I'm not sure about vim, but if you're just viewing a log file (ie you don't need to be able to edit) you could use less: less -R Since the link in the accepted answer doesn't

PHP strtr vs str_replace benchmarking

谁都会走 提交于 2019-11-29 16:38:20
I'm curious what the most performant method of doing string transformations is. Given a n input string and a set of translations, what method is the most efficient in general? I currently use strtr() , but have tested various looping methods, str_replace() with an array, etc. The strtr() method benchmarks the fastest on my system, depending on the translations, but I'm curious if there are faster methods I haven't thought of yet. If it's pertinent, my particular use case involves transforming 2-byte strings into ANSI color sequences for a terminal. Example: // In practice, the number of

How to recognize ansi color escape codes in Windows7 64 bit command terminal

风流意气都作罢 提交于 2019-11-29 10:53:48
I have tried Ansicon and I still cannot get ansi escape sequences to become recognized and interpreted in my CMD.EXE command prompt on Windows 7 64 bit. Has anyone been able to work this correctly and get a colorized console with this OS? I ran into the same problem today, and found a workaround. The commandline utility Windows ANSI Color detects ANSI color codes and sets the corresponding console color. Example: myapp.bat | wac where wac is the Windows ANSI color utility Ansicon use dll injection in order to enable ansi color in cmd.exe, which is disabled with the standard user privileges.

VS2010 C and C++ - enforce ANSI compliance for Linux/gcc compatibility?

别说谁变了你拦得住时间么 提交于 2019-11-29 10:48:12
I'm taking a class in which I'm required to write some C++ apps for Linux. I really, really dislike the dev tools available under Linux, but I love VS2010. Is there any sort of compiler switch which will enforce ANSI or gcc compatibility in VC++? Or can I swap the compiler out for gcc and still use the VS environment? You can disable Microsoft extensions to the ANSI C and ANSI C++ standards by specifying the /Za flag, which will make the compiler emit errors if you use non-standard C and C++ features. http://msdn.microsoft.com/en-us/library/0k0w269d(v=VS.100).aspx However, this doesn't

Convert a file encoding using R? (ANSI to UTF-8)

丶灬走出姿态 提交于 2019-11-29 06:45:16
I wish to convert an HTML file encoded in ANSI to UTF-8, using R. Is there a tool, or a combination of tools, that can make this work? Thanks. Edit : o.k, I've narrowed my problem to another one. It is re-posted here: Using "cat" to write non-English characters into a .html file (in R) kohske you can use iconv: writeLines(iconv(readLines("tmp.html"), from = "ANSI_X3.4-1986", to = "UTF8"), "tmp2.html") tmp2.html should be utf-8. Edit by Henrik in June 2015: A working solution for Windows distilled from the comments is as follows: writeLines(iconv(readLines("tmp.html"), from = "ANSI_X3.4-1986",

adding text decorations to console output

白昼怎懂夜的黑 提交于 2019-11-29 04:25:17
I have a c# .net 3.5 application that writes text to the console using a StreamWriter. Is there a way I can add text decorations like underline and strikethrough to the text that is printed to the console? Possibly using ANSI escape sequences? TextWriter writer = new StreamWriter(Console.OpenStandardOutput()); writer.WriteLine("some underlined text"); Thanks, PaulH The Windows console does not support ANSI escape sequences. To my knowledge, the only way to change the attributes of an output character is to call SetConsoleTextAttribute before writing the character. Or, in .NET, modify the

Adding ANSI color escape sequences to a bash prompt results in bad cursor position when recalling/editing commands

谁都会走 提交于 2019-11-29 03:44:06
If I set my command prompt like: export PS1='\033[0;33m[\u@\h \w]\$ \033[00m' The color of the prompt will be yellow and everything after the '$' character will be the default terminal color. This is what I expect. However, If I recall a command line and attempt to edit it, moving the cursor -- either UpArrow/Ctrl-A (set -o emacs) or ESC K (set -o vi) if the command line I'm trying to edit is long enough, the cursor is not positioned at the beginning of the command. Typing either Ctrl-A (set -o emacs) or ^ (set -o vi) will not move the cursor to what I'm seeing as the beginning of the recalled

How do I display ANSI color codes in emacs for any mode?

孤者浪人 提交于 2019-11-29 01:53:42
问题 I have a log file that uses ANSI escape color codes to format the text. The mode is fundamental . There are other answered questions that address this issue but I'm not sure how to apply it to this mode or any other mode. I know the solution has something to do with configuring ansi-color in some way. ANSI codes in shell mode ANSI codes in gdb mode 回答1: You could use code below (require 'ansi-color) (defun display-ansi-colors () (interactive) (ansi-color-apply-on-region (point-min) (point-max

How to load ANSI escape codes or get coloured file listing in WinXP cmd shell?

a 夏天 提交于 2019-11-28 23:46:07
This is related to this question : How to get coloured file listing in windows cmd shell ? I'm trying to get, wouldn't you believe it, coloured file listing in windows cmd shell. Windows are XP SP2, if that matters. In the old DOS days there used to be little programs like hdir, adir and such which displayed that nice. Nowadays, such programs are no more. There is however, ls , from unixkit-tiny or unixtools. Unfortunatelly, it uses ANSI escape codes for displaying colours, and cmd doesn't handle those too well. There are several solutions which include loading ansi.sys and command.com, but

C++ project type: unicode vs multi-byte; pros and cons

血红的双手。 提交于 2019-11-28 22:39:16
I'm wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set. Are there pros to going Unicode straight from the start, implying all your strings will be in wide format? Are there performance issues / larger memory requirements because of a standard use of a larger character? Is there an advantage to this method? Do some processor architectures handle wide characters better? Are there any reasons to make your project Unicode if you don't plan on supporting additional languages? What reasons