Skip to content

AaronLasseigne/yank-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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
    end

You'll get:

# lib/active_interaction/concerns/runnable.rb (lines 48-54)
def valid?(*)
  if instance_variable_defined?(:@_interaction_valid)
    return @_interaction_valid
  end

  super
end

Now 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>YankCode

The 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.

About

A vim plugin to yank code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published