Ⅰ. 插件描述
A vim plugin to yank code.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'aaronlasseigne/yank-code'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'aaronlasseigne/yank-code'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'aaronlasseigne/yank-code'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/aaronlasseigne/yank-code
Ⅳ. 文档说明
# YankCode (vim)
Yank code to the clipboard. Code is automatically unindented. A header is added
in the form of a comment that includes the file name and lines copied. Adding
the header relies on commentstring being set correctly. If commentstring is
set to an empty string (e.g. JSON), no header will be added.
Instead of yanking:
def valid?(*)
if instance_variable_defined?(:@_interaction_valid)
return @_interaction_valid
end
super
endYou'll get:
# lib/active_interaction/concerns/runnable.rb (lines 48-54)
def valid?(*)
if instance_variable_defined?(:@_interaction_valid)
return @_interaction_valid
end
super
endNow you're ready to paste it into Slack or wherever you need!
Installation
Vim Plug
Plug 'AaronLasseigne/yank-code'Usage
Visually select an area and then call :YankCode.
You can also map it:
map <leader>y <plug>YankCodeThe mapping will work in normal and visual modes, e.g. <leader>yip or vip<leader>y to yank a paragraph.
YankCode is licensed under [the MIT License][].