Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls --color not working on freebsd? #2149

Open
hanoii opened this issue Nov 21, 2019 · 8 comments
Open

ls --color not working on freebsd? #2149

hanoii opened this issue Nov 21, 2019 · 8 comments

Comments

@hanoii
Copy link

hanoii commented Nov 21, 2019

Hi!
So I have this Freebsd I am connecting to from mac, I already did the termcap addition and compilation of the database and while now most things work, I cannot get colors to work.

ls --color just output no color

on iTerm they do work. Any ideas?

@Luflosi
Copy link
Contributor

Luflosi commented Nov 21, 2019

I can reproduce the problem. kitty correctly respects the color escape codes. This can be verified with something like printf '\033[31mhello\n'. Executing ls --color > ~/test.txt in e.g. the gnome terminal, where color is working and then cat ~/test.txt in kitty also works, so for some reason ls does not work with the termcap.
For some reason adding

:Co#8:\
:AB=\E[4%dm:\
:AF=\E[3%dm:\
:op=\E[39;49m:

to the kitty termcap makes it work. I copied these from the entry for xterm-basic and removed all the unnecessary ones.
@hanoii Can you try appending the lines from above? You need to add a backslash to the last line printed by infocmp -C xterm-kitty.

@hanoii
Copy link
Author

hanoii commented Nov 25, 2019

@Luflosi yes, that makes it work for me.

@Luflosi
Copy link
Contributor

Luflosi commented Nov 25, 2019

@kovidgoyal why does infocmp -C xterm-kitty not print these four things?

@kovidgoyal
Copy link
Owner

No idea, you'd have to ask the maintainer of infocmp

@ghost
Copy link

ghost commented Dec 16, 2019

Not sure if this is related or intended (as Kitty's multi-platform), but on Linux, Kitty doesn't seem to support the $LS_COLORS variable so color support is missing from things such as zsh completions, ls (full range of file types) and commands like tree.

@kovidgoyal
Copy link
Owner

LS_COLORS is not something the terminal supports. It is something for programs running inside the terminal.

@tertium
Copy link

tertium commented Feb 16, 2020

By default, infocmp -C will restrict the produced termcap output to 1023 bytes, and thus will throw out a lot of capabilities, including the four above. So I would recommend the following:

  • make an uncut termcap file using infocmp -CrtqT xterm-kitty. It will contain the capabilities Co, AB, AF, and op, and many others.
  • remove all capabilities you can live without until you fit into the 1023 byte limit.

Here is my attempt:

infocmp -CrtTq0 xterm-kitty | sed -e 's/:\(pa\|%1\|&8\|F[^12]\|K[1-5]\|[RS]A\|Z[HR]\|ac\|c[hv]\)[^:]*//g'

This produces the following termcap entry of 1022 bytes:

xterm-kitty|KovIdTTY:5i:NP:am:cc:hs:km:mi:ms:xn:Co#256:co#80:it#8:li#24:#2=\E[1;2H:#3=\E[2;2~:#4=\E[1;2D:%c=\E[6;2~:%e=\E[5;2~:%i=\E[1;2C:*4=\E[3;2~:*7=\E[1;2F:@7=\EOF:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:IC=\E[%d@:Km=\E[M:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:as=\E(0:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=\r:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\n:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:kF=\E[1;2B:kI=\E[2~:kN=\E[6~:kP=\E[5~:kR=\E[1;2A:kb=\177:kd=\EOB:ke=\E[?1l:kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:me=\E[0m:mh=\E[2m:mr=\E[7m:nd=\E[C:oc=\E]104\007:op=\E[39;49m:r1=\E]\E\\\Ec:rc=\E8:sc=\E7:se=\E[27m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=^I:te=\E[?1049l:ti=\E[?1049h:ts=\E]2;:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h:

I've got no FreeBSD at hand to test it, so YMMV.

@markusressel
Copy link

@tertium Is it necessary to limit the list to 1023 bytes?

I am trying to get this working on a FreeNAS host, and with the help of the comments in this thread it seems to work fine.
However, when using htop the output is not colored:
image

while it is when using htop inside an iocage jail:

image

While appending the termcap stuff made htop work at all, it is not colored on the host system.
Is this some configuration of FreeNAS/htop that disables colored output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants