Skip to content

Commit

Permalink
Modified "Choose Categories" to allow additions after running.
Browse files Browse the repository at this point in the history
If you place your cursor at the beginning of the category list, after the header and following space (categories: ) and trigger the command with the tab key, it will determine that there are existing categories, insert the appropriate separator (;) and check to make sure categories aren't repeated.
  • Loading branch information
ttscoff committed May 23, 2009
1 parent ece170a commit 26ff4b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Commands/Choose Categories.tmCommand
Expand Up @@ -79,12 +79,17 @@ TextMate.exit_insert_text "categories: " if res['returnButton'] == "Cancel"
# TextMate.exit_show_tool_tip "nothing returned" unless res.has_key? 'selectedMenuItem'
returnedcats = res['result']['returnArgument']
catlist = ''
unless $line.empty?
existing_cats = $line.split(';')
returnedcats.delete_if {|cat| existing_cats.include? cat}
end
returnedcats.map {|cat|
catlist += ";" unless catlist == ''
catlist += cat
}
print "categories: " unless $line =~ /^[Cc]ategories\:(.*)?/
print "#{catlist.chomp}"</string>
print "#{catlist.chomp}"
print ";" unless $line.empty?</string>
<key>input</key>
<string>document</string>
<key>name</key>
Expand Down

0 comments on commit 26ff4b3

Please sign in to comment.