Make Less highlight search patterns instead of italicizing them
To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch where the found pattern has a different background.
I attempted to run man -P vim systemd but that quit with error status 1, so it looks like I'm stuck with less.
There was nothing that I was able to find in man less that helped (instead I found out that option -G will turn off highlighting all together which is even worse than italics).
That being said does anyone know how to achieve search highlighting (change background color) in man pages?
FYI I run Ubuntu 14.10
I came across this question seems to ask about the same thing but I am not sure if I follow how does this work (LESS_TERMCAP_so). The less man page does not mention this. (I get strange results with this solution)
man less escape-characters
add a comment |
To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch where the found pattern has a different background.
I attempted to run man -P vim systemd but that quit with error status 1, so it looks like I'm stuck with less.
There was nothing that I was able to find in man less that helped (instead I found out that option -G will turn off highlighting all together which is even worse than italics).
That being said does anyone know how to achieve search highlighting (change background color) in man pages?
FYI I run Ubuntu 14.10
I came across this question seems to ask about the same thing but I am not sure if I follow how does this work (LESS_TERMCAP_so). The less man page does not mention this. (I get strange results with this solution)
man less escape-characters
It means you place that line in your~/.bashrcfile.export LESS_TERMCAP_so=$'E[30;43m'See this answer as well unix.stackexchange.com/questions/38634/…
– iyrin
Jan 15 '15 at 2:52
1
Sometime I useman man | vim -to take advantage of my vim configuration, keys and functions
– JJoao
Jan 15 '15 at 8:45
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. AboveLESS_TERMCAP_sovariable causes the whole file to turn into orange background...
– user1338062
May 23 '15 at 7:14
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42
add a comment |
To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch where the found pattern has a different background.
I attempted to run man -P vim systemd but that quit with error status 1, so it looks like I'm stuck with less.
There was nothing that I was able to find in man less that helped (instead I found out that option -G will turn off highlighting all together which is even worse than italics).
That being said does anyone know how to achieve search highlighting (change background color) in man pages?
FYI I run Ubuntu 14.10
I came across this question seems to ask about the same thing but I am not sure if I follow how does this work (LESS_TERMCAP_so). The less man page does not mention this. (I get strange results with this solution)
man less escape-characters
To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch where the found pattern has a different background.
I attempted to run man -P vim systemd but that quit with error status 1, so it looks like I'm stuck with less.
There was nothing that I was able to find in man less that helped (instead I found out that option -G will turn off highlighting all together which is even worse than italics).
That being said does anyone know how to achieve search highlighting (change background color) in man pages?
FYI I run Ubuntu 14.10
I came across this question seems to ask about the same thing but I am not sure if I follow how does this work (LESS_TERMCAP_so). The less man page does not mention this. (I get strange results with this solution)
man less escape-characters
man less escape-characters
edited Apr 13 '17 at 12:36
Community♦
1
1
asked Jan 15 '15 at 2:06
sgp667sgp667
21825
21825
It means you place that line in your~/.bashrcfile.export LESS_TERMCAP_so=$'E[30;43m'See this answer as well unix.stackexchange.com/questions/38634/…
– iyrin
Jan 15 '15 at 2:52
1
Sometime I useman man | vim -to take advantage of my vim configuration, keys and functions
– JJoao
Jan 15 '15 at 8:45
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. AboveLESS_TERMCAP_sovariable causes the whole file to turn into orange background...
– user1338062
May 23 '15 at 7:14
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42
add a comment |
It means you place that line in your~/.bashrcfile.export LESS_TERMCAP_so=$'E[30;43m'See this answer as well unix.stackexchange.com/questions/38634/…
– iyrin
Jan 15 '15 at 2:52
1
Sometime I useman man | vim -to take advantage of my vim configuration, keys and functions
– JJoao
Jan 15 '15 at 8:45
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. AboveLESS_TERMCAP_sovariable causes the whole file to turn into orange background...
– user1338062
May 23 '15 at 7:14
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42
It means you place that line in your
~/.bashrc file. export LESS_TERMCAP_so=$'E[30;43m' See this answer as well unix.stackexchange.com/questions/38634/…– iyrin
Jan 15 '15 at 2:52
It means you place that line in your
~/.bashrc file. export LESS_TERMCAP_so=$'E[30;43m' See this answer as well unix.stackexchange.com/questions/38634/…– iyrin
Jan 15 '15 at 2:52
1
1
Sometime I use
man man | vim - to take advantage of my vim configuration, keys and functions– JJoao
Jan 15 '15 at 8:45
Sometime I use
man man | vim - to take advantage of my vim configuration, keys and functions– JJoao
Jan 15 '15 at 8:45
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. Above
LESS_TERMCAP_so variable causes the whole file to turn into orange background...– user1338062
May 23 '15 at 7:14
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. Above
LESS_TERMCAP_so variable causes the whole file to turn into orange background...– user1338062
May 23 '15 at 7:14
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42
add a comment |
4 Answers
4
active
oldest
votes
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now haveset -g default-terminal "xterm-256color"in my ~/.tmux.conf on my CentOS 7 box (and others).
– sshow
Feb 21 at 14:43
add a comment |
The mention of LESS_TERMCAP_so was incomplete. That is less's special environment variable used to override the termcap so (standout) capability. To use this capability, you have to provide a se (standend) capability as well.
The terminfo(5) manual page gives a summary of these features for terminfo (smso/rmso) and termcap (so/se) names:
enter_standout_mode smso so begin standout mode
exit_standout_mode rmso se exit standout mode
Its section on highlighting explains:
If your terminal has one or more kinds of display
attributes, these can be represented in a number of different ways. You should choose one display form as standout mode, representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other
attention getters. (If you have a choice, reverse video
plus half-bright is good, or reverse video alone.) The
sequences to enter and exit standout mode are given as
smsoandrmso, respectively.
If you want to use color for standout, you have to provide a corresponding LESS_TERMCAP_se which resets color. This is relatively simple to do as long as you do not expect to use colors in the manual page for other reasons (such as using groff's SGR color feature).
Assuming the value suggested in a comment:
export LESS_TERMCAP_so=$'E[30;43m'
then you could reset that for most terminals using
export LESS_TERMCAP_se=$'E[39;49m'
By the way, the reason for the italics is that the terminal description for GNU screen uses the standard escape sequence for italics as its own standout/standend capabilities. Some of that is discussed in the terminal database entry.
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | lessfunctions as a workaround too
– Marlun
May 17 '17 at 19:31
add a comment |
Hit ESCu to turn off search highlighting in less after a search; a new search will turn it on again, so to permanently turn search highlighting off for a session hit -G.
Alternately put LESS='-G' in your environment, or run man like so:
LESS='-G' man less
Ironically this is all documented in the less manpage...
You can also put the following in the environment, e.g. in your .bash_profile:
export MANPAGER='less -G'
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
add a comment |
For tmux I set TERM to tmux-256color.
Amongst other nice things,
this has the "usual" reverse highlighting in less.
Works well when using something modern like fedora, or cygwin.
$ cat ~/.tmux.conf
⋮
set-option -g default-terminal tmux-256color
The ncurses packages on Centos however do not have the two tmux definitions (tmux and tmux-256color).
I imported them quite easily from fedora.
Slight wrinkle is that Centos' ncurses is too old to understand fedora's terminfo files directly.
On fedora:
$ infocmp tmux256-color >temp.txt
On Centos:
$ scp fedora-machine:temp.txt .
$ tic temp.txt
Then inside tmux:
$ TERM=tmux-256-color man tmux
Result!
FYI the tic command puts the compiled terminal description into your personal terminfo database,
i.e.,
~/.terminfo/t/tmux-256color (in this case).
Feel free to move this to the global database if that's what you want:
$ sudo mv ~/.terminfo/t/tmux-256color /usr/share/terminfo/t/
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f179173%2fmake-less-highlight-search-patterns-instead-of-italicizing-them%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now haveset -g default-terminal "xterm-256color"in my ~/.tmux.conf on my CentOS 7 box (and others).
– sshow
Feb 21 at 14:43
add a comment |
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now haveset -g default-terminal "xterm-256color"in my ~/.tmux.conf on my CentOS 7 box (and others).
– sshow
Feb 21 at 14:43
add a comment |
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.
edited Mar 20 '17 at 10:04
Community♦
1
1
answered Dec 29 '15 at 15:53
purgpurg
16614
16614
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now haveset -g default-terminal "xterm-256color"in my ~/.tmux.conf on my CentOS 7 box (and others).
– sshow
Feb 21 at 14:43
add a comment |
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now haveset -g default-terminal "xterm-256color"in my ~/.tmux.conf on my CentOS 7 box (and others).
– sshow
Feb 21 at 14:43
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
I already managed to forget about this question but this is exciting news. As soon as I get my hand on the computer I will test this out!
– sgp667
Dec 29 '15 at 15:56
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
this is an impractical solution, because other applications depend on TERM being set to screen* when within tmux, such as WeeChat. When not set to screen* in tmux, WeeChat has weird rendering issues.
– Blaine Lafreniere
Aug 26 '16 at 11:05
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
I've noted that I had the problem with tmux <2.0 and don't have the problem since tmux v2.
– artfulrobot
Jan 13 '17 at 11:23
Great finding. I now have
set -g default-terminal "xterm-256color" in my ~/.tmux.conf on my CentOS 7 box (and others).– sshow
Feb 21 at 14:43
Great finding. I now have
set -g default-terminal "xterm-256color" in my ~/.tmux.conf on my CentOS 7 box (and others).– sshow
Feb 21 at 14:43
add a comment |
The mention of LESS_TERMCAP_so was incomplete. That is less's special environment variable used to override the termcap so (standout) capability. To use this capability, you have to provide a se (standend) capability as well.
The terminfo(5) manual page gives a summary of these features for terminfo (smso/rmso) and termcap (so/se) names:
enter_standout_mode smso so begin standout mode
exit_standout_mode rmso se exit standout mode
Its section on highlighting explains:
If your terminal has one or more kinds of display
attributes, these can be represented in a number of different ways. You should choose one display form as standout mode, representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other
attention getters. (If you have a choice, reverse video
plus half-bright is good, or reverse video alone.) The
sequences to enter and exit standout mode are given as
smsoandrmso, respectively.
If you want to use color for standout, you have to provide a corresponding LESS_TERMCAP_se which resets color. This is relatively simple to do as long as you do not expect to use colors in the manual page for other reasons (such as using groff's SGR color feature).
Assuming the value suggested in a comment:
export LESS_TERMCAP_so=$'E[30;43m'
then you could reset that for most terminals using
export LESS_TERMCAP_se=$'E[39;49m'
By the way, the reason for the italics is that the terminal description for GNU screen uses the standard escape sequence for italics as its own standout/standend capabilities. Some of that is discussed in the terminal database entry.
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | lessfunctions as a workaround too
– Marlun
May 17 '17 at 19:31
add a comment |
The mention of LESS_TERMCAP_so was incomplete. That is less's special environment variable used to override the termcap so (standout) capability. To use this capability, you have to provide a se (standend) capability as well.
The terminfo(5) manual page gives a summary of these features for terminfo (smso/rmso) and termcap (so/se) names:
enter_standout_mode smso so begin standout mode
exit_standout_mode rmso se exit standout mode
Its section on highlighting explains:
If your terminal has one or more kinds of display
attributes, these can be represented in a number of different ways. You should choose one display form as standout mode, representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other
attention getters. (If you have a choice, reverse video
plus half-bright is good, or reverse video alone.) The
sequences to enter and exit standout mode are given as
smsoandrmso, respectively.
If you want to use color for standout, you have to provide a corresponding LESS_TERMCAP_se which resets color. This is relatively simple to do as long as you do not expect to use colors in the manual page for other reasons (such as using groff's SGR color feature).
Assuming the value suggested in a comment:
export LESS_TERMCAP_so=$'E[30;43m'
then you could reset that for most terminals using
export LESS_TERMCAP_se=$'E[39;49m'
By the way, the reason for the italics is that the terminal description for GNU screen uses the standard escape sequence for italics as its own standout/standend capabilities. Some of that is discussed in the terminal database entry.
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | lessfunctions as a workaround too
– Marlun
May 17 '17 at 19:31
add a comment |
The mention of LESS_TERMCAP_so was incomplete. That is less's special environment variable used to override the termcap so (standout) capability. To use this capability, you have to provide a se (standend) capability as well.
The terminfo(5) manual page gives a summary of these features for terminfo (smso/rmso) and termcap (so/se) names:
enter_standout_mode smso so begin standout mode
exit_standout_mode rmso se exit standout mode
Its section on highlighting explains:
If your terminal has one or more kinds of display
attributes, these can be represented in a number of different ways. You should choose one display form as standout mode, representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other
attention getters. (If you have a choice, reverse video
plus half-bright is good, or reverse video alone.) The
sequences to enter and exit standout mode are given as
smsoandrmso, respectively.
If you want to use color for standout, you have to provide a corresponding LESS_TERMCAP_se which resets color. This is relatively simple to do as long as you do not expect to use colors in the manual page for other reasons (such as using groff's SGR color feature).
Assuming the value suggested in a comment:
export LESS_TERMCAP_so=$'E[30;43m'
then you could reset that for most terminals using
export LESS_TERMCAP_se=$'E[39;49m'
By the way, the reason for the italics is that the terminal description for GNU screen uses the standard escape sequence for italics as its own standout/standend capabilities. Some of that is discussed in the terminal database entry.
The mention of LESS_TERMCAP_so was incomplete. That is less's special environment variable used to override the termcap so (standout) capability. To use this capability, you have to provide a se (standend) capability as well.
The terminfo(5) manual page gives a summary of these features for terminfo (smso/rmso) and termcap (so/se) names:
enter_standout_mode smso so begin standout mode
exit_standout_mode rmso se exit standout mode
Its section on highlighting explains:
If your terminal has one or more kinds of display
attributes, these can be represented in a number of different ways. You should choose one display form as standout mode, representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other
attention getters. (If you have a choice, reverse video
plus half-bright is good, or reverse video alone.) The
sequences to enter and exit standout mode are given as
smsoandrmso, respectively.
If you want to use color for standout, you have to provide a corresponding LESS_TERMCAP_se which resets color. This is relatively simple to do as long as you do not expect to use colors in the manual page for other reasons (such as using groff's SGR color feature).
Assuming the value suggested in a comment:
export LESS_TERMCAP_so=$'E[30;43m'
then you could reset that for most terminals using
export LESS_TERMCAP_se=$'E[39;49m'
By the way, the reason for the italics is that the terminal description for GNU screen uses the standard escape sequence for italics as its own standout/standend capabilities. Some of that is discussed in the terminal database entry.
edited Jan 18 '18 at 9:15
answered Jul 23 '16 at 1:05
Thomas DickeyThomas Dickey
54k5105178
54k5105178
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | lessfunctions as a workaround too
– Marlun
May 17 '17 at 19:31
add a comment |
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | lessfunctions as a workaround too
– Marlun
May 17 '17 at 19:31
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
This was the first solution that actually worked for me (in tmux on a Mac). I just add both of the above export line into my bash config file.
– Marlun
May 10 '17 at 4:23
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
However if I write "export" to view all my environment variables everything after these lines becomes highlighted and the terminal keeps being highlighted so I have to close it down and start a new one.
– Marlun
May 16 '17 at 8:03
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
In cases like that, I put the variables into a script which calls the program that needs the particular variables. The altered variables only apply within the script.
– Thomas Dickey
May 16 '17 at 8:55
export | less functions as a workaround too– Marlun
May 17 '17 at 19:31
export | less functions as a workaround too– Marlun
May 17 '17 at 19:31
add a comment |
Hit ESCu to turn off search highlighting in less after a search; a new search will turn it on again, so to permanently turn search highlighting off for a session hit -G.
Alternately put LESS='-G' in your environment, or run man like so:
LESS='-G' man less
Ironically this is all documented in the less manpage...
You can also put the following in the environment, e.g. in your .bash_profile:
export MANPAGER='less -G'
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
add a comment |
Hit ESCu to turn off search highlighting in less after a search; a new search will turn it on again, so to permanently turn search highlighting off for a session hit -G.
Alternately put LESS='-G' in your environment, or run man like so:
LESS='-G' man less
Ironically this is all documented in the less manpage...
You can also put the following in the environment, e.g. in your .bash_profile:
export MANPAGER='less -G'
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
add a comment |
Hit ESCu to turn off search highlighting in less after a search; a new search will turn it on again, so to permanently turn search highlighting off for a session hit -G.
Alternately put LESS='-G' in your environment, or run man like so:
LESS='-G' man less
Ironically this is all documented in the less manpage...
You can also put the following in the environment, e.g. in your .bash_profile:
export MANPAGER='less -G'
Hit ESCu to turn off search highlighting in less after a search; a new search will turn it on again, so to permanently turn search highlighting off for a session hit -G.
Alternately put LESS='-G' in your environment, or run man like so:
LESS='-G' man less
Ironically this is all documented in the less manpage...
You can also put the following in the environment, e.g. in your .bash_profile:
export MANPAGER='less -G'
answered Jan 15 '15 at 8:10
wurtelwurtel
11k11628
11k11628
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
add a comment |
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
as I explained in my question I don't want to turn it of completly, I want to change how it appears on my screen. My question might have been misleading bacuse someone edited it for me.
– sgp667
Jan 21 '15 at 15:57
add a comment |
For tmux I set TERM to tmux-256color.
Amongst other nice things,
this has the "usual" reverse highlighting in less.
Works well when using something modern like fedora, or cygwin.
$ cat ~/.tmux.conf
⋮
set-option -g default-terminal tmux-256color
The ncurses packages on Centos however do not have the two tmux definitions (tmux and tmux-256color).
I imported them quite easily from fedora.
Slight wrinkle is that Centos' ncurses is too old to understand fedora's terminfo files directly.
On fedora:
$ infocmp tmux256-color >temp.txt
On Centos:
$ scp fedora-machine:temp.txt .
$ tic temp.txt
Then inside tmux:
$ TERM=tmux-256-color man tmux
Result!
FYI the tic command puts the compiled terminal description into your personal terminfo database,
i.e.,
~/.terminfo/t/tmux-256color (in this case).
Feel free to move this to the global database if that's what you want:
$ sudo mv ~/.terminfo/t/tmux-256color /usr/share/terminfo/t/
add a comment |
For tmux I set TERM to tmux-256color.
Amongst other nice things,
this has the "usual" reverse highlighting in less.
Works well when using something modern like fedora, or cygwin.
$ cat ~/.tmux.conf
⋮
set-option -g default-terminal tmux-256color
The ncurses packages on Centos however do not have the two tmux definitions (tmux and tmux-256color).
I imported them quite easily from fedora.
Slight wrinkle is that Centos' ncurses is too old to understand fedora's terminfo files directly.
On fedora:
$ infocmp tmux256-color >temp.txt
On Centos:
$ scp fedora-machine:temp.txt .
$ tic temp.txt
Then inside tmux:
$ TERM=tmux-256-color man tmux
Result!
FYI the tic command puts the compiled terminal description into your personal terminfo database,
i.e.,
~/.terminfo/t/tmux-256color (in this case).
Feel free to move this to the global database if that's what you want:
$ sudo mv ~/.terminfo/t/tmux-256color /usr/share/terminfo/t/
add a comment |
For tmux I set TERM to tmux-256color.
Amongst other nice things,
this has the "usual" reverse highlighting in less.
Works well when using something modern like fedora, or cygwin.
$ cat ~/.tmux.conf
⋮
set-option -g default-terminal tmux-256color
The ncurses packages on Centos however do not have the two tmux definitions (tmux and tmux-256color).
I imported them quite easily from fedora.
Slight wrinkle is that Centos' ncurses is too old to understand fedora's terminfo files directly.
On fedora:
$ infocmp tmux256-color >temp.txt
On Centos:
$ scp fedora-machine:temp.txt .
$ tic temp.txt
Then inside tmux:
$ TERM=tmux-256-color man tmux
Result!
FYI the tic command puts the compiled terminal description into your personal terminfo database,
i.e.,
~/.terminfo/t/tmux-256color (in this case).
Feel free to move this to the global database if that's what you want:
$ sudo mv ~/.terminfo/t/tmux-256color /usr/share/terminfo/t/
For tmux I set TERM to tmux-256color.
Amongst other nice things,
this has the "usual" reverse highlighting in less.
Works well when using something modern like fedora, or cygwin.
$ cat ~/.tmux.conf
⋮
set-option -g default-terminal tmux-256color
The ncurses packages on Centos however do not have the two tmux definitions (tmux and tmux-256color).
I imported them quite easily from fedora.
Slight wrinkle is that Centos' ncurses is too old to understand fedora's terminfo files directly.
On fedora:
$ infocmp tmux256-color >temp.txt
On Centos:
$ scp fedora-machine:temp.txt .
$ tic temp.txt
Then inside tmux:
$ TERM=tmux-256-color man tmux
Result!
FYI the tic command puts the compiled terminal description into your personal terminfo database,
i.e.,
~/.terminfo/t/tmux-256color (in this case).
Feel free to move this to the global database if that's what you want:
$ sudo mv ~/.terminfo/t/tmux-256color /usr/share/terminfo/t/
answered Mar 1 at 12:32
bobbogobobbogo
1052
1052
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f179173%2fmake-less-highlight-search-patterns-instead-of-italicizing-them%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It means you place that line in your
~/.bashrcfile.export LESS_TERMCAP_so=$'E[30;43m'See this answer as well unix.stackexchange.com/questions/38634/…– iyrin
Jan 15 '15 at 2:52
1
Sometime I use
man man | vim -to take advantage of my vim configuration, keys and functions– JJoao
Jan 15 '15 at 8:45
Did you figure out a solution to this? I have the exact same problem on one machine, and I can't figure out what's the difference. Above
LESS_TERMCAP_sovariable causes the whole file to turn into orange background...– user1338062
May 23 '15 at 7:14
I'm afraid I am still struggling with this
– sgp667
May 23 '15 at 17:42