Ⅰ. 插件描述
copy lines into clipboard with the line numbersⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ujihisa/nclipper-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ujihisa/nclipper-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ujihisa/nclipper-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ujihisa/nclipper.vim
Ⅳ. 文档说明
# nclipper.vim
Usage
Start visual mode with V and select some lines.

Type <C-y>

Now your clipboard or Vim register "+ has the lines you selected with line numbers. Paste it anywhere you want!

If you also want to copy the filename in the 1st line, use <M-y> (meta + y which is cmd + y on OSX and alt + y on Linux.)
Author
Tatsuhiro Ujihisa
Configulation
If you don't want to map <C-y>, assign a true value into g:nclipper_nomap in your ~/.vimrc.
let g:nclipper_nomap = 1
And you can map the functionality on any key like the following example.
vmap <space>y <Plug>(nclipper)
vmap <space>Y <Plug>(nclipper-with-filename)
If you want to change the format of yanked string,
you can specify the format with g:nclipper_format.
Here is the default value:
let g:nclipper_format = 'printf("%" . max_len . "d %s", v:key + begin, v:val)'
You can use these variables:
v:key- current line's index number
v:val- current line's string
begin- the first line number
end- the last line number
max_len- max string length between
beginandend.
- e.g.: when
beginis 98 andendis 102,max_lenis 3.
this value is identical to
len(end).- max string length between