Re: how to delete a full word with cursor in the middle of the word?

Benno Schulenberg <[email protected]> Tue, 15 Nov 2022 18:03:31 +0100
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hello Andy,

Op 15-11-2022 om 13:25 schreef Andreas Radke:
> 1) I'm missing a simple one keystroke function to delete a full word in
> nano under the cursor to both ends with a single (key) action?

With the new nano-7.0 you could do something like:

   set afterends
   bind ^D "{left}{nextword}{chopwordleft}" main

The {left} is not strictly necessary but will make the keystroke work
also when the cursor is just after the word, which is what Ctrl+Right
will do when --afterends is active.

> 2) And I have a special case where word boundaries don't work properly
> for me: I haven't found a simple way to delete quoted sha checksums
> with one keystroke keeping the quotes like:
> 'b2059568b1e35c34c12b580803998e66b142d96e9a35f16b63afccb8e6af5c34'

The example given above would work here too.  But if you don't want
to use --afterends, you could make a binding specific for this case:

   bind ^D "{end}{left}{chopwordleft}" main

If the closing quote is not guaranteed to be at end-of-line, something
a little more complicated could work:

   bind ^D "{home}{whereis}'{enter}{findnext}{chopwordleft}" main


Benno
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed