Tuesday, February 4, 2020

Re: Triplicate text after mix-matching vim and nvi

On Tue, Feb 4, 2020 at 10:04 AM 'Ottavio Caruso' via vim_use
<vim_use@googlegroups.com> wrote:
>
> Hi,
>
> Maybe this is off-topic but I hope you guys can help, as there's no
> specific maling list for classic vi/nvi.
>
> On my system (Linux/amd64 Debian 4.9.189) I have:
>
> - vim (vim 8.1)
> - vi (aliased to vim)
> - nvi (nvi-1.81.6nb5 )
>
> For self-educational purposes, I've been trying to teach myself to use
> both vim and nvi, as I'm studying for a BSD-related certification,
> where old vi is installed by default. So, to a certain extent, I am
> looking for trouble, however...
>
> I have a file (man-pages.txt) where I have a list of man pages that I
> need to expand, for example:
>
> man 8 tcpdump
> man 1 login
> man 8 sysctl
> man 8 adduser
> man 5 adduser.conf
> man 8 rmuser
> man 8 useradd
> man 8 userdel
>
> and so on. When I am finished with reading a man page, I cut the first
> line and I paste to the last line, so:
>
> 1) dd
> 2) [shift] + g
> 3) p
>
> And I've been doing this for a few months. Sometimes I use vim and
> some other times nvi.
>
> At one point, I noticed that the size of this file was growing
> abnormally. Then, I realised that the entries were in duplicate or
> triplicate copies, that is, as if I had copied the whole file and then
> pasted it twice onto itself.
>
> I removed the duplicate lines and started from scratch and, as a proof
> of concept, alternated between vim and nvi, just to see if this would
> happen again, and indeed it did.
>
> I wonder if somebody has a clue why this happens. Is this something I
> should expect? Is there a markup that one editor places that confuses
> the other?
>
> Thanks
>
> --
> Ottavio Caruso

The following mapping will move the first line from top to bottom of
the file (at least in Vim in 'nocompatible' mode, I'm not sure about
vi (or 'compatible' Vim) and nvi):

:map <F5> :1d<Bar>$put<CR>

(<Bar> rather than | to avoid interpreting the rest when declaring the
mapping rather than when executing it). Of course you can use any
convenirnt {lhs} instead of <F5>

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXszH_D3AKqVA7nRgckX0jO0WtSX4d4ACbNf7X7v%2BRB01Q%40mail.gmail.com.

No comments: