bash - How to display Rails development.log nicely to vim/sublime? -
development.log can read if loaded tail
or cat
. if loaded vim
or sublime
content has additional escape characters make difficult read. e.g.:
[1m[35m (0.2ms)[0m begin [1m[36m (776.2ms)[0m [1mcreate table "accounts" ("id" serial primary key, "user_id" integer, "type" character varying(255), "token" character varying(255), "expired_at" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
i guess additional characters used set colours in bash. how display nicely in vim
or sublime
?
yes, these ansi escape sequences used switch color , font attributes in terminal. low-level tools cat
directly output terminal, these print fine there. vim text editor, , shows own rendering of text, including such special characters (the <esc>
shows ^[
, example).
if want view such log output in vim, best capture without color information. commands support --no-color
command-line argument; or try unsetting term
or term=dumb
before launching command.
alternatively, ansiesc.vim plugin can convert escape sequences vim syntax highlighting.
Comments
Post a Comment