Ⅰ. 插件描述
Ecliptic.vim: Amicable Clipboard IntegrationⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'richsoni/vim-ecliptic'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'richsoni/vim-ecliptic'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'richsoni/vim-ecliptic'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/richsoni/vim-ecliptic
Ⅳ. 文档说明
## Ecliptic.vim: Amicable Clipboard Integration
Motivation
Juggling between vim's local clipboard and the system clipboard is a headache.
The plus register (e.g. "+yy, "+p) hinders workflows that require even minimal use of the clipboard.
It is a significant amount of keystrokes, and the keys are not in inconvenient places.
What Happens In Vim Stays In Vim
Ecliptic is for those who find vim's builtin solution (:set clipboard=unnamedplus) inconvenient.
When using unnamedplus the system clipboard gets polluted with the text of every yank and delete command.
Perpetually binding the clipboard to the unnamed register can be confusing and annoying for some.
The unnamed register is frequently modified more than the clipboard is used.
Enter Ecliptic
Ecliptic maps the power of "+ to a more natural interface.
All of its mapping start with the c prefix (mnemonic for clipboard).
By default c is just an operator, so many c-letter bindings are unmapped.
Ecliptic's mappings do not clobber default vim functionality.
Usage
Yank Proxies
cy{motion} |
y yank |
cyy |
yy |
cY |
Y |
{Visual}cy |
v_y |
{Visual}cY |
v_Y |
c% |
expand("%:p") {copies the current filename} |
Delete Proxies
cd{motion} |
d |
cdd |
dd |
cD |
D |
{Visual}cd |
v_d |
{Visual}cD |
v_D |
Put Proxies
cp |
p put |
cP |
P |
cgp |
gp |
cgP |
gp |
{Visual}cp |
replace visual selection with clipboard |
Custom Prefix
By default Ecliptic sets the prefix to c as a mnemonic for clipboard.
This can be changed by setting the g:ecliptic_prefix variable in your .vimrc.
Here is an example remapping the prefix to the - key:
let g:ecliptic_prefix = '-'Now commands like -yy, and -p will invoke Ecliptic commands.
Ecliptic Scratch
The command cb represents ecliptic-buffer.
This will open a scratch buffer containing contents of the clipboard (+
register).
Each edit to this buffer will replace the clipboard with entirety of the
buffer.
cb |
open ecliptic scratch buffer |
<C-L> |
refresh an opened ecliptic scratch buffer with current clipboard contents |
Examples
* cursor position represented by [ ]
| Before | Command | Result |
|
buffer:"[A]nd, you ask why I don't live here?" clipboard: foobar unnamed: baz |
dW cyy
|
vim line:"And, [y]ou ask why I don't live here?" clipboard: "you ask why I don't live here?" unnamed: And, |
|
cursor at start of line:"[H]oney how come you don't move" clipboard: Babe unnamed: baz |
dw cp
|
vim line:"Babe[ ]how come you don't move" clipboard: Babe unnamed: Honey |
Installation
+Clipboard Requirement
Ecliptic makes use of the "+ register, which gets enabled during installation.
The plugin will not work without the +clipboard option which exposes the "+ register.
Run the following command to check for +clipboard flag:
$ vim --version | grep +clipboard || echo 'Ecliptic requires +clipboard'If it does not return 'Ecliptic requires +clipboard', then you are good to go.
If you are missing the flag, then you need to reinstall vim.
Installation varies system to system.
Heres an example of how to do it on Mac OS X with homebrew.
$ brew install macvim --override-system-vimA google search can help you get a proper vim installation on other systems.
Vundle Users
Add the following line to your .vimrc
Bundle "richsoni/vim-ecliptic"Pathogen Users
$ cd ~/.vim/bundle
$ git clone git://github.com/richsoni/vim-ecliptic.git