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

    From swapjim@swapjim@example.org to comp.editors on Mon Feb 16 23:29:32 2026
    From Newsgroup: comp.editors

    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set compatible' in the vimrc file.

    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? If yes, is there a way to not to yank the text
    I'm deleting?

    Is this perhaps Vim behavior? The Vi bundled with BusyBox that runs on
    my router also yanks text it deletes.
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Rene Kita@mail@rkta.de to comp.editors on Mon Feb 16 21:43:07 2026
    From Newsgroup: comp.editors

    swapjim <swapjim@example.org> wrote:
    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set compatible' in the vimrc file.

    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? If yes, is there a way to not to yank the text
    I'm deleting?

    Is this perhaps Vim behavior? The Vi bundled with BusyBox that runs on
    my router also yanks text it deletes.

    It's totally normal and desired by most users, I guess.

    Use "_dd and similar to not put the deleted text in a register.
    See :h "_
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.editors on Mon Feb 16 23:20:46 2026
    From Newsgroup: comp.editors

    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

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.editors on Mon Feb 16 23:28:02 2026
    From Newsgroup: comp.editors

    On 2026-02-16 22:43, Rene Kita wrote:
    swapjim <swapjim@example.org> wrote:
    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set
    compatible' in the vimrc file.

    Use "_dd and similar to not put the deleted text in a register.
    See :h "_

    Do you know whether that register was existing in classical Vi ?
    (I don't think so but, frankly, I don't recall and I'm curious.)

    Janis

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Rene Kita@mail@rkta.de to comp.editors on Tue Feb 17 07:42:41 2026
    From Newsgroup: comp.editors

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 2026-02-16 22:43, Rene Kita wrote:
    swapjim <swapjim@example.org> wrote:
    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set
    compatible' in the vimrc file.

    Use "_dd and similar to not put the deleted text in a register.
    See :h "_

    Do you know whether that register was existing in classical Vi ?
    (I don't think so but, frankly, I don't recall and I'm curious.)

    Janis

    AFAIK it's a vim extension - but it works in vim with 'set compatible'.
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Anthony Howe@achowe@snert.com to comp.editors on Tue Feb 17 05:53:07 2026
    From Newsgroup: comp.editors

    On 2026-02-16 17:28, Janis Papanagnou wrote:
    Use "_dd and similar to not put the deleted text in a register.
    See :h "_

    Do you know whether that register was existing in classical Vi ?
    (I don't think so but, frankly, I don't recall and I'm curious.)

    The "a .. "z and "1 .. "9 buffers are part of historical `ex` and `vi`, see SUS
    https://pubs.opengroup.org/onlinepubs/9799919799/ buffer definition.

    I used to work on Mortice Kern Systems maintaining their DOS `vi` while we were
    balloting POSIX.2. The named buffers were part of the historical `vi` and the MKS independent clone.

    As for the OP, deleting / changing always included a yank into the numeric buffers. That is historical behaviour and documented in SUS.
    --
    Anthony C Howe
    achowe@snert.com BarricadeMX & Milters http://nanozen.snert.com/ https://github.com/SirWumpus
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.editors on Tue Feb 17 14:08:01 2026
    From Newsgroup: comp.editors

    In article <10n1ham$1mgl9$1@dont-email.me>,
    Anthony Howe <achowe@snert.com> wrote:
    On 2026-02-16 17:28, Janis Papanagnou wrote:
    Use "_dd and similar to not put the deleted text in a register.
    See :h "_

    Do you know whether that register was existing in classical Vi ?
    (I don't think so but, frankly, I don't recall and I'm curious.)

    The "a .. "z and "1 .. "9 buffers are part of historical `ex` and `vi`,
    see SUS https://pubs.opengroup.org/onlinepubs/9799919799/ buffer
    definition.

    But that's not Janis's question. The question is whether or not classical
    vi has the "_" (black hole) register. And the answer to that is No.

    I used to work on Mortice Kern Systems maintaining their DOS `vi` while we >were balloting POSIX.2. The named buffers were part of the historical `vi` >and the MKS independent clone.

    Right. But since we are in this general area and not to change the subject
    but to change the subject, let me add that I have never been able to figure
    out the logic of the numbered buffers. I've never seen a good explanation
    of why they are there and how you might use them to your benefit. And
    every time I've tried to use them, things are not where I expect them to
    be. That is, when I do the "registers" command (in Vim), the contents of
    the numeric buffers always seems random/unpredictable to me.

    As for the OP, deleting / changing always included a yank into the numeric >buffers. That is historical behavior and documented in SUS.

    Yeah, but which one - and for how long?

    Anyway, it is not clear what OP is actually concerned about. Why should
    one care about whether or not yanking puts text into the (unnamed) buffer
    or not? Is it an efficiency concern (in which case, it is almost certainly
    an unnecessary concern) or is about wiping out something that you wish to
    keep? (If the later, then you should, as detailed upthread, store it into
    some other register. That's what I do; if I think I may later need what I am yanking or deleting, then I yank/delete it into a named register [*]).

    [*] Which, of course, also puts it into the unnamed register.
    --
    A racist, a Nazi, and a Klansman walk into a bar...

    Bartender says, "What will it be, Mr. Trump?"

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.editors on Tue Feb 17 17:41:30 2026
    From Newsgroup: comp.editors

    On 2026-02-17 15:08, Kenny McCormack wrote:
    In article <10n1ham$1mgl9$1@dont-email.me>,
    Anthony Howe <achowe@snert.com> wrote:
    [...]

    Right. But since we are in this general area and not to change the subject but to change the subject, let me add that I have never been able to figure out the logic of the numbered buffers. I've never seen a good explanation
    of why they are there and how you might use them to your benefit. And
    every time I've tried to use them, things are not where I expect them to
    be. That is, when I do the "registers" command (in Vim), the contents of
    the numeric buffers always seems random/unpredictable to me.

    Well, while for a long time I shared that feeling and typically also
    abstain from using the numbered buffers[*] its quite "predictable" -
    but I'm aware you might mean that last sentence more figuratively.

    I think there's one important difference to the named buffers to know; "yanking" will *not* put that text into the _numbered_ buffers, while
    a deleted text will go there.[**] And then it gets simple; "1 was the
    last deleted text, "2 the one before, etc., and whenever a new text
    will be deleted the numbered registers stack contents will get shifted.

    The inherent problem is that the register numbers change with every
    new delete and you'd have to keep that in mind unnecessarily, so [*].
    You can of course (in Vim) also interrogate the registers in case you accidentally deleted a text some time before and want that recovered,
    by :reg

    Janis

    [*] In practice I also use mainly named registers which are also more
    powerful and the register name can be chosen to be a mnemonic letter.

    [**] This is from my ad hoc tests, but note that the vim help says for
    numbered registers:
    "Vim fills these registers with text from yank and delete commands."
    which is disturbing.

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Jason H@jason_hindle@yahoo.com to comp.editors on Tue Feb 17 22:42:24 2026
    From Newsgroup: comp.editors

    On 16/02/2026 21:29, swapjim wrote:
    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set >compatible' in the vimrc file.

    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? If yes, is there a way to not to yank the text
    I'm deleting?

    Is this perhaps Vim behavior? The Vi bundled with BusyBox that runs on
    my router also yanks text it deletes.

    If it's to avoid yanking data you're putting over, shift-P should do the
    trick.
    --
    --
    A PICKER OF UNCONSIDERED TRIFLES
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Jason H@jason_hindle@yahoo.com to comp.editors on Tue Feb 17 22:49:26 2026
    From Newsgroup: comp.editors

    On 17/02/2026 22:42, Jason H wrote:
    On 16/02/2026 21:29, swapjim wrote:
    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set >>compatible' in the vimrc file.

    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? If yes, is there a way to not to yank the text >>I'm deleting?

    Is this perhaps Vim behavior? The Vi bundled with BusyBox that runs on
    my router also yanks text it deletes.

    If it's to avoid yanking data you're putting over, shift-P should do the
    trick.

    Apologies... I suspect that may not work with Vi from Caveman days.
    --
    --
    A PICKER OF UNCONSIDERED TRIFLES
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Geoff Clare@geoff@clare.See-My-Signature.invalid to comp.editors on Wed Feb 18 13:34:32 2026
    From Newsgroup: comp.editors

    swapjim wrote:

    I'm using GVim 9.1 on Windows to learn traditional Vi by setting 'set compatible' in the vimrc file.

    I then select some text using 'v' and ...

    Others have addressed your actual question, but I feel I should point
    out that there was no 'v' command in traditional vi.

    I assume "set compatible" in vim only changes vim's behaviour where
    it conflicts with traditional/POSIX vi but non-conflicting extensions
    are still available.

    Someone else gave a link to the online POSIX vi man page; you could
    use that reference as a way to identify what things that still work
    in vim with "set compatible" are non-standard.
    --
    Geoff Clare <netnews@gclare.org.uk>
    --- Synchronet 3.21b-Linux NewsLink 1.2