Hiya Everybody,

I’m trying to group commands in a bundle, and to create directions for others on how to do so. Unfortunately I’ve been unable to successfully move a single bundle item.

I feel like I’m very close, and I wonder if anyone could tweak these steps to make it work. 

Please and thanks!

How to move, order or group bundle items in a TextMate 2 Bundle?

** Disclaimer: This does not work**

It seems that it is a manual process of editing a info.plist, using uuidgen on you script to generate the correct uuid for the info.plist. 

http://textmate.1073791.n5.nabble.com/Submenus-in-bundles-and-the-info-plist-td26547.html

But others indicate this is less than successful.

http://superuser.com/questions/405782/is-it-possible-to-rearrange-commands-and-snippets-inside-of-a-bundles-menu-acti


This is what is suggested by all the research I could find (Linked below). I'm leaving it here in hopes that someone can more easily find the missing piece and improve it. I've even sent a copy along to the TextMate Mailing List to see if they can find the flaws.

First back up your bundle. Then using XCode's plist editor, open your bundle's info.plist.

Creat this structure if you dont already have it.

1. Right click -> Add Row -> "mainMenu".
2. Change "mainMenu"'s type to Dictionary.
3. Create nested items "submenus", "items", and "excludedItems", changing "submenus" and "excludedItems" to "Dictionary" and "items" to Array as you go
4. Open Terminal.app and run the command `uuidgen`
5. Copy the output.  (from now on called [UUID#1])
6. Create a new item under "submenus", naming it by pasting [UUID#1]
7. Change [UUID#1]'s type to Dictionary.
8. Add a child to [UUID#1] named "name", set its value to "Network Scripts" (or whatever)
9. Add a child to [UUID#1] named "items", set its type to Array
10. Add items using the (+) button, each item is a UUID from your commands. To get this UUID, open the command's file in TextMate. If you try to Open the .tmCommand file directly TextMate will complain, "The bundle item [Bundle Item]; is already installed". 

  a) You can simply open the Commands folder, and textmate won't mind opening the files from the file drawer.

  or

  b) or `mate ~/Library/Application Support/Avian/Bundles/[Your Bundle]/Commands/[Your Command]. 

11. When the file is open find these lines. You're string will be different but formatted the same.

    <key>uuid</key>
   <string>8E9BA0D3-E282-4516-8565-E920EA98C898</string>
  This is the UUID for your command. Now known as [UUID#2]

12. Go back to the info.plist, in step 9 you created a "items" array, add [UUID#2] to the array.
13. Add [UUID#2] to a “ordering" (type Array) object on the root of the xml.
14. Repeat 10 - 13 to add multiple items.
15. Save.




 
Graham P Heath