VIM Unix commands printed in color

邮差的信 提交于 2019-12-01 16:52:56

You can't. But you can suspend the editor and drop to a shell relatively quickly;

Or you can use Ansi Filter to remove the escape sequences so you will at least not see a mess.

this one:

:!echo $(tput setaf 1)Hello world$(tput sgr0)

will print Hello world in color.

Don't use escape sequences, but named tput entries. (all times, not only in this example). read:
man teminfo; man infocmp; man tput - for more information.

based on comments I found this question very interesting.

Still searching for the better solution, but for now find this one - http://code.google.com/p/conque/ . Allow run colored commands inside MacVim's buffer.

Don't know if this would help, but running my RSpec tests inside vim gives me colored output using the --color option. I use the following command to run the current spec file inline:

:map ,t :w\|:!rspec --color %<cr>

If you run macvim in console mode (vim, not mvim) all :! commands are redirected to the shell and executed there. They take the whole window instead of 1/3 of it, and they use whatever theme your console happens to have.

But you get ansicolors.

Your question (and its pop up done by @avocade) addressed the issue I have with some printing in my aurum plugin thus I’ve wrote (started to write, but the most significant piece of functionality is already here) the ansi_esc_echo plugin. To use it in your one you must install it, install frawor and do

execute frawor#Setup('0.0', {'autoload/ansi_esc_echo': '0.0'})
call s:_r.ansi_esc.echo("\e[33mabc")

. Currently it deals only (speaking exclusively about special characters or sequences) with carriage return, backspace (untested), tab, newline, and CSI colors.

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