Skip to content

About

Plugin copying code to clipboard formatted with line numbers and path to file.

Resources

Stars

9 stars

Watchers

2 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

vim_yank_with_context

Plugin copying code to clipboard formatted with line numbers and path to file.

Example output:
app/services/billing/invoice_sender.rb:10-20 ▾
────────────────────────────────────────────────────────────────────────────────
   1 | module Billing
   2 |   class InvoiceSender
   8 |     def call
⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝⁝
  10 | 
  11 |       @invoice.transaction do
  12 |         @invoice.lock!
  13 |         @invoice.update!(sent_at: Time.current)
  14 |         @invoice.line_items.each(&:freeze_price!)
> 15 |         @mailer.invoice(@invoice).deliver_later
  16 |         log_delivery
  17 |       end
  18 |     rescue ActiveRecord::RecordInvalid => e
  19 |       notify_failure(e)
  20 |     end
Why should you use it?
  • The plugin is good way to share your code even if your chat does not support block code format
  • No more explaining where this fragment of code comes from
  • Works out of the box!

Installation

via Plug, Neobundle or Vundle:

Plug 'dominikduda/vim_yank_with_context'
NeoBundle 'dominikduda/vim_yank_with_context'
Plugin 'dominikduda/vim_yank_with_context'

via Pathogen:

git clone https://github.com/dominikduda/vim_yank_with_context.git ~/.vim/bundle/vim_yank_with_context

How to use

Just enter visual line mode (V), select lines and click one of the mappings:

  • Control + y - yank selected lines marked with > and 3 lines around them (5 Control + y for 5 lines)
  • g Control + y - yank only selected lines, without marks
  • m Control + y - mark selected lines in the last yank (regenerates the clipboard)

Customization (values written here are defaults)

Change yank with context mapping:

let g:vim_yank_with_context#yank_mapping =  '<C-y>'

Change yank without marks mapping:

let g:vim_yank_with_context#plain_yank_mapping = 'g<C-y>'

Change mark in last yank mapping:

let g:vim_yank_with_context#mark_mapping = 'm<C-y>'

Change number of lines yanked around selection:

let g:vim_yank_with_context#surrounding_lines = 3

About

Plugin copying code to clipboard formatted with line numbers and path to file.

Resources

Stars

9 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages