Ah, my heart is pounding...I hadn't stumbled across TextMate::UI yet (actually, haven't really looked at programming textmate yet), so it's time to start!
Many thanks, Ken
Alex Ross wrote:
One thing I use snippets for is as a simple, convenient memory aid; for example, I currently have (most) of the Ruby standard exception types as snippets with the tab trigger "exception". So I type in "exception", tab, and get to choose which of the exceptions I really want to use.
However, defining and maintaining (in case changes are wanted) such a large number of small snippets is sorta annoying when going through the Bundle Editor. Is there a way to have multiple snippets in one file, including the various settings such as tab trigger, keyboard shortcut, etc.?
A better way to do this sort of thing is to write a command. Something like this:
#!/usr/bin/env ruby -wKU require "#{ENV['TM_SUPPORT_PATH']}/lib/ui" exceptions = [ 'Exception', 'AnotherException' ] index = TextMate::UI.menu(exceptions) STDOUT.write("${0:#{exceptions[index]}}")
Try creating a textmate command with these contents, set 'Input: None', 'Output: Insert as Snippet' and of course set Activation to 'Tab Trigger: exception'.
The command is attached as well.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate