You are not logged in.

#1 2011-04-27 07:33:28

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

How to get that colorful 'ls' output dmz keeps on showing us

A lot of people keeps on sending me emails and asking how I get ls to look like this:

ls++_linux_xterm.png


So I figured I'd write this down so I can direct them here instead. :-)

First of - I've made my LS_COLORS (dircolors, really) configuration public. It contains about 300 different filetypes as of this writing. It's grouped by ... uh, group. Music files, video, pictures, text documents etc. Follow the link for more information and installation instructions.

Second, I use ls++ - colorized ls on steroids. It can colorize files matching PATTERN, thus allowing you to also differentiate files missing an extension. It also calculates the relative mtimes - see the above screenshot.

See ls++(3) and ls++.conf(3) after installation for more information.

Last edited by dmz (2011-07-16 14:55:01)

Offline

#2 2011-04-27 10:53:36

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: How to get that colorful 'ls' output dmz keeps on showing us

I am confused!

So I installed ls++ from AUR (yay to AUR!), and now checking its config file, it says:

$colorscheme = 'trapd00r';

So, which colorscheme is that and where does it take that from?

Also, are you using ls++ as a replacement for ls? Or is that output in your screenshot still simply ls (with $ ls --color=auto)?

Offline

#3 2011-04-27 11:11:49

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: How to get that colorful 'ls' output dmz keeps on showing us

Stalafin wrote:

So, which colorscheme is that and where does it take that from?

The colorschemes are defined right down under ... starting on line 24.

Stalafin wrote:

Also, are you using ls++ as a replacement for ls? Or is that output in your screenshot still simply ls (with $ ls --color=auto)?

I use it as a replacement. It's not needed for the LS_COLORS to work.

Offline

#4 2011-04-27 12:12:15

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: How to get that colorful 'ls' output dmz keeps on showing us

Ah, I see, that makes sense!

As I see it, ls++ by default acts more like $ ls -lh. Are you planning to extend ls++ to the full functionality of ls?

Also, the default color you use for your terms is #121212 (for instance the background of the terms you took the screenshots of)? I am using #1e1e1e and especially the timestamp of files that haven't been changed for a long time are hardly visible :-( .

And on another note: I checked your Xresources: what is the definition the definition of all colors from 0 to 255 good for? Isn't one usually defining only 16?

Offline

#5 2011-04-27 12:49:35

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: How to get that colorful 'ls' output dmz keeps on showing us

Stalafin wrote:

As I see it, ls++ by default acts more like $ ls -lh. Are you planning to extend ls++ to the full functionality of ls?

It's more like ls -hAlv --group-directories-first --time=ctime --time-style=+%s . :-)
I wont make any attempt to include every possible combination of ls options - if there's something special you're missing I can look at it though.


Stalafin wrote:

Also, the default color you use for your terms is #121212 (for instance the background of the terms you took the screenshots of)? I am using #1e1e1e and especially the timestamp of files that haven't been changed for a long time are hardly visible :-( .


If you fire up  man ls++.conf you'll see what numbers corresponds to what element; for example, color index 4 is used for 'day'. So change the value of $c[4] in the config to any color you'd like.

Stalafin wrote:

And on another note: I checked your Xresources: what is the definition the definition of all colors from 0 to 255 good for? Isn't one usually defining only 16?

Normally, yes. But I'm not too happy with the default colors, so I've changed some of them.
See colorcoke and my urxvt fork for more information.

Offline

#6 2011-04-27 20:46:10

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: How to get that colorful 'ls' output dmz keeps on showing us

dmz wrote:
Stalafin wrote:

Also, the default color you use for your terms is #121212 (for instance the background of the terms you took the screenshots of)? I am using #1e1e1e and especially the timestamp of files that haven't been changed for a long time are hardly visible :-( .


If you fire up  man ls++.conf you'll see what numbers corresponds to what element; for example, color index 4 is used for 'day'. So change the value of $c[4] in the config to any color you'd like.

The package from AUR unfortunately does not install the man page ls++.conf ... What could be the reason for that? Anyhow, I looked at ls++.conf and saw it in the comments for your color scheme! Great!

dmz wrote:
Stalafin wrote:

And on another note: I checked your Xresources: what is the definition the definition of all colors from 0 to 255 good for? Isn't one usually defining only 16?

Normally, yes. But I'm not too happy with the default colors, so I've changed some of them.
See colorcoke and my urxvt fork for more information.

Will have a look!

Offline

#7 2011-04-27 21:00:59

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

Re: How to get that colorful 'ls' output dmz keeps on showing us

Stalafin wrote:

The package from AUR unfortunately does not install the man page ls++.conf ... What could be the reason for that?

that's because there isn't one. maybe man -> $EDITOR.

Offline

#8 2011-04-28 12:59:13

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: How to get that colorful 'ls' output dmz keeps on showing us

JokerBoy wrote:
Stalafin wrote:

The package from AUR unfortunately does not install the man page ls++.conf ... What could be the reason for that?

that's because there isn't one. maybe man -> $EDITOR.

There is a man page for ls++.conf - open up ls++.conf with your editor and check out the bottom half of the file; I think the manpage is supposed to be generated from that stuff.

Offline

#9 2011-04-29 08:34:53

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: How to get that colorful 'ls' output dmz keeps on showing us

Stalafin wrote:

The package from AUR unfortunately does not install the man page ls++.conf ... What could be the reason for that? Anyhow, I looked at ls++.conf and saw it in the comments for your color scheme! Great!

It should. As you say, the makefile will generate documentation in form of manpages for the POD inlined in ls++ (and ls++.conf). It works if you just clone the git and do it manually (remove the package from aur first):

git clone git://github.com/trapd00r/ls--.git
cd ls--
perl Makefile.PL && make && su -c 'make install'

Offline

#10 2011-04-29 08:58:51

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

Re: How to get that colorful 'ls' output dmz keeps on showing us

dmz wrote:

It should. As you say, the makefile will generate documentation in form of manpages for the POD inlined in ls++ (and ls++.conf).

will not work.

--- a/Makefile.PL       2011-04-29 11:54:19.560000016 +0300
+++ b/Makefile.PL       2011-04-29 11:55:00.504000017 +0300
@@ -24,6 +24,7 @@ WriteMakefile1(
     },
     MAN1PODS            => {
       'ls++'            => 'blib/man1/ls++.1',
+      'ls++.conf'       => 'blib/man1/ls++.conf.1',
       },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'ls++-*' },

Offline

#11 2011-04-29 10:47:16

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: How to get that colorful 'ls' output dmz keeps on showing us

Heh.

Perhaps I should read my own source before answering the next time... the ls++.conf on my system must've been an old artifact. Thank you JokerBoy - it's pushed so it should be working right away.

Offline

#12 2011-07-20 14:43:20

theseus
Member
Registered: 2011-07-20
Posts: 19

Re: How to get that colorful 'ls' output dmz keeps on showing us

This looks really nice but I'm having a bit of trouble getting the seperator right.
If I use bare "ls++", then, with urxvt and zsh, I have funny "â" as seperators.

â drwxr-xr-xâ2  day â   4KâDesktop
â drwxr-xr-xâ2  day â   4KâDocuments
â drwxr-xr-xâ18 min â   4KâDownloads
â drwx------â7  hourâ   4KâSpiderOak
â drwxr-xr-xâ7  min â   4Kâbackup
â drwxr-xr-xâ25 hourâ   4Kâbin
â drwxr-xr-xâ2  day â   4Kâconfig

If I set @d in the config file as:

@d = qw(| | | | | | |)

the nice alignment is messed up.

What am I missing?

Edit: nevermind, after restarting my machine (and X), it worked fine. Thanks for this nice looking script ;-)

Last edited by theseus (2011-07-25 08:04:45)

Offline

Board footer

Powered by FluxBB