Files
atom/bundles/text.tmbundle/Commands/Duplicate Line.plist
Corey Johnson & Nathan Sobo f84f9c5dd2 Add bundles and themes
2012-08-27 13:20:22 -07:00

39 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby -wKU
# If theres a selection, output that twice (as a snippet)
# leaving the duplicate as the new selected text.
# Otherwise split the current line around the caret and
# output “right, left” to duplicate the line, leaving the
# caret in the same place on the new line
require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb")
require File.join(ENV["TM_SUPPORT_PATH"], "lib/escape.rb")
if ENV['TM_SELECTED_TEXT'] != nil
TextMate.exit_insert_snippet(e_sn(ENV['TM_SELECTED_TEXT']) + "${0:" + e_snp(ENV['TM_SELECTED_TEXT']) + "}")
else
col = ENV['TM_LINE_INDEX'].to_i
TextMate.exit_insert_text(ENV['TM_CURRENT_LINE'][col..-1] + "\n" + ENV['TM_CURRENT_LINE'][0...col])
end</string>
<key>fallbackInput</key>
<string>none</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^D</string>
<key>name</key>
<string>Duplicate Line / Selection</string>
<key>output</key>
<string>afterSelectedText</string>
<key>uuid</key>
<string>C46A9DBC-0B06-49DF-838B-491B529ECF22</string>
</dict>
</plist>