GNU bug report logs -
#6195
Feature Request for "fold"
Previous Next
Full log
Message #20 received at control <at> debbugs.gnu.org (full text, mbox):
unarchive 6195
stop
On 04/20/2013 11:50 AM, Jazzoslav Jammovitch wrote:
> Greetings, Supaninjas!
>
> I wish to make a request for a new feature to the fold program. Often, I find
> myself folding lines that comprise some kind of list such as:
>
> == A ==
> 1. Hola Mundo!
> 2. Cows say moo when they feel chatty.
> 3. I scream, you scream, we all scream for icecream! -- Roberto
>
> Folding this at 30 characters yields approximately the following list, but the
> desired effect would be to add three spaces to each broken line in order to
> align them with the enumeration index as demonstrated in list C.
>
> == B ==
> 1. Hola Mundo!
> 2. Cows say moo when they
> feel chatty.
> 3. I scream, you scream, we
> all scream for icecream! --
> Roberto
>
> == C ==
> 1. Hola Mundo!
> 2. Cows say moo when they
> feel chatty.
> 3. I scream, you scream, we
> all scream for icecream!
> -- Roberto
>
> Another somewhat contrived use case would be to fold the output of history at
> 1/3 - 1/2 of the terminal width and pipe the output into column -c 80 to make
> use of the whole terminal. Like so:
>
> $ hD -20
> 5900 lol 5908 lssort
> 5901 history 5909 history
> 5902 sBrc 5910 vim
> 5903 vim /home/jaroslav/.bashrc
> /home/jaroslav/.bashrc 5911 history
> 5904 sBrc 5912 historyPurge 15
> 5905 history 5913 hD
> 5906 function historyPurge { 5914 hD -20
> local range=`history | 5915 hD -50
> tail 5916 hD -40
> -n ${1:-1} | cut -d' ' 5917 hD -20
> -f 5918 hD -30
> 2`; history | tail -n 15 5919 hD -20
> ; }
> 5907 history
>
> What say you? Is this a useful feature or should I forget it and improve my sed
> skills instead?
Yes, this does have merit, but as responded to the
very similar request in http://bugs.gnu.org/6195,
fmt and sed might suffice. If not then we can reconsider.
thanks!
Pádraig.
This bug report was last modified 12 years and 89 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.