Groups | Search | Server Info | Login | Register


Groups > comp.editors > #106859

Re: Vi: is there any way not to yank text I'm deleting?

From Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups comp.editors
Subject Re: Vi: is there any way not to yank text I'm deleting?
Date 2026-02-16 23:20 +0100
Organization A noiseless patient Spider
Message-ID <10n057u$3tuuv$1@dont-email.me> (permalink)
References <10n027u$187f4$1@dont-email.me>

Show all headers | View raw


On 2026-02-16 22:29, swapjim wrote:
> [...]
> 
> I then select some text using 'v' and delete it using x. However, this 
> also copies the text (yanks it). Same thing happens when I try to delete 
> a few lines with 10dd or 10dw.
> 
> Is this normal behavior?

This is Vi standard behavior.

> If yes, is there a way to not to yank the text I'm deleting?

There's the elsethread mentioned "black hole register" (but I'm not
sure that was existing in classical Vi that you wrote are intending
to learn).

> [...]

I suppose you want the text not to enter the yank-buffer because you
want to recover (paste) a previously yanked (or deleted) text? - For
that you have also other means to keep and access former stored text.

You can store deleted or yanked text in a named register (a-z) with
the double quotes indicator; instead of, say,

   dw   you could   "a dw   (the space is just for readability here!)
   yy   you could   "b yy   etc. to enter text contents into a and b

Then you'd paste the stored data for example with  "a p  or  "b P
etc.  You can also *accumulate* deleted or yanked text in a register
if you use a capital alpha character, as in  "A dw  or  "B yy  etc.

For deleted text there's also the implicit numbered registers "1 "2
"3 etc. where you can access the last, the one before the last, etc.
deleted text and paste it as  "2 p  or  "3 P  (for example).

Janis

Back to comp.editors | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Vi: is there any way not to yank text I'm deleting? swapjim <swapjim@example.org> - 2026-02-16 23:29 +0200
  Re: Vi: is there any way not to yank text I'm deleting? Rene Kita <mail@rkta.de> - 2026-02-16 21:43 +0000
    Re: Vi: is there any way not to yank text I'm deleting? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-02-16 23:28 +0100
      Re: Vi: is there any way not to yank text I'm deleting? Rene Kita <mail@rkta.de> - 2026-02-17 07:42 +0000
      Re: Vi: is there any way not to yank text I'm deleting? Anthony Howe <achowe@snert.com> - 2026-02-17 05:53 -0500
        Re: Vi: is there any way not to yank text I'm deleting? gazelle@shell.xmission.com (Kenny McCormack) - 2026-02-17 14:08 +0000
          Re: Vi: is there any way not to yank text I'm deleting? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-02-17 17:41 +0100
  Re: Vi: is there any way not to yank text I'm deleting? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-02-16 23:20 +0100
  Re: Vi: is there any way not to yank text I'm deleting? Jason H <jason_hindle@yahoo.com> - 2026-02-17 22:42 +0000
    Re: Vi: is there any way not to yank text I'm deleting? Jason H <jason_hindle@yahoo.com> - 2026-02-17 22:49 +0000
  Re: Vi: is there any way not to yank text I'm deleting? Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2026-02-18 13:34 +0000

csiph-web