Created attachment 897312 [details] new lesspipe script Hello, since sys-apps/less-643-r[12] is using dev-python/pygments-2.17.2 for color output, viewing files without a suffix needs up to a second before they are displayed, but colors would be nice... Just try less /usr/share/misc/magic/* and walk through the list of files using :n and :p While having a look at /usr/bin/lesspipe, I've decided to re-write most parts of this script, in order to: - fix the problem with slow execution, - support many more suffixes, not only for colorization, - fully handle compressed files. I've tried to find some nice looking colors, but they aren't as nice as those used by vim... The new lesspipe script is heavily commented, so please RTFS. All my added comments are marked with (ThMO) in order to distinguish them from the original comments. Notice: I'm working on a 80x25 terminal console, therefore my lines do not exceed 80 columns - furthermore I never use tabs at the beginning of a line, for obvious reasons. So please execute :se ts=2 inside vim for proper indentation. If you're willing to accept my changes, please feel free to: - re-indent as you like it, - remove comments at your will. THX for listening so far. CU Tom
Hi Tom Thanks a lot for the updated script. I think it would be much better for us to try to split the changes in different commits; maybe using github for that would be easier, as that would also allow easier reviewing of them. https://github.com/gentoo/gentoo/pulls From what I have seen: - I would drop the vim headers and try to keep the indentation as it was. - Regarding the credits, the commits will contain them; maybe like that, we wouldn't need to specify it directly on the header of the file 🤔 - "reason" section could be dropped from the script and be used for each relevant commit. - Probably, one commit per change as reported in "short overall changes" would fit nice. - Regarding "file -b" usage, either we will need to RDEPEND on sys-apps/file when lesspipe is installed, if a fallback should be added too. - The script should allow to configure the used color (maybe via a ENV flag in line with LESSCOLOR flag.
Hi Pacho, (In reply to Pacho Ramos from comment #1) > I think it would be much better for us to try to split the changes in > different commits; maybe using github for that would be easier, as that > would also allow easier reviewing of them. you will surely know best, how to organize the sources... > From what I have seen: > - I would drop the vim headers and try to keep the indentation as it was. Just indent as you prefer it. > - Regarding the credits, the commits will contain them; maybe like that, we > wouldn't need to specify it directly on the header of the file 🤔 > - "reason" section could be dropped from the script and be used for each > relevant commit. > - Probably, one commit per change as reported in "short overall changes" > would fit nice. I've added a lot of comments in order to make it more obvious, what has changed and why. Almost all comments aren't needed - so remove them, thereby speeding up parsing time by bash. ;) > - Regarding "file -b" usage, either we will need to RDEPEND on sys-apps/file > when lesspipe is installed, if a fallback should be added too. Both sys-apps/file and sys-apps/sed are needed - so a dependancy will be neccessary. > - The script should allow to configure the used color (maybe via a ENV flag > in line with LESSCOLOR flag. This could be called LESSCOLORIZERTERM, since the type of terminal does select the colours: + "-f terminal256" (my preference) + "-f terminal -O bg=dark" (alternative) + "-f terminal" (for those using a light background) The variable optlex would then be setup as follows: optlex="-s -f ${LESSCOLORIZERTERM:-terminal256} -l" CU Tom