0

I have set my ls color and less like

alias ls='ls --color'
LS_COLORS='no=00:fi=00:di=00;94:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
export LS_COLORS
alias less='less -R'`, and my `prompt` like `
export PS1="\n\[\e[31m\]\u\[\e[33m\]@\[\e[34;1m\]\h \[\e[36m\]\W \[\e[35m\]^\$ \[\e[0m\]"

.

Which I think is better to see on my monitor, but when I do something like ls > OUTPUTFILE or even cat SOMEFILEthen I use vi to see the output file, it has messed up like

^[[00mNC_000954.fna^[[00m
^[[00mNC_000955.fna^[[00m
^[[00mNC_000956.fna^[[00m
^[[00mNC_000957.fna^[[00m
^[[00mNC_000958.fna^[[00m
^[[00mNC_000959.fna^[[00m
^[[00mNC_000961.fna^[[00m

It should be like

NC_000117.fna
NC_000853.fna
NC_000854.fna
NC_000868.fna
NC_000907.fna
NC_000908.fna
NC_000909.fna 

without those special symbols.

What's wrong with that? I don't know which color setting has changed this. BTW, I've set my vimrc color as colorscheme delek

4

1 に答える 1

1

My 2 cent worth :

Well, the colour setting is handled with escape sequences in the terminal window. If you pipe stdout to a file, and have requested colours, you should get those escape sequences in there.

It seem as though vim does not appreciate those escape sequences in your present configuration. By default it makes them visible.

ls: note that ls --color=auto it will not send to file only when stdout is terminal. maybe you have --color=always on. Make sure you have auto and the escapes goes away.

If that is your intent - to actually get ls colours in vim, then check this link for more discussion. You may coax vim to actually treat them as escapes and filter them away - or colourize.

于 2012-09-20T17:31:46.727 に答える