Thursday, March 16, 2017

Re: Wierdness in vim

On 2017-03-16, a joeiam wrote:
> Greetings
>
> Have been using vi for a while but more as a minor tool just used
> in system manipulation. Found a useful tool called ledger-cli and
> have therefore been using much more of both vim and gvim to
> generate the plain text files.Using vim 8.0.34. on a Debian jessie
> vm.
>
> 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. 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 have read the manual a few times before this and more after and
> I just cannot understand why +GP won't let me place lines anywhere
> I am asking. Maybe I'm too used to the ctrl-c and ctrl-v too much
> (using wysiwyg programs for 30 years or so).
>
> Is there anyone who can explain the limitations and/or the exact
> functions of both +y and +GP - - - - please?

There are no commands +y and +GP so I don't know how to directly
answer your question.

I recommend that you run the vimtutor program to properly learn the
movement, copy and paste commands. That would solve these and
probably other misunderstandings. See

:help vimtutor

+ is a motion command. It moves the cursor one line down. My guess
is that you wanted to yank into the + register. To specify the
+ register you need to precede the + with a ". See

:help +
:help registers
:help "+

For most simple copy-and-paste operations, you don't need to specify
a specific register. Just use the default, unnamed register.

y is a yank command, but in normal mode it must be followed by a
motion command to complete the command. The character

y

is an incomplete command. The next character will be interpreted
as a motion command which will tell Vim what to yank. See

:help y
:help copy-move
:help usr_04.txt

G is another motion command. It moves the cursor to the last line
in the file. When prefixed by a number, it moves the cursor to that
line number. See

:help G

The characters

+GP

tell Vim to move the cursor down one line, then to move the cursor
to the last line of the file, then to put the contents of the
unnamed register above the current line. See

:help quotequote
:help P

Regards,
Gary

--
--
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: