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

Benno Schulenberg <[email protected]> Wed, 16 Nov 2022 09:37:50 +0100
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Op 15-11-2022 om 18:36 schreef Andreas Radke:
> but both bindings fail when placing the cursor on the leading "md5sum"
> not deleting md5sum but still removing the checksum itself and not the
> word under cursor.

Yes, because those bindings were specific to your special case, for
deleting-the-thing-between-single-quotes, for when you do not want
to put 'set afterends' in your ~/.nanorc.

With *set afterends*, this will work fine for deleting the word under
the cursor:

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


If you do not want to use 'set afterends', then a regular expression
will be needed to find end-of-word.

If you have *set regexp* in your ~/.nanorc, you can do:

   bind ^D "{whereis}\b{enter}{chopwordleft}" main

But the cursor has to be really on the word, not before it or after it.

Without 'set regexp' in your ~/.nanorc, the binding will have to enable
it, temporarily, like this:

  bind ^D "{whereis}{regexp}\b{enter}{whereis}{regexp}{cancel}{chopwordleft}" main


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