Monday, October 23, 2017

Re: vim paste question

On Mon, Oct 23, 2017 at 12:21 PM, dexter i <dexter.ietf@gmail.com> wrote:
> i want to be able to emit the following lines into the file under current cursor position.
> <paste-buffer-word> is the word i just yanked. what's the best way to achieve this.
>
> {
> .testtype = <paste-buffer-word>; \
> .testtypestring = "<paste-buffer-word>"; \
> }

In Vim terminology, cut, copy and paste are called respectively
delete, yank and put.

See
:help p
:help P

If the yank was characterwise, p will put it after the character at
the cursor and P (i.e., Shift-p) will put it before that same
character. Putting it "instead of" the character, word, etc. at the
cursor is possible too but I don't think that's what you want.

OTOH, if you want to start typing between the line at the cursor and
the next one (or after the last line if the cursor is on it), going
from Normal to Insert mode in the process, the mnemonic for that is
"open", see :help o (and :help O if you want to start typing between
the line at the cursor and the one just above it, or before the first
line if the cursor is on it).

Finally, if you want to put a certain set of lines (linewise)
repeatedly after the cursor line, moving the cursor each time, you
could just yank those lines into a specific lettered register (e.g. by
visually highlighting the concerned lines with, let's say, Vjjj then
yanking with "ay to save them in register a -- or also, with the :yank
ex-command and a count, :4y a -- or with the same command and a range,
:/^{/,/^}/yank a ) then repeatedly putting with "ap to put the
linewise register a after the cursor line (the :yank, :delete and :put
ex-commands always operate linewise). You can save 26 strings that
way, each of them character- line- or block-wise (generally I reserve
register q for macros created with the q command).

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

No comments: