Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 55e6b05aeb
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 86 lines (71 sloc) 4.288 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
This is a mirror of http://www.vim.org/scripts/script.php?script_id=3355

DESCRIPTION
If you're like me, you occasionally do a linewise yank, and then want to
insert that yanked text in the middle of some other line (or vice versa).
The mappings defined by this plugin will allow you to do a character-, line-,
or block-wise paste no matter how you yanked the text, both from normal and
insert mode.

Often, the register contents aren't quite in the form you need them. Maybe you
need to convert yanked lines to comma-separated arguments, maybe join the
lines with another separator, maybe the reverse: un-joining a single line on
some pattern to yield multiple lines. Though you can do the manipulation after
pasting, this plugin offers shortcut mappings for these actions, which are
especially helpful when you need to repeat the paste multiple times.

SOURCE
Based on vimtip #1199 by cory,
    http://vim.wikia.com/wiki/Unconditional_linewise_or_characterwise_paste

RELATED WORKS
- whitespaste.vim (vimscript #4351) automatically removes blank lines around
  linewise contents, and condenses inner lines to a single one. By default, it
  remaps p / P, but this can be changed.

USAGE
["x]gcp, ["x]gcP Paste characterwise (newline characters and indent are
                        flattened to spaces) [count] times.

["x]glp, ["x]glP Paste linewise (even if yanked text is not a complete
                        line) [count] times.

["x]gbp, ["x]gbP Paste blockwise (inserting multiple lines in-place,
                        pushing existing text further to the right) [count]
                        times.

["x]g,p, ["x]g,P Paste characterwise, with each line delimited by ", "
                        instead of the newline (and indent).

["x]gqp, ["x]gqP Query for a separator string, then paste
                        characterwise, with each line delimited by it.

["x]gQp, ["x]gQP Paste characterwise, with each line delimited by the
                        previously queried (gqp) separator string.

["x]gup, ["x]guP Query for a separator pattern, un-join the register
                        contents, then paste linewise.

["x]gUp, ["x]gUP Un-join the register contents on the previously
                        queried (gup) separator pattern, then paste
                        linewise.

["x]gpp, ["x]gpP Paste with the first number found on or after the
                        current cursor column (or the overall first number, if
                        no such match, or the last number, if the cursor is at
                        the end of the line) incremented / decremented by 1.
                        Do this [count] times, with each paste further
                        incremented / decremented.

CTRL-R CTRL-C {0-9a-z"%#*+/:.-}
                        Insert the contents of a register characterwise
                        (newline characters and indent are flattened to
                        spaces).
                        If you have options like 'textwidth', 'formatoptions',
                        or 'autoindent' set, this will influence what will be
                        inserted.
CTRL-R , {0-9a-z"%#*+/:.-}
                        Insert the contents of a register characterwise, with
                        each line delimited by ", " instead of the newline
                        (and indent).
CTRL-R CTRL-Q {0-9a-z"%#*+/:.-}
                        Query for a separator string, then insert the contents
                        of a register characterwise, with each line delimited
                        by it.
CTRL-R CTRL-Q CTRL-Q {0-9a-z"%#*+/:.-}
                        Insert the contents of a register characterwise, with
                        each line delimited by the previously queried (gqp,
                        i_CTRL-R_CTRL-Q) separator string.
CTRL-R CTRL-U {0-9a-z"%#*+/:.-}
                        Query for a separator pattern, un-join the contents of
                        a register, then insert it linewise.
CTRL-R CTRL-U CTRL-U {0-9a-z"%#*+/:.-}
                        Un-join the contents of
                        a register on the previously queried (gup,
                        i_CTRL_R_CTRL-U) pattern, then insert it linewise.
Something went wrong with that request. Please try again.