When a plugin uses a pairing of one or more configuration files, why is it they aren’t using the edit_settings command which opens the settings window with a base / left and user / right configuration window? It is a lot easier for the end-user to navigate and use especially because the menu closes after clicking on a settings entry in the plugin menu hidden in nested menus layers deep… If a plugin has 5 or so configuration files and they don’t use edit_settings command, then the user has to navigate through the menu 10 times and click on 10 entries. It isn’t much better using edit_settings because they have to navigate through 10 times…
Isn’t it better to navigate through 1 time and click on 1 thing and open every setting? As an option, I think it does… It can also help developers and end-users by opening all of the keybind and mousebind files, along with all default configuration files for Sublime Text, and have another for the plugin…
Anyway, I posted a while back about edit_settings_plus - a command I am developing which allows opening one to many files in a single configuration window… As of right now, it is still stand-alone and can be incorporated into any plugin provided permission is asked to do so. I am considering dropping that stipulation, but if a plugin makes money, that would be another story. If Sublime Text wants to incorporate this into the core program, contact me - I think it would be beneficial to everyone and proper documentation needs to be supplied along with examples so developers know about it as an option, enough of them don’t know about edit_settings and opt for open_file instead which makes it difficult on the end-users, especially if someone has a deficit such as carpal-tunnel syndrome or something else. Sublime has done a great job with pretty much every single other aspect of the program to make it usable with the keyboard only, why make opening configuration files this hard ( This is on devs for not using edit_settings as much as it is on Sublime Text for the lack of information / examples, and because it doesn’t support multiple files )?
The primary features are:
- Stand-Alone: It requires no add-on libraries meaning if included in a package, that package doesn’t need .no-sublime-package – it does require zipfile and a few other imports, but those are included with Sublimes version of Python - it doesn’t require my Library as a lot of the functionality was stripped out to keep it stand-alone for the time being… This will change soon because the line count will go down when using my library and I already use it for my addon…
- Backwards Compatible: This addon has been designed to be backwards compatible with the edit_settings command - so you can change existing calls to edit_settings_plus without losing anything, then… from there, you can start using new features!
- Ease of Use: With a single command call, one to many files can be opened, designated in the base / left or user / right side.
- Default / Base File Protection: Base files can be editable if the developer argument is set to True to protect files from being edited when released
- Default / Base File Protection: Save protection - if developer mode is disabled, files on the left / base group can’t be edited, they are marked as readonly… If developer mode is enabled, then they may be edited. The one exception is for files which were read from a package. I may allow editing packaged files at some point…
- Space Optimization: If only one file is opened, the other group collapses automatically to reduce wasted space - unlike edit_settings, you can open a single file or a single group without the window closing.
- File Linking: If you click on one file opened with a paired file, they are linked so when it is clicked on base or user side of the window, it will open on the opposite side. Files with the same name are also linked, even if they haven’t been opened together. It is always best to open them together though.
- Linked File-Closing: If you close a file which is linked, then the linked file will close too.
- Packed File Opener: Opening archived / packaged files has now been incorporated - you can force it by using the file location res://Packages/PackageName/Path/To/File.ext or res://PackageName/Path/To/File.ext - you can also use the standard path and if it doesn’t exist, it’ll check to see if a package exists and if it exists in the package it’ll be loaded from there
- Extended Variables / Shorter File-Names / Dynamic File Contents: A large list of extended variables which can be used in file-names and in files which are opened to reduce repetition and find files much faster than before! They can be used to open files including the install directory, packages dir, user dir, and so much more… making linking to files that much easier - I plan on adding more to link to default files directly such as Preferences, Preferences for the OS, Key Binds and more…
- Mark New Files as Unedited: Scratch system so if a file doesn’t exist on the user side, the default contents are set and the file isn’t marked as unedited unless the user edits it - the same is true for the left / base side unless developer mode is enabled so extracted files show up as unedited
Where can I get it?
Currently it is in my Plugin which can be found here ( And it may be on Package Control already ): https://bitbucket.org/Acecool/AcecoolCodeMappingSystem
Play around with it, and if you want to include it with your plugin, send me a message!
Special Notes regarding operation of the plugin:
- You must use the same number of entries in base_file, user_file, and default entries if they are lists in the edit_settings style format – Use None entries if you have more base / user files than the other or default… The number of entries should be the same as the largest list. If you use file_list, then you simply add entries with or without one or the other, or with both, base / user file and you don’t have to worry about it.
- You are not required to have a user and base file in each file_list entry.
- Do not add base_file, user_file and file_list… Use either base_file and user_file pairing OR file_list. I may add support for everything to be added at some point, but for now, it isn’t officially supported.
- You can set base_file and user_file to load files along with file_list, but I recommend using file_list OR base_file and / or user_file pairing.
- A few print statements are enabled by default and are only called in specific instances: One is called when creating links between base / user files, and another is output when closing linked views when either is closed.
What are the ${x} arguments I can use when using the edit_settings_plus style command format inside of files or for use in file-names?
Note: These arguments are the base-level arguments… These are not for within file_list although most will work, I’ll create an extra list for those…
Note: * means it is planned.
ie:
self.window.run_command(
'edit_settings_plus',
{
'argument_1': value_1,
'argument_2': value_2,
'argument_3': value_3
}
);
- base_file: This corresponds to the edit_settings base style command format - it can be a single string filename, or a list of base / left side grouped files… - These arguments, as lists, must have the same number of entries - None can be used as an entry to ensure the same number of entries.
- base: This is an alias of base_file - Note: This can not be used in conjunction with base_file… Use one or the other.
- user_file: This corresponds to the edit_settings base style command format - it can be a single string filename, or a list of user / right side grouped files. - These arguments, as lists, lists must have the same number of entries - None can be used as an entry to ensure the same number of entries.
- user: This is an alias of user_file - Note: This can not be used in conjunction with user_file… Use one or the other.
- default: This defines the default contents to use for a user file. Note: If file_list is used and this is defined, then if default or contents isn’t set for an entry, then this is used instead…
- default_user: This is an alias of default Note: If file_list is used and this is not defined, then if default or contents or default_user or contents_user isn’t set for an entry, then this is used instead…
- default_base: This defines default contents to use for a default file if the file doesn’t exist. Note: If file_list is used and this is not defined, then if default_base or contents_base isn’t set for an entry, then this is used instead…
- contents: This is an alias of default - Note: This can not be used in conjunction with default. Use one, or the other.
- contents_user: This is an alias of default_user - Note: This can not be used in conjunction with default. Use one, or the other.
- contents_base: This is an alias of default_base - Note: This can not be used in conjunction with default. Use one, or the other.
- syntax: This forces a syntax to be assigned for highlighting the loaded file - this affects the User and Base files.
- syntax_user: This forces a syntax to be assigned to the User file only. Note: If file_list is used and this is defined, then if syntax or syntax_user isn’t set for an entry, then this is used instead…
- syntax_base: This forces a syntax to be assigned to the Base file only. Note: If file_list is used and this is defined, then if syntax or syntax_base isn’t set for an entry, then this is used instead…
- repo: This is used to populate the ${repo} data so you can set up links to ${repo}/issues/new/ without repeating yourself - this can be used in file bodies too!
- package: This can be automatically populated if you use the supplied code in your package ( The supplied code is part of edit_settings_plus.py - it will report the package name of the package where it was included from, so if you don’t want to be required to manually set the package name for each command, you need to include edit_settings_plus from your package ), however if you don’t then when using it, it will show up as MyPackage or something similar… You can manually input the data - for instance, I would use AcecoolCodeMappingSystem for my current package.
- file_list: This is a Dictionary argument, it can contain Dictionary Entries with any of the previous arguments, except base_file and user_file must be a single string filename. - I may add support for these to be lists at a later point, but for now, they’re not set up that way.
- files: This is an alias of file_list
- developer: This enables developer mode, if set to True - default is False. When developer mode is active, additional features are enabled and some are disabled. For instance, Base files, when developer mode is disabled, are set to ReadOnly - but when developer mode is enabled, Read Only is disabled so the package developer can make changes to the file.
- debugging: When debugging is set to True, internal print statements are triggered and output to the console to show how edit_settings_plus is running, what it is doing, etc… Helpful if there are problems so you can see exactly where an issue is happening.
- view: If not defined, the Active View from the Active Window is used. These are used to define the View which was used to call the command - this is important if you want to grab the view settings for syntax, for instance. These are passed through to ExtractVariables and this one returns _view.settings( ); for syntax. In this case, if we want to get the syntax settings file for the view we called edit_settings_plus from so it can be opened, this lets us do it or lets us redirect it to some other view we want the syntax information from…
- window: If not defined, the Active Window is used. These are used to define the Window which was used to call the command - this is important if you want to grab window properties. These are passed through to ExtractVariables and this one returns _window.extract_variables( ); This provides a lot of information, namely the details for the Project, workspace, session, etc…
- sidebar: This is used to define whether or not the sidebar should be opened in the newly created Settings Window. By default, this is set to False meaning the sidebar will be hidden in the settings window.
- minimap: This is used to define whether or not the minimap is visible in the newly created Settings Window. By Default, this is True.
What are the ${x} arguments I can use when using the edit_settings_plus style command format inside of a file_list entry?
ie:
self.window.run_command(
'edit_settings_plus',
{
'file_list':
[
{ 'entry_1_arg_1': entry_1_arg_1_value, 'entry_1_arg_2': entry_1_arg_2_value, 'entry_1_arg_3': entry_1_arg_3_value },
{ 'entry_2_arg_1': entry_2_arg_1_value, 'entry_2_arg_2': entry_2_arg_2_value, 'entry_2_arg_3': entry_2_arg_3_value },
{ 'entry_3_arg_1': entry_3_arg_1_value, 'entry_3_arg_2': entry_3_arg_2_value, 'entry_3_arg_3': entry_3_arg_3_value }
]
}
);
- base_file: This corresponds to the edit_settings base style command format - it can be a single string filename, or a list of base / left side grouped files… - These arguments, as lists, must have the same number of entries - None can be used as an entry to ensure the same number of entries.
- base: This is an alias of base_file - Note: This can not be used in conjunction with base_file… Use one or the other.
- user_file: This corresponds to the edit_settings base style command format - it can be a single string filename, or a list of user / right side grouped files. - These arguments, as lists, lists must have the same number of entries - None can be used as an entry to ensure the same number of entries.
- user: This is an alias of user_file - Note: This can not be used in conjunction with user_file… Use one or the other.
- default: This defines the default contents to use for a user file. Note: inside of a file_list entry - if default is not defined for the entry, but it is defined outside of the file_list then the entry inherits the value from the global setting - this is so you can define a single base, if you want, and use variables inside of the file to make it fit the file itself…
- default_user: This is an alias of default Note: inside of a file_list entry - if default_user is not defined for the entry, but it is defined outside of the file_list then the entry inherits the value from the global setting - this is so you can define a single base, if you want, and use variables inside of the file to make it fit the file itself…
- default_base: This defines default contents to use for a default file if the file doesn’t exist. Note: inside of a file_list entry - if default_base is not defined for the entry, but it is defined outside of the file_list then the entry inherits the value from the global setting - this is so you can define a single base, if you want, and use variables inside of the file to make it fit the file itself…
- contents: This is an alias of default - Note: This can not be used in conjunction with default. Use one, or the other.
- contents_user: This is an alias of default_user - Note: This can not be used in conjunction with default. Use one, or the other.
- contents_base: This is an alias of default_base - Note: This can not be used in conjunction with default. Use one, or the other.
- syntax: This forces a syntax to be assigned for highlighting the loaded file - this affects the User and Base files.
- syntax_user: This forces a syntax to be assigned to the User file only. Note: If file_list is used and this is defined, then if syntax or syntax_user isn’t set for an entry, then this is used instead…
- syntax_base: This forces a syntax to be assigned to the Base file only. Note: If file_list is used and this is defined, then if syntax or syntax_base isn’t set for an entry, then this is used instead…