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!
Plug 'AaronLasseigne/yank-code'
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.