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.)
Tatsuhiro Ujihisa
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
begin
andend
. for e.g.: whenbegin
is 98 andend
is 102,max_len
is 3. this value is identical tolen(end)
.
- max string length between