Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Enabling syntax highlight on a Linux pager.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Wed Nov 28, 2012 10:01 am    Post subject: Enabling syntax highlight on a Linux pager. Reply with quote

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.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.


Last edited by notageek on Wed Nov 28, 2012 2:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
ichbinsisyphos
Guru
Guru


Joined: 08 Dec 2006
Posts: 547

PostPosted: Wed Nov 28, 2012 12:34 pm    Post subject: Reply with quote

Good to know, but why use a "pager" anyway? No X?
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Wed Nov 28, 2012 1:40 pm    Post subject: Reply with quote

Because it's quicker to use a pager than anything within X.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
pigeon768
l33t
l33t


Joined: 02 Jan 2006
Posts: 669

PostPosted: Thu Nov 29, 2012 12:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 343
Location: NRW, Germany

PostPosted: Thu Nov 29, 2012 12:20 am    Post subject: Reply with quote

Code:
~ # emerge highlight
~ # cat /etc/env.d/71lesshighlight
LESSCOLOR="true"
LESSCOLORIZER="highlight --out-format=xterm256 --input"
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Thu Nov 29, 2012 7:49 am    Post subject: Reply with quote

Cool, those work!
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 343
Location: NRW, Germany

PostPosted: Thu Nov 29, 2012 11:45 am    Post subject: Reply with quote

Of course they do
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Thu Nov 29, 2012 11:52 am    Post subject: Reply with quote

I meant thank you.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
smartass
Apprentice
Apprentice


Joined: 04 Jul 2011
Posts: 189
Location: right behind you ... (you did turn around, didn't you?)

PostPosted: Fri Nov 30, 2012 5:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Fri Nov 30, 2012 5:26 pm    Post subject: Reply with quote

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.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum