Skip to content

Commit

Permalink
make create partial from selection even simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
vann committed Oct 22, 2010
1 parent e879eb0 commit e9268b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Commands/Make Selection in to Partial.plist
Expand Up @@ -13,7 +13,7 @@
<key>input</key>
<string>document</string>
<key>keyEquivalent</key>
<string>^H</string>
<string>^~@</string>
<key>name</key>
<string>Create Partial From Selection</string>
<key>output</key>
Expand Down
12 changes: 3 additions & 9 deletions Support/bin/create_partial_from_selection.rb
Expand Up @@ -26,16 +26,10 @@
path = current_file.dirname
partial = File.join(path, "_#{partial_name}#{ext}")

# Create the partial file
# Go to the partial if it already exists
if File.exist?(partial)
unless TextMate::UI.request_confirmation(
:button1 => "Overwrite",
:button2 => "Cancel",
:title => "The partial file already exists.",
:prompt => "Do you want to overwrite it?"
)
TextMate.exit_discard
end
TextMate.open partial
TextMate.exit_discard
end

file = File.open(partial, "w")
Expand Down

0 comments on commit e9268b9

Please sign in to comment.