Thursday, March 16, 2017

Re: Wierdness in vim

Thank you for your response!!!

On Thu, Mar 16, 2017 at 10:14 AM, Tim Chase <vim@tim.thechases.com> wrote:
> On 2017-03-16 05:05, a joeiam wrote:
>> Issue:working in a file with about 6800 lines I find an error. Need
>> to add two lines to one 'section'. Used +y to yank and then used
>> +GP to place. Was absolutely unable to place the lines. Instead the
>> 2 lines were place at the end of the document.
>
> It looks like you're trying to yank to the system clipboard. For
> that, you want
>
> "+y
>
> (i.e., include the double-quote before hand). The yanking sequence
> as you describe it currently goes to the beginning of the next line
>
> :help +
>
> and then begins a yank, but leaves you in operator-pending mode as
> it's expecting a motion to specify where you want to yank to.
>
> If you've recently changed your vim, make sure that you're using one
> that has been built with clipboard support. To do that, issue
>
> :version
>
> and look for "+clipboard" instead of "-clipboard". If you have
> "-clipboard", you're likely running what some distros call "vim-tiny"
> or an alternate vi such as nvi, stevie, or elvis.
>
> If you're really trying to yank two lines into the unnamed register,
> you need to specify the motion after the "y" by doing
>
> y+
>
> which can also be written as
>
> yj
>
> or
>
> 2Y
>
> Likewise, when you go to paste, your "+GP" translates as
>
> + Go to the beginning of the next line
> G Wait, actually go to the bottom of the file
> P Paste the most recently-yanked thing before the cursor
>
> If you want to paste from the system clipboard, again, you need to
> prefix the register reference with the double-quote:
>
> "+GP
>
> That all said, unless you actually need the yank put on the system
> clipboard, vim has a bunch of named registers if you want to keep the
> content around, and defaults to the "unnamed" register. So you may
> be good with just doing
>
> yy
>
> to yank the row (or "y+" to yank two rows, or "yap" to yank the
> blank-line-delimited block), move to your destination, and
>
> p
>
> to paste the content. Note that those are all lowercase. There is a
> "gp" command, but the (capital) "G" you're issuing is what moves you
> to the end of your file.
>
Trying to find the cheat sheet where I found the +GP command for pasting.
Of course cannot find it now! Have been using "The Vim Reference and Tut-
orial" as a primary reference and its not in that one.

I haven't tried using your suggested command sequence yet but I'm wondering
- - - been using V for line based select and then scrolling to the end of the
needed lines (anywhere from the one line to about 10) and then doing the +y.

The suggesting in ledger-cli was that emacs (or vim) would reduce keystrokes
and moving fromt he keyboard to the mouse and back again like when using
ctrl-c (etc). With adding even more keystrokes I'm wondering about that
efficiency - - - I just don't see it. (Not trying to complain I'm just
looking for
a quick entry system that is easy to edit that works well with ledger-cli
(wanting to add some in-line programs to make things even easier and that
AIUI is where vim and emacs shine) but its looking like one needs to be
real familiar with either vim or emacs BEFORE this happens. I might decide to
learn all the twists and turns of one of these two but if I hire someone to do
the entry of information for me - - - well that just doesn't fly for any
'bookkeeper' types.

>> Used +GP a couple more times not understanding why the 2 lines were
>> not placed and then I looked at the doc.I had gone from 6814 lines
>> to 12 877 lines and all of the lines were the 2 yanked (with a
>> blank line before and after each iteration).
>
> I suspect something got omitted and you ended up yanking from your
> current location to the end of the file, and then pasting that
> content. If your cursor was at the beginning of the file to start,
> that would double the size of the file.

Sort of but it was only lines that had gotten yanked but there were about
2000 copies of those 3 lines!

Thank you again for your explanation!!!!

Regards

Dee

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: