Skip to content

copy lines into clipboard with filepaths and the line numbers

Notifications You must be signed in to change notification settings

Tej12345/nvimcodeclip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nclipper.vim

Usage

Start visual mode with V and select some lines.

before

Type <C-y>

after

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

on skype

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 begin and end. for e.g.: when begin is 98 and end is 102, max_len is 3. this value is identical to len(end).

About

copy lines into clipboard with filepaths and the line numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 61.5%
  • Ruby 38.5%