Hi all!
I recently decided to change terminal tab stop width from default 8 to 4, because when I do some coding in the terminal, strings go too much to the right (almost out of the screen) after a couple of tabs. So I managed to change my terminal emulator capabilities and re-create the termcap(5) database. Now, when I hit tab it visually looks like 4 spaces, so far so good.
But when I type
Well, I understand that for now I can just change the value of this variable to 4 and recompile `ls` from sources, but it doesn't seem to be a flexible solution. After all, is that the only possible way to make it work?
Has someone ever managed to have a custom tab stop width and decent output alignment for programs like ls(1)?
Thank you.
Artem.
I recently decided to change terminal tab stop width from default 8 to 4, because when I do some coding in the terminal, strings go too much to the right (almost out of the screen) after a couple of tabs. So I managed to change my terminal emulator capabilities and re-create the termcap(5) database. Now, when I hit tab it visually looks like 4 spaces, so far so good.
But when I type
ls
(or ls -C
, which forses multi-column output, the default for terminal) the output gets wrong alignment. I figured that that's due to the fact that by default ls(1) assumes that tab stop size is 8, meanwhile I set it to 4. In the Internet I found the information about -T
(or --tabsize
) option for `ls` command. You can read about it in the Slackware 3.1 manual page, for example. However, I didn't find the equivalent option for [cmd=1]ls[/cmd] in FreeBSD. Neither it has a TABSIZE
environment variable or something like that. I looked into the source code of `ls` and it seems that it indeed does not allow to specify different size for tab stops. Here's a small snippet from /usr/src/bin/ls/print.c
:
C:
int tabwidth;
if (f_notabs)
tabwidth = 1;
else
tabwidth = 8;
Well, I understand that for now I can just change the value of this variable to 4 and recompile `ls` from sources, but it doesn't seem to be a flexible solution. After all, is that the only possible way to make it work?
Has someone ever managed to have a custom tab stop width and decent output alignment for programs like ls(1)?
Thank you.
Artem.