Closed BarbzYHOOL closed 1 week ago
Hello!
Please run the following commands and add their output to this issue:
env | grep '^LESS' | sort
echo $MOAR
moar --version
Also, please post a screenshot of what moar
looks like for you.
LESS=-FXMigR
-wrap -colors 16M
v1.18.4
In the last screenshot I looked for "palette"
To verify that you actually did run env | grep '^LESS' | sort
, could you post both the command line (env | grep '^LESS' | sort
), its output and the prompt following it?
It looks like you have some LESS_xxx
coloring variables set, and I want to verify that's the cause.
For example, here's what I get:
~/d/g/s/g/b/moar (master|✔) $ env | grep '^LESS' | sort
~/d/g/s/g/b/moar (master|✔) $
env | grep '^LESS' | sort 00:18:32
LESS=-FXMigR
I'm not sure how LESS is related to MOAR tho
For compatibility reasons, moar
uses the formats declared in these environment variables if present:
LESS_TERMCAP_md
: Man page boldLESS_TERMCAP_us
: Man page underlineLESS_TERMCAP_so
: Status bar and search hitsBut you do not have any of these set?
no, i checked with "echo $LESS_TERMCAP_md" etc
If you run this, do you still get the same problem?
man moar | LESS_TERMCAP_md= LESS_TERMCAP_us= LESS_TERMCAP_so= moar
If this doesn't help I think the next step would be to improve moar --help
output to explain where moar
is getting its colors from.
Yes, it changes the result by highlighting the search result (the rest is not good looking) So hmmm to have good looking man pages, what do I do?
I'd suggest you play around with LESS_TERMCAP_md
, LESS_TERMCAP_us
and LESS_TERMCAP_so
and set colors that you like.
Also try the --style
parameter, unsure how that affects man pages but you should try!
See #14 and #114 for what the LESS_TERMCAP_xx
variables affect, and https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters for inspiration.
Try https://chat.openai.com/ and see if it can guide you for how to set this up nicely for your shell!
I thought about this some more and I think two things should be improved in moar
.
--style
optionmoar --help
output should include any LESS_TERMCAP_xxx
settings affecting moar
's outputI don't understand the "--style" thing, without it asks for argument, and then I dunno what argument to type, I tried "style" or "api" nothing works
And to be fair, it doesn't work
echo $LESS_TERMCAP_so
\E[38;5;204m
I set it using fish shell with "set" but it does not change anything in the man page.
Also using "moar /etc/aliases" I can see the white highlight on search........ i don't get it
I even used these
set LESS_TERMCAP_mb '\E[01;31m'
set LESS_TERMCAP_md '\E[01;31m'
set LESS_TERMCAP_me '\E[0m'
set LESS_TERMCAP_se '\E[0m'
set LESS_TERMCAP_so '\E[01;44;37m'
set LESS_TERMCAP_ue '\E[0m'
set LESS_TERMCAP_us '\E[01;33m'
nothing changes anywhere
From moar --help
:
-style value
Highlighting style from https://xyproto.github.io/splash/docs/longer/all.html
Does this help? You should pass moar
a style listed on that page.
I set it using fish shell with "set" but it does not change anything in the man page.
Fish variables are not exported by default. For moar
and other programs to know about these, you'd need to use set -x
to make them exported. If you don't want to type it each time you can add it to your ~/.config/fish/config.fish
, or use set -Ux
. If you type help set
in your fish shell you'll have the docs for this command open up.
On a related note, the latest release...
https://github.com/walles/moar/releases/tag/v1.22.2
... will syntax highlight man page headings as GenericHeading
, making man pages look a bit nicer even without any configuration.
On a related note, the latest release...
https://github.com/walles/moar/releases/tag/v1.22.2
... will syntax highlight man page headings as GenericHeading
, making man pages look a bit nicer even without any configuration.
Here's what man moar
looks like for me without any LESS...
variables set and no --style
option. This is with moar
v1.22.2
.
how is that good looking? it's just white, i see no difference except it's white lol
I told you I tried the "--style x" and it did nothing, I retried "--style witchhazel" and it did nothing
set -x changes nothing at all, I knew it but i tried just in case, cannot say I haven't tried everything here...
set -e LESS_TERMCAP_mb
set -e LESS_TERMCAP_md
set -e LESS_TERMCAP_me
set -e LESS_TERMCAP_se
set -e LESS_TERMCAP_so
set -e LESS_TERMCAP_ue
set -e LESS_TERMCAP_us
set -x LESS_TERMCAP_mb '\E[01;31m'
set -x LESS_TERMCAP_md '\E[01;31m'
set -x LESS_TERMCAP_me '\E[0m'
set -x LESS_TERMCAP_se '\E[0m'
set -x LESS_TERMCAP_so '\E[01;44;37m'
set -x LESS_TERMCAP_ue '\E[0m'
set -x LESS_TERMCAP_us '\E[01;33m'
tell me if i'm wrong
You must change the environment in the same terminal tab where you're running moar
.
If you are changing the variables in one tab and running moar
in the another that would explain a lot of the problems you're seeing here.
Also, '\E[01;31m'
won't fly, if you're on fish
you have to do \x1b'[01;31m'
.
I never ran it in another tab lol, I set env variables for 10 years without issues
\x1b'[01;31m'
no idea what all that stuff is, I've tried tons of different color codes from different pages, spent 1 hour testing all of them
I replaced by that thing and it still does nothing at all
set -x LESS_TERMCAP_mb \x1b'[01;31m'
set -x LESS_TERMCAP_md \x1b'[01;31m'
set -x MANROFFOPT '-c'
should do the trick. But LESS_TERMCAP_so
should work for the statusline even without it.
@walles I think $MANROFFOPT
could be included in debug output the same way as $LESS_TERMCAP_*
variables? From what I understand it's an obscure setting with very few mentions on the internet, and not all distros put it in /etc/profile
or not all man
implementations set -c
as default, e.g. on Nix it seems it's not the case. But at the same time it influences behavior of moar
the same way as $LESS_TERMCAP_*
. It could be quite confusing. To quote man man
on it:
MANROFFOPT Every time man invokes the formatter (nroff, troff, or groff), it adds the contents of $MANROFFOPT to the formatter's command line.
To be extra clear, this would be an issue with less
too. On my system, if I unset this variable neither moar
nor less
will display colors of the man pages (i.e. none but the status bar), even if less variables are correctly set.
v1.23.1 fixes one problem in moar
related to LESS_TERMCAP_xx
handling.
Reopening this ticket since the discussion is still ongoing.
set -x MANROFFOPT '-c'
changes nothing again
I updated moar and now the color changed a little as you pointed in your screenshot @walles it is now whiter than greyer ^^but that's all
Try this (assuming you're using fish
as your shell):
LESS_TERMCAP_md=\x1b'[01;31m' man moar
moar
Here's what this looks like to me:
Same thing again
Or gimme the commands for bash and i'll try in bash.
Just in case, i TRIED THe same command in bash and here is the result, it's different and there is a background color (probably default) when searching...
Try this: LESS_TERMCAP_md=\x1b'[01;31m' moar --help
.
In the most recent versions of moar
this should tell you what moar
thinks of the LESS_TERMCAP_xx
environment variables. Please send me the complete output of that command.
Usage
moar [options] <file>
... | moar
moar < file
Shows file contents. Compressed files will be transparently decompressed.
Input is expected to be (possibly compressed) UTF-8 encoded text. Invalid /
non-printable characters are by default rendered as '?'.
More information + source code:
<https://github.com/walles/moar#readme>
Environment
Additional options are read from the MOAR environment variable.
Current setting: MOAR="-wrap -colors 16M"
LESS_TERMCAP_md (man page bold style): ESC[01;31m
Making moar Your Default Pager
Put the following line in your ~/.bashrc, ~/.bash_profile or ~/.zshrc
and moar will be used as the default pager in all new terminal windows:
export PAGER=moar
Options
-colors value
Highlighting palette size: 8, 16, 256, 16M, auto
-debug
Print debug logs after exiting
-follow
Follow piped input just like "tail -f"
-lang value
File contents, used for highlighting. Mime type or file extension ("html"). Default is to guess by filename.
-mousemode mode
Mouse mode: auto, select or scroll: https://github.com/walles/moar/blob/master/MOUSE.md
-no-clear-on-exit
Retain screen contents when exiting moar
-no-linenumbers
Hide line numbers on startup, press left arrow key to show
-no-statusbar
Hide the status bar, toggle with '='
-quit-if-one-screen
Don't page if contents fits on one screen
-render-unprintable value
How unprintable characters are rendered: highlight or whitespace
-scroll-left-hint value
Shown when view can scroll left. One character with optional ANSI highlighting.
-scroll-right-hint value
Shown when view can scroll right. One character with optional ANSI highlighting.
-shift amount
Horizontal scroll amount >=1, defaults to 16
-statusbar style
Status bar style: inverse, plain or bold
-style style
Highlighting style from https://xyproto.github.io/splash/docs/longer/all.html
-trace
Print trace logs after exiting
-version
Prints the moar version number
-wrap
Wrap long lines
+1234
Immediately scroll to line 1234
Does this give you the color you ask for (still fish
)?
PAGER=moar LESS_TERMCAP_md=\x1b'[01;31m' man moar
The help text indicates moar
is not your current pager, or at least this version of moar
isn't. Otherwise it wouldn't show the "Making moar Your Default Pager" section.
You might be using some other installation of moar
as your PAGER
.
Also, please do moar --version
so I know where we are.
At least on some systems MANPAGER
has precedence over PAGER
, so MANPAGER=less PAGER=moar man moar
will open less
. I'd recommend running man moar | moar
instead. Or like this for more assurance (assuming fish):
> set -e MANROFFOPT MANPAGER PAGER LESS_TERMCAP_mb LESS_TERMCAP_md LESS_TERMCAP_me LESS_TERMCAP_se LESS_TERMCAP_so LESS_TERMCAP_ue LESS_TERMCAP_us LESS LESSKEYIN_SYSTEM LESS LESSOPEN MOAR
> MANROFFOPT='-c' man moar | LESS_TERMCAP_md=\e'[01;31m' moar
> MANROFFOPT='-c' man moar | LESS_TERMCAP_md=\e'[01;31m' less
Does this give you the color you ask for (still
fish
)?PAGER=moar LESS_TERMCAP_md=\x1b'[01;31m' man moar
The help text indicates
moar
is not your current pager, or at least this version ofmoar
isn't. Otherwise it wouldn't show the "Making moar Your Default Pager" section.You might be using some other installation of
moar
as yourPAGER
.Also, please do
moar --version
so I know where we are.
On fish you cannot put the export command like that, obviously it's the default pager since it opens moar when I type "man". Most likely your code tries to verify if it is set only on bash shells.
Hmm, in fact, I did something a bit special, lol. I set $PAGER to pager
and set it as moar
with update-alternatives
command. I don't remember why but there was a purpose and maybe that's why it doesn't detect
My moar version is v1.23.3
@postsolar all the commands I press here open Moar, I can see the difference and you too from my screenshots
Ok so I pasted the last block of commands without trying to understand what it does. First of all, can you tell me why some people share commands with a >
before (or another character)?
Secondly, here is the result, the top part of the screenshot is using these commands, the bottom one is normal moar
So the top terminalfinally has some background on search (but i lost the blue color on bold words)
On fish you cannot put the export command like that
You can since version 3.1.0
First of all, can you tell me why some people share commands with a > before (or another character)?
Don't know about others, or if it's an explicit convention, but I use it to indicate what is the command and what is the output, for example:
> echo 123
123
You'll also see $
used. There's also a convention that #
prefix indicates running a command as root.
Ok so I pasted the last block of commands without trying to understand what it does
Well set -e ...
you already know, the other two run moar and less with the right variables to see if it helps.
But what about less, does it look the same? Also, what distro are you on and which terminal do you use? And could you share your terminal's colorscheme (perhaps use fastfetch or neofetch to generate it)?
@BarbzYHOOL maybe we should do a Google Meet call about this?
E-mail me (or send a calendar invite to) johan.walles@gmail.com. As for times let's try starting between 08:30CET and 20:00CET.
Seeing your screen live and talking to you directly would make this a lot easier to figure out I think.
@postsolar here is what LESS looks with your command, a bit a different than MOAR
I'm on POPOS 22.04 using Tilix, maybe it's a bug with the terminal??
Here is my color scheme (custom)
@walles i cannot be there at these hours and I don't have this thing google meet (nor microphone)
I won't be able to resolve this without access to the machine where this is happening, sorry.
If you find a way to have a call with desktop sharing @BarbzYHOOL let me know and we'll set something up!
Hello, I set moar as the default pager I had the same colors using LESS in the man pages
It's very dark and the worst is using the search tool and the result is highlighted but I see nothing, it's grey on grey
What can I do?