I’m working on the settings port of my plugin and one thing is annoying - with the default edit_settings you can set a base_file, user_file and default ( and contents for some reason with other default commands ) but you can’t set base or user as a table to load multiple files…
This is problematic because each file extension I support would need its own menu item…
The way I have things set up now I have 3 primary settings files: Definitions ( so I don’t need a definitions python file and so other config files can read keys from this file for certain info ) which may or may not be a good idea, Main Plugin Settings ( for primary / main config of the plugin such as developer mode [ reloads core files if they’ve been edited ], debug mode [ enables / disables all print statements or those attached to a string id provided ] and more ), and Default Mapper Config ( basically the defaults all mapping configurations inherit from although inheritance is allowed all the way through - this is for the mapper or language being mapped name, the mapping class to use and more )
And right now there are 11 language config files + default ( and these, plus the 3 above have a Default / User variant ) for: default ( Which links to the same one above ), ahk, bat, C++, JavaScript, lua, MarkDown, PHP, Python, sublime-settings, TypeScript and Plain Text… Each one of these needs to exist because they need to specify the language name ( default or combined such as Lua because .lua extension supports Lua and Garry’s Mod Lua ), the class to use ( Default is the User class, Default is available which, unless the User class is edited, is the same as User because of pass-through / inheritance - and other project names… For Lua there is my framework, soon to be mappings for DarkRP and more… For JavaScript there is my framework mappings, and for Python there is the plugin mappings for the AccessorFunc Expansion, etc… - These files will be relatively small but can grow in size depending how much of the default config is changed…
Some will be redirects for example .htm will redirect to the .html file… when that’s supported… They also define which languages are used in that extension - PHP has 6 languages: PHP, HTML, CSS, JavaScript, RegEx( PHP Implementation and JavaScript Implementation ), and SQL…
Anyway, they all tie in together - the reason I don’t want them all in 1 file is because I tried that as a design mockup and it was just way too much data and too difficult to read despite laying it out in nested categories, etc… The file size without any real data ended up at about 30kb too…
So, back to the topic - since all of the configurations tie into each other, if they all open in the single window with a single command ( or at least split so with 1 command I can simply call the 3 primaries, then another can be the language files ),
I’m sure this is possible with a custom command ( seems UpperCamelCaseCommand translate to upper_camel_case in the file ) but I haven’t found any clear way to feed it a table…
This is my menu file:
//
// Acecool's Source Code Navigation System - Preferences / Menu system...
//
[ //
{
//
"id": "preferences",
//
"children":
[
//
{
//
"id": "package-settings",
//
"children":
[
//
{
//
"caption": "Acecool - Source Code Navigator / Source Code Tree Climber / CodeNode",
//
"children":
[
{ "caption": "-" },
//
// Key Bindings - Opens the XCodeMapper Additional Key-Defaults and the Currently used Windows / OSX / Linux Key-Bindings file the User uses so the user can add the keys to it if they want to change the default keys...
//
{
"caption": "Plugin Key Bindings",
"command": "edit_settings",
"is_visible": true,
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default (${platform}).sublime-keymap",
"user_file": "${packages}/User/Default (${platform}).sublime-keymap",
"default": "//\n// Acecool - Source Code Navigator - Keybinds - User\n//\n[\n\t$0\n]\n",
},
},
//
// Mapper Settings - This should open the Default XCodeMapper Mapping Settings and EVERY SINGLE LANGUAGE File...
//
{ "caption": "-" },
//
{
"caption": "Plugin Settings - Definitions",
"command": "edit_settings",
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default_PluginDefinitions.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/Default_PluginDefinitions.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator Plugin Definitions - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Plugin Settings - General",
"command": "edit_settings",
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default_PluginSettings.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/Default_PluginSettings.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator Plugin Settings - User\n//\n{\n\t$0\n}\n",
// "contents": "//\n// Acecool - Source Code Navigator Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{ "caption": "-" },
//
{
"caption": "Plugin Map Settings - Default",
"command": "edit_settings",
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default_MapSettings.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/Default_MapSettings.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - Globally Inherited Mapper Default Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
// Mapper Settings for ALL of the default mappers...
//
{
"caption": "Plugin Map Settings - File-Type Specific",
"id": "xcodemapper_all_mapper_settings",
"children":
[
//
{ "caption": "-" },
//
{
"caption": "Plugin Map Settings - Default",
"command": "edit_settings",
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default_MapSettings.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/Default_MapSettings.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - Globally Inherited Mapper Default Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{ "caption": "-" },
//
{
"caption": "AutoHotkey",
"command": "edit_settings",
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_ahk.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_ahk.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - ahk File Extension / AutoHotkey Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Batch File",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_bat.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_bat.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - bat File Extension / Batch File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "C++",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_cpp.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_cpp.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - cpp File Extension / C++ Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "JavaScript",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_js.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_jst.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - js File Extension / JavaScript Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Lua / Garry's Mod Lua",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_lua.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_lua.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - lua File Extension / Lua & Garry's Mod Lua Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "MarkDown",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_md.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_md.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - md File Extension / MarkDown Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "PHP",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_php.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_php.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - php File Extension / PHP ie HypertextPreProcessor Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Python",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_py.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_py.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - py File Extension / Python Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Sublime-Settings",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_sublime-settings.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_sublime-settings.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - sublime-settings File Extension / Sublime Text Settings File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "TypeScript",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_ts.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_ts.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - ts File Extension / TypeScript Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "Plain Text",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_txt.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_txt.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - txt File Extension / Plain Text File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
{ "caption": "-" },
],
},
//
// Mapper Settings for ALL of the default mappers...
//
{
"caption": "Plugin Map Settings - Upcoming Supported Types",
"id": "xcodemapper_all_mapper_settings",
"children":
[
//
{ "caption": "-" },
//
{
"caption": "ASP",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_asp.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_asp.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - asp File Extension / ASP Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "C",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_c.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_c.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - c File Extension / C Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "C#",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_cs.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_cs.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - cs File Extension / C# ie C Sharp Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "h",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_h.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_h.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - h File Extension / Header File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "html",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_html.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_html.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - htm, and html File Extensions / HT Markup Language Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "htm - redirects to html",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_html.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_html.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - htm, and html File Extensions / HT Markup Language Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "JSON",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_json_JSON.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_json_JSON.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - json File Extension / JSON Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "PIP",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_pip.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_pip.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - pip File Extension / PIP Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "sublime-keymap",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_sublime-keymap.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_sublime-keymap.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - sublime-keymap File Extension / Sublime Text Key Map File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "sublime-snippet",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_sublime-snippet.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_sublime-snippet.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - sublime-snippet File Extension / Sublime Text Snippet File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "sublime-syntax",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_sublime-syntax.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_sublime-syntax.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - sublime-syntax File Extension / Sublime Text Syntax File Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "tmLanguage",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_tmLanguage.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_tmLanguage.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - tmLanguage File Extension / tmLanguage Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "XML",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_xml.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_xml.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - xml File Extension / XML Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "YML",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/MapSettings_yml.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/MapSettings_yml.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - yml File Extension / YML Mapper Settings - User\n//\n{\n\t$0\n}\n",
},
},
//
{
"caption": "... and more!",
"command": "edit_settings",
//
"args":
{
"base_file": "${packages}/Acecool_CMS/settings/Default_MapSettings.sublime-settings",
"user_file": "${packages}/User/Acecool_CMS/Default_MapSettings.sublime-settings",
"default": "//\n// Acecool - Source Code Navigator - Globally Inherited Mapper Default Settings - User\n//\n{\n\t$0\n}\n",
},
},
],
},
//
{ "caption": "-" },
//
{
"caption": "Donate",
"command": "open_url",
"args":
{
"url": "https://paypal.me/Acecool",
},
},
//
{ "caption": "-" },
//
{
"caption": "Submit an Issue Report",
"command": "open_url",
"args":
{
"url": "https://bitbucket.org/Acecool/acecooldev_sublimetext3/issues/new",
},
},
//
{
"caption": "Download Latest Version - Direct Link",
"command": "open_url",
"args":
{
"url": "https://bitbucket.org/Acecool/acecooldev_sublimetext3/get/master.zip",
},
},
//
{ "caption": "-" },
//
{
"caption": "Change Log",
"command": "open_file",
"args":
{
"file": "${packages}/Acecool_CMS/changelog.md",
},
},
//
{
"caption": "Information",
"command": "open_file",
"args":
{
"file": "${packages}/Acecool_CMS/README.md",
}
},
//
{ "caption": "-" },
//
{ "caption": "-" },
]
}
]
}
]
}
]
Obviously more than needed - but I figure it’ll help those trying to set up custom commands to get the 2 files to launch ( Default and User when User doesn’t exist )… I’ve seen that tactic in about 5 plugins and it’s reinventing the wheel… edit_settings is a useful command but I’d like to extend it…
Going through the current menu system is cumbersome so I’d like to make it as easy and quick as possible - I may even make smaller categories later such as Markup / Stylizing languages ( HTML, MD, CSS, etc… ) and programming languages ( C++, C#, C, Java, etc… ) and I may even go so far as to have a third for higher up scripting languages ( Python, Lua, etc… ) but I’d like to get there first…
I haven’t found much in the way of extending this feature - only examples to recreate edit_settings in an odd way but it wasn’t obvious how the data was being processed…
Any help would be appreciated.