Sublime Forum

System for Managing OS Specific Settings

#1

I want to get a feel if anyone is actually interested in this. I have been working on plugin that can backup up your settings based on the OS platform you are working on. It can also automatically copy them over.

I store my settings on github, but ST2 settings or even certain plugins settings may differ for me depending on the OS I am working on.

The way the plugin currently works, is that you define a number of files/directory you want to backup for a specific platform. If they have never been backed up for that OS, it will back them up on the next restart of ST2. This also allows me to clone by User folder from github on a new system, and all of my settings for that OS automatically get copied over from backup if the files do not exist.

Also, at any time you can use a command to force a backup of all files/directories if you made changes to the current working one, or you can use a command to copy over your current working one with your backup (like if you made some changes in the repository and you just fetched them and you want to copy them over).

It could be added to Package Control, but if you are like me, and install different plugins depending on your OS platform, you would probably want to back up your Package Control setting file for each OS creating a catch 22. I personally just drop the plugin directly into my User folder.

Anyways, I plan on adding one more command to remove orphaned backed up files, then if there is some interest, I will post it here on the forums. If there is no interest, no worries; I created it for my own use, but then I decided some people might like to use it as well. Anyways, if your interested, let me know.

0 Likes

Per OS settings
User Prefs Repo
#2

I realize this was a long time ago, but I would be very interested in this plugin.

0 Likes

#3

ST2: github.com/facelessuser/sublime … r_files.py
ST3: github.com/facelessuser/sublime … r_files.py

Example setting file is the same for either ST2 or ST3. An empty one gets created by the plugin automatically, but you can look at mine to see how I use it.
github.com/facelessuser/sublime … e-settings

Basically I store my User folder on Github. So if I install Sublime Text on a computer, I simply clone my User folder to replace the default User folder and then fire up Sublime Text and install package control, restart, and package control starts downloading all of my plugins.

OsSpecificSettings plugin allows me to define which files to backup by running the backup command. That way I can backup different package control settings that download different plugins for different platforms (amongst other things). That way, when I install a Sublime Text on my system, and drop in my User folder from github and fire up Sublime Text, OsSpecificSettings notices that I am missing the backed up files and starts copying them to the appropriate places automatically. Then I just install PackageControl, and Package Control pulls down all my plugins and everything works just like it should (though I may have to restart after doing all of this). If I change a preference file, menu, or something else that I usually back up, I just run the backup command and commit back to github. (Keep in mind I only store the backed up version of my OS specific files, and not the functional one; you can see what I mean by exploring the repo the files are in above).

One thing to notice, on backup you can rename specific files; I always rename menu files because they are visible no matter how many folders they are buried down, so I just change their extension (you can see I do this in the example settings file; the rename key is what renames files).

Another thing to note, if you plan on modifying common files in your User folder (files that are not OS specific) make sure you do a sync before to prevent conflicts.

Anyways, I am sure all of this could be improved, but I have been using this for quite some time and have found it generally useful and it helps separate problematic OS specific stuff for me. Feel free to use it, comment on it etc. I cooked it up for personal use, but I am willing to add features if I think they would be beneficial. Because this is not an official released plugin, I may be picky on what I actually spend time on implementing.

0 Likes

#4

I was wondering if you thought it would be possible to make a package that would add the ability to add “(OSX)”, “(Windows)”, or “(Linux)” to any settings file, and have the plugin grab them, and intelligently merge the settings? I think it would be much more stable then this plugin, not to say this does not work. Anyway, I will probably see if Jon will add that in ST3.

Thanks for getting back to me!

0 Likes

#5

Sure, it could be done…kind of…but I don’t know how well it would work. You would have to make sure your plugin ran before others to merge before they access them etc. It would be better if Jon implemented platform specific settings interface for all plugins. I would throw away this plugin in a heartbeat if Jon implemented that functionality.

This plugin is a stop gap solution for me. It isn’t eloquent or anything, but it worked for me since there was no other reasonable solution for me. If I have a plugin I suspect will need multi-platform settings, I devise my settings accordingly when I design the plugin…but not everyone has done that…which is why I wrote this.

0 Likes