Lets say I¹m in an R file and I type ³todo² + tab, the TODO bundle inserts this:
# TODO
I want to be able to type ³todoc² + tab, and have this inserted:
# TODO code
Or, ³todoe²+ tab, and have this inserted:
# TODO edit
How can I edit the TODO bundle to be able to do this?
Thanks Ross
Select Bundle Editor from the application menu, this opens the Bundle Editor. Select Insert TODO List. Select All and Copy the command's code, I've included it here so theres no confusion:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb'
10.times do |n| start = ENV["TM_COMMENT_START#{"_#{n}" if n > 0}"].to_s.strip stop = ENV["TM_COMMENT_END#{"_#{n}" if n > 0}"].to_s.strip unless start.empty? || stop.empty? print "#{e_sn start}\n\tTODO $0\n#{e_sn stop}" exit end end
fallback = ENV['TM_COMMENT_START'].to_s.strip print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO " Now in the bundle editor select TODO -> Menu Actions, make a new bundle item (command + n), select Command from the drop down. Name it something appropraite, Insert TODO Code List perhaps.
Paste in the copied code, and change line 14 from
print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO" to
print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO Code" Now in the drawer, change Tab Trigger to your trigger, todoc for example. Now just make the rest of the settings for Insert TODO Code List match Insert TODO List's settings.
-- graham.p.heath@gmail.com
On April 30, 2014 at 1:23:24 PM, Ross Ahmed (rossahmed@googlemail.com) wrote:
Lets say I’m in an R file and I type “todo” + tab, the TODO bundle inserts this:
# TODO
I want to be able to type “todoc” + tab, and have this inserted:
# TODO code
Or, “todoe”+ tab, and have this inserted:
# TODO edit
How can I edit the TODO bundle to be able to do this?
Thanks Ross
_______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Works! Many thanks
Ross
From: "graham.p.heath@gmail.com" graham.p.heath@gmail.com Reply-To: TextMate users textmate@lists.macromates.com Date: Wednesday, 30 April 2014 20:18 To: TextMate users textmate@lists.macromates.com Subject: [TxMt] Re: TODO bundle
Select Bundle Editor from the application menu, this opens the Bundle Editor. Select Insert TODO List. Select All and Copy the command's code, I've included it here so theres no confusion: #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb'
10.times do |n| start = ENV["TM_COMMENT_START#{"_#{n}" if n > 0}"].to_s.strip stop = ENV["TM_COMMENT_END#{"_#{n}" if n > 0}"].to_s.strip unless start.empty? || stop.empty? print "#{e_sn start}\n\tTODO $0\n#{e_sn stop}" exit end end
fallback = ENV['TM_COMMENT_START'].to_s.strip print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO " Now in the bundle editor select TODO -> Menu Actions, make a new bundle item (command + n), select Command from the drop down. Name it something appropraite, Insert TODO Code List perhaps.
Paste in the copied code, and change line 14 from print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO" to print "#{e_sn fallback.sub(/.$/, '\0 ')}TODO Code" Now in the drawer, change Tab Trigger to your trigger, todoc for example. Now just make the rest of the settings for Insert TODO Code List match Insert TODO List's settings.
On 1 May 2014, at 2:18, graham.p.heath@gmail.com wrote:
Select Bundle Editor from the application menu, this opens the Bundle Editor. Select Insert TODO List. Select All and Copy the command's code, I've included it here so theres no confusion: […]
It’s worth mentioning that this command does more than insert ‘# TODO’: It uses the comment markers defined for the current language (scope) and if there are block comment markers, it will prefer them, e.g. inserting:
/* TODO ‸ */
If all you need is to (always) insert ‘# TODO edit’ then a snippet is more appropriate: http://manual.macromates.com/en/snippets