| View previous topic :: View next topic |
| Author |
Message |
notageek Tux's lil' helper


Joined: 05 Jun 2008 Posts: 78 Location: Bangalore, India
|
Posted: Wed Nov 28, 2012 10:01 am Post subject: Enabling syntax highlight on a Linux pager. |
|
|
Alright, have you ever wished syntax highlighting on a Linux pager and not forced to use an editor, just so that you can see colors in your code?
I have. There is a package available in another distro called 'source-highlight' which lets you do that along with
| Code: | export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R ' |
But I'm sure Gentoo does this trivially. If you know of some tips, do post. _________________ What looks like a cat, flies like a bat, brays like a donkey, and plays like a monkey?
Last edited by notageek on Wed Nov 28, 2012 2:12 pm; edited 1 time in total |
|
| Back to top |
|
 |
ichbinsisyphos Guru


Joined: 08 Dec 2006 Posts: 547
|
Posted: Wed Nov 28, 2012 12:34 pm Post subject: |
|
|
| Good to know, but why use a "pager" anyway? No X? |
|
| Back to top |
|
 |
notageek Tux's lil' helper


Joined: 05 Jun 2008 Posts: 78 Location: Bangalore, India
|
Posted: Wed Nov 28, 2012 1:40 pm Post subject: |
|
|
Because it's quicker to use a pager than anything within X. _________________ What looks like a cat, flies like a bat, brays like a donkey, and plays like a monkey? |
|
| Back to top |
|
 |
pigeon768 l33t

Joined: 02 Jan 2006 Posts: 667
|
Posted: Thu Nov 29, 2012 12:20 am Post subject: |
|
|
You might try using dev-util/source-highlight, which is in portage, and its src-hilite-lesspipe.sh script. _________________ My political bias. |
|
| Back to top |
|
 |
Dr.Willy Apprentice

Joined: 15 Jul 2007 Posts: 288 Location: NRW, Germany
|
Posted: Thu Nov 29, 2012 12:20 am Post subject: |
|
|
| Code: | ~ # emerge highlight
~ # cat /etc/env.d/71lesshighlight
LESSCOLOR="true"
LESSCOLORIZER="highlight --out-format=xterm256 --input" |
|
|
| Back to top |
|
 |
notageek Tux's lil' helper


Joined: 05 Jun 2008 Posts: 78 Location: Bangalore, India
|
Posted: Thu Nov 29, 2012 7:49 am Post subject: |
|
|
Cool, those work! _________________ What looks like a cat, flies like a bat, brays like a donkey, and plays like a monkey? |
|
| Back to top |
|
 |
Dr.Willy Apprentice

Joined: 15 Jul 2007 Posts: 288 Location: NRW, Germany
|
Posted: Thu Nov 29, 2012 11:45 am Post subject: |
|
|
| Of course they do |
|
| Back to top |
|
 |
notageek Tux's lil' helper


Joined: 05 Jun 2008 Posts: 78 Location: Bangalore, India
|
Posted: Thu Nov 29, 2012 11:52 am Post subject: |
|
|
I meant thank you. _________________ What looks like a cat, flies like a bat, brays like a donkey, and plays like a monkey? |
|
| Back to top |
|
 |
smartass Tux's lil' helper

Joined: 04 Jul 2011 Posts: 142 Location: right behind you ... (you did turn around, didn't you?)
|
Posted: Fri Nov 30, 2012 5:15 pm Post subject: |
|
|
| Code: | | USE="vim-pager" emerge vim |
- syntax highlighting for nearly anything
- includes any vim quirks you use
- editable (if you :set modifiable)
|
|
| Back to top |
|
 |
notageek Tux's lil' helper


Joined: 05 Jun 2008 Posts: 78 Location: Bangalore, India
|
Posted: Fri Nov 30, 2012 5:26 pm Post subject: |
|
|
Okay, the reason I was looking to enable this on "less" is I wanted to avoid using vim or any of its derivatives. Although I used vim to code. _________________ What looks like a cat, flies like a bat, brays like a donkey, and plays like a monkey? |
|
| Back to top |
|
 |
|