Ⅰ. 插件描述
Repeatable appending yank to a named register.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/repeatableyank'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/repeatableyank'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/repeatableyank'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/RepeatableYank
Ⅳ. 文档说明
DESCRIPTION
Text fragments can be collected and accumulated by first yanking into a
lowercase register, and then subsequently yanking into the uppercase variant.
The problem is that the register must be specified on every yank command, and
one accidental omission of uppercasing the register results in the
irrecoverable loss of all fragments collected so far.
This can be somewhat remedied by enabling the non-default cpo-y setting,
which allows a repeat of a yank (plus remembered last register) via .
This plugin instead offers an alternative yank command gy, which allows to
specify the accumulator register only once on its initial use, can then be
repeated as an operator, linewise, in visual mode and via ., and enhances
some yank semantics for special cases. For example, subsequent blockwise
yanks are merged as blocks to the right, instead of added below the existing
text blocks.
USAGE
["x]gy{motion} Yank {motion} text into register x.
"xgyy Yank [count] lines into register x.
{Visual}["x]gy Yank the selected text into register x.
Subsequent gy commands without an explicit register
and command repeats via . will append (in the case
of named registers {a-zA-Z}) the text to / overwrite
(for registers {0-9*+~/-}) the previously used
register x, until another register is explicitly
given.
Therefore, you can gradually build up text in a named
register, or easily update the system clipboard
without having to repeat the register on every yank.
Subsequent blockwise yanks are merged as blocks to the
right:
ab -> ab12
cd cd34
instead of added below the existing text blocks:
ab -> ab
cd cd
12
34
["x]gly{motion} Yank {motion} text as a new line into register x.
{Visual}["x]gly Yank the selected text as a new line into register x.
When repeated, the text will be automatically
separated from the existing contents by a newline
character. This is useful for collecting individual
words (without surrounding whitespace), or other
phrases when you intend to work on them as separate
lines.
You can also use this mapping to avoid the special
RepeatableYank-block-merge behavior.
EXAMPLE
Start by yanking "an entire line" into register a:
"agyy
an entire line
Add "another line" to the same register a without specifying it again:
gyy
an entire line
another line
Add "word1" and "word2"; even though the register is now of linewise type,
these are added on a single line:
gyw w.
an entire line
another line
word1 word2
Now, let's yank a vertical block of "ABC" into another register:
<C-V>2j "bgy
A
B
C
Another vertical block of "123" is appended blockwise to the right:
l1v.
A1
B2
C3
You can build up multiple registers in parallel. To switch to another register
without starting over, just specify the uppercase register name:
"Agyy
an entire line
another line
word1 word2
+addition after register switch
This is an example of gly:
Start by yanking "word1" into register a:
"aglyi"
word1
Add "word2" and "word3", but on separate lines, so that the register contents
don't turn into a mess of "word1word2word3":
glyi"
word1
word2
w.
word1
word2
word3