less可以显示彩色字符吗?
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
less可以显示彩色字符吗?
我们知道vim可以显示彩色字符,ls也可以,那么less可以显示彩色字符吗?
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: less可以显示彩色字符吗?
irc <roylez> say: less -R
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
It seems not work....O_O_BOT 写了:irc <roylez> say: less -R
-
- 帖子: 50
- 注册时间: 2009-11-25 10:13
Re: less可以显示彩色字符吗?
-D [xn.n] . --color=xn.n
Set screen colors. (MS-DOS only)
查了下help,貌似不行
Set screen colors. (MS-DOS only)
查了下help,貌似不行
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
代码: 全选
-Dxcolor or --color=xcolor
[MS-DOS only] Sets the color of the text displayed. x is a single character which
selects the type of text whose color is being set: n=normal, s=standout, d=bold,
u=underlined, k=blink. color is a pair of numbers separated by a period. The
first number selects the foreground color and the second selects the background
color of the text. A single number N is the same as N.0.
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
hello,大家有知道如何让less也显示彩色字符的吗?
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- roylez
- 帖子: 1928
- 注册时间: 2005-10-04 10:59
- 来自: 上海
Re: less可以显示彩色字符吗?
这个慢的。eexpress 写了:● type less
less 已被别名为“/usr/share/vim/vim72/macros/less.sh”
✡ 弄个dropbox空间来备份文件或者做私人代码服务器?
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
- the_comer
- 帖子: 264
- 注册时间: 2009-07-08 17:33
Re: less可以显示彩色字符吗?
less好像没有。。。[MS-DOS only],man出来的。。。
-Dxcolor or --color=xcolor
[MS-DOS only] Sets the color of the text displayed
-Dxcolor or --color=xcolor
[MS-DOS only] Sets the color of the text displayed
- roylez
- 帖子: 1928
- 注册时间: 2005-10-04 10:59
- 来自: 上海
Re: less可以显示彩色字符吗?
代码: 全选
export LESS_TERMCAP_md=$'\E[1;31m' #bold1
export LESS_TERMCAP_mb=$'\E[1;31m'
export LESS_TERMCAP_me=$'\E[m'
export LESS_TERMCAP_so=$'\E[01;44;33m' #search highlight
export LESS_TERMCAP_se=$'\E[m'
export LESS_TERMCAP_us=$'\E[1;2;32m' #bold2
export LESS_TERMCAP_ue=$'\E[m'
export LESS="-M -i -R --shift 5"
export LESSCHARSET=utf-8
[ -x /usr/bin/src-hilite-lesspipe.sh ] && export LESSOPEN="| src-hilite-lesspipe.sh %s"

✡ 弄个dropbox空间来备份文件或者做私人代码服务器?
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
nice!乘神在的时候说话就是管事儿,还带行号的……eexpress 写了:● type less
less 已被别名为“/usr/share/vim/vim72/macros/less.sh”
感谢!
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
主席给的代码要放哪个文件里?麻烦说一声……
- roylez
- 帖子: 1928
- 注册时间: 2005-10-04 10:59
- 来自: 上海
Re: less可以显示彩色字符吗?
.bashrc
你需要装一个软件,arch里面叫source-highlight,ubuntu底下你自己查。
你需要装一个软件,arch里面叫source-highlight,ubuntu底下你自己查。
✡ 弄个dropbox空间来备份文件或者做私人代码服务器?
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
✡ 配置:[url]git://github.com/roylez/dotfiles.git[/url]
✡ 主页:http://roylez.heroku.com
✡ 各种稀奇玩意儿:http://dooloo.info
- den
- 帖子: 196
- 注册时间: 2007-06-15 21:19
- 来自: 上海
Re: less可以显示彩色字符吗?
less -R不会像vim一样进行代码高亮,而是可以解析ansi的颜色代码
如果你装了colordiff,可以感受一下less -R
diff xxx | colordiff | less -R
如果你装了colordiff,可以感受一下less -R
diff xxx | colordiff | less -R
/****************************************************
/* Work hard, play harder.
/****************************************************
/* Work hard, play harder.
/****************************************************
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: less可以显示彩色字符吗?
roylez 写了:代码: 全选
export LESS_TERMCAP_md=$'\E[1;31m' #bold1 export LESS_TERMCAP_mb=$'\E[1;31m' export LESS_TERMCAP_me=$'\E[m' export LESS_TERMCAP_so=$'\E[01;44;33m' #search highlight export LESS_TERMCAP_se=$'\E[m' export LESS_TERMCAP_us=$'\E[1;2;32m' #bold2 export LESS_TERMCAP_ue=$'\E[m' export LESS="-M -i -R --shift 5" export LESSCHARSET=utf-8 [ -x /usr/bin/src-hilite-lesspipe.sh ] && export LESSOPEN="| src-hilite-lesspipe.sh %s"
ubuntu下也叫source-highlight,装上了。我把上面那段代码放了进去,发现less没有显示语法高亮。然后看了一下/usr/bin目录下没有src-hilite-lesspipe.sh,只有source-highlight,于是我就替换了,发现还是不行,运行时提示:roylez 写了:.bashrc
你需要装一个软件,arch里面叫source-highlight,ubuntu底下你自己查。
代码: 全选
Processing cron.back ... source-highlight: could not find a language definition for input file cron.back
ps:一个小惊喜,man倒是彩色的了……
上次由 pityonline 在 2009-12-13 18:24,总共编辑 1 次。