All Projects → AaronLasseigne → yank-code

AaronLasseigne / yank-code

Licence: MIT license
A vim plugin to yank code.

Programming Languages

Vim Script
2826 projects

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].