nano-devel
[Top][All Lists]
Advanced

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

Re: requesting an option to zap selected text when typing any character


From: pepa65
Subject: Re: requesting an option to zap selected text when typing any character
Date: Fri, 11 Dec 2020 23:05:37 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 11/12/2020 22.30, Benno Schulenberg wrote:
> Interesting use case: a keyboard macro that searches for a regex, cuts
> the match, and then pastes it somewhere else.  Sounds cool, but I can't
> think of a situation where I would want to do this.  Can you give a
> realistic example?

I use text editors a lot like this. The example I'm giving here is from
a recent case where I was inspecting a CSV file, where I decided I
wanted to move the second field (of 5) to the end of the line. If the
length is fixed, you can use Mark and count lefts until you cut what you
need to cut. In my case, I had 2 lengths, so I used a regex find twice
for both lengths. But with the new feature, I would search for /,[^,]/
then cut that, move to the end of the line and paste, for any length of
the field!

I know there are non-texteditor ways of accomplishing the same, but it
is so handy if you already have the file open in your text editor to
just be able to do this! Even just the feature to select the search
result (I guess the mark will be at the end and the cursor at the start
of the search result) is useful, because a mark is very powerful, but so
far it always had to be set manually.

> Still, even if the found match would be marked only when the mark is off
> when the search starts, it would still modify the marking behavior: the
> mark would be switched on by a successful search.  That would interfere
> with people searching for something and then wishing to start marking
> stuff from the cursor position; they would have to first switch the mark
> off and then back on again.  So, if implemented, this "mark the match"
> behavior will have to be behind an option.

I agree, I would envision this like an option I would turn on in a
search if I needed it. Like I toggle regex on in a search when I need
it: toggle select search result.

Cheers,
Peter



reply via email to

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