nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global tabgives and spacestotab config option


From: Benno Schulenberg
Subject: Re: Global tabgives and spacestotab config option
Date: Fri, 4 Jun 2021 17:23:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Op 04-06-2021 om 12:06 schreef pepa65:
> On 6/4/21 3:18 PM, Benno Schulenberg wrote:
>> But instead of asking for a new feature in nano, you could also write
>> a wrapper script that replaces (after nano exits) every group of eight
>> leading spaces with a tab.  The script could even peek into ~/.nanorc
>> to see what tabsize is set to and use that to count the spaces.
> 
> Not sure how the wrapperscript would fit into the workflow, but I came up 
> with this:

The idea of a wrapper script is that when the user types 'nano arguments',
that instead of nano itself the script is invoked (either through an alias
or by naming the script 'nano' and having it earlier in the PATH than the
real nano), which then first calls the real nano with all the arguments,
and after nano exits runs your sed script with -i on all the file arguments
-- that is: on all arguments that do not start with + or - (people who use
file names that begin with a plus or a minus deserve their pain).

> nanoconf=~/.nanorc s='[[:blank:]]'

> spc=$(printf '%*s' $tabsize) tab=$'\t'

Having two assignments on one line is poorly readable.

But thanks for the script.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]