Sublime Forum

Per OS settings

#1

I’m using Dropbox to synchronize my Sublime Text 2 settings, and I’ve noticed a small issue. I use Sublime Text 2 on both Windows and OSX, and my font is Inconsolata, size is 18.

However, Inconsolata @ 18 on OSX is much, much smaller than on Windows. So my question is, is there some way to detect which OS Sublime is running on in the settings file?

0 Likes

#2

I’ve asked same question before but didn’t got any answer.
I almost got used to changing font size every time I switch systems (cmd +/- or ctrl +/- shortcut make it fairly painless).

But would welcome a system specific options very much.

0 Likes

#3

Actually, now that I look, there are system specific preferences in use.

Packages/Default/Preferences.sublime-settings
Packages/Default/Preferences (OSX).sublime-settings
Packages/Default/Preferences (Windows).sublime-settings
Packages/Default/Preferences (Linux)

So if you remove font-size setting from your user preference file (Packages/User/Preferences.sublime-settings) and just modify font-size in system specific preferences then you (and I) should be able to keep them different on different systems.

The problem is that it seems like system specific preferences aren’t picked up when in User directory. Copying these system specific files to Packages/User/ and changing there has no effect. So if Sublime ever decides to update these files, customized font-size will be lost.

Also if you by any chance trigger font-size change using cmd +/- then the setting will be written into /User/Preferences.sublime-settings and will override every other setting.

1 Like

#4

The same problem here, it’s will be great to have the Default dir behavior for Preferences.sublime-settings in User package dir, so it’s can be OS specific.

0 Likes

#5

Has anyone come up with a workaround for this? Can this be considered a bug, or are we misunderstanding how this should work?

0 Likes

#6

Still does this, would be nice to be able to have per platform accessible via user.

0 Likes

#7

My workaround is as follows:

  • Packages/User/Preferences.sublime-settings
  • Packages/User (OS Settings)/Preferences (Linux).sublime-settings
  • Packages/User (OS Settings)/Preferences (Windows).sublime-settings

(You can call the folder whatever you want; as long as it’s not “User” :smile:

There are two issues with this setup:

  1. If you’re syncing settings, you’ll need to sync an additional folder. (@wbond recommends that you only sync the User folder. I actually sync the whole Packages folder, because that’s where I keep my own packages, so I don’t mind.)
  2. Settings in User will override settings in User (OS Settings). I use these files to setup fonts, so I have simply omitted these settings from my general settings. Because, as @rchl points out, it’s easy to change the font size by mistake, I have actually unbound all shortcuts for these:

Add these to User/Default.sublime-keymap (so that they will work in all OSs):

    // Unbind increase/decrease font size
    { "keys": "ctrl++"], "command": "unbound" },
    { "keys": "ctrl+="], "command": "unbound" },
    { "keys": "ctrl+keypad_plus"], "command": "unbound" },
    { "keys": "ctrl+-"], "command": "unbound" },
    { "keys": "ctrl+keypad_minus"], "command": "unbound" },
    { "keys": "ctrl+equals"], "command": "unbound" },
    { "keys": "ctrl+shift+equals"], "command": "unbound" },
    { "keys": "ctrl+keypad_plus"], "command": "unbound" },
    { "keys": "ctrl+shift+keypad_plus"], "command": "unbound" },

And these to User/Default.sublime-mousemap:

    // Stop Ctrl+Scroll Wheel from changing the font size
    { "button": "scroll_down", "modifiers": "ctrl"], "command": "unbound" },
    { "button": "scroll_up", "modifiers": "ctrl"], "command": "unbound" },

I hope this helps some poor souls :smile:

Oh, BTW, the bindings are for Win/Linux. You may need to tweak them for OSX.

@randy3k has recently released a new settings manager here:
github.com/randy3k/SyntaxMgr

It doesn’t support OS, but it support pretty much everything else. I thought I’d pester him about it, but then decided not to, because the only use case I have is for fonts, and I’ve resolved that as above. If you have other use cases though, it might be useful to open that issue.

Alex

1 Like

#8

[quote=“quodlibet”]My workaround is as follows:

  • Packages/User/Preferences.sublime-settings
  • Packages/User (OS Settings)/Preferences (Linux).sublime-settings
  • Packages/User (OS Settings)/Preferences (Windows).sublime-settings

(You can call the folder whatever you want; as long as it’s not “User” :smile:

There are two issues with this setup:

  1. If you’re syncing settings, you’ll need to sync an additional folder. (@wbond recommends that you only sync the User folder. I actually sync the whole Packages folder, because that’s where I keep my own packages, so I don’t mind.)
  2. Settings in User will override settings in User (OS Settings). I use these files to setup fonts, so I have simply omitted these settings from my general settings. Because, as @rchl points out, it’s easy to change the font size by mistake, I have actually unbound all shortcuts for these:

Add these to User/Default.sublime-keymap (so that they will work in all OSs):

    // Unbind increase/decrease font size
    { "keys": "ctrl++"], "command": "unbound" },
    { "keys": "ctrl+="], "command": "unbound" },
    { "keys": "ctrl+keypad_plus"], "command": "unbound" },
    { "keys": "ctrl+-"], "command": "unbound" },
    { "keys": "ctrl+keypad_minus"], "command": "unbound" },
    { "keys": "ctrl+equals"], "command": "unbound" },
    { "keys": "ctrl+shift+equals"], "command": "unbound" },
    { "keys": "ctrl+keypad_plus"], "command": "unbound" },
    { "keys": "ctrl+shift+keypad_plus"], "command": "unbound" },

And these to User/Default.sublime-mousemap:

    // Stop Ctrl+Scroll Wheel from changing the font size
    { "button": "scroll_down", "modifiers": "ctrl"], "command": "unbound" },
    { "button": "scroll_up", "modifiers": "ctrl"], "command": "unbound" },

I hope this helps some poor souls :smile:

Oh, BTW, the bindings are for Win/Linux. You may need to tweak them for OSX.

@randy3k has recently released a new settings manager here:
github.com/randy3k/SyntaxMgr

It doesn’t support OS, but it support pretty much everything else. I thought I’d pester him about it, but then decided not to, because the only use case I have is for fonts, and I’ve resolved that as above. If you have other use cases though, it might be useful to open that issue.

Alex[/quote]

Thanks this this great, but doesn’t help me. I am syncing across multiple machines & platforms, and only sync my User folder and let package control pick up the packages. This wouldn’t work at least without doing it individually on each machine, which I would prefer not to do but would work if I had to.

This has been reported a long time ago and still seems to be the way it is, yet the documentation explains it like this is in fact possible, using OS settings in the User folder.

0 Likes

#9

Yes, it would be better if it was resolved.

FWIW, I’ve found that syncing just the User folder is not that workable. For example, one of the things that is really useful (in ST3) is to be able disable default keybindings by placing empty files like so:
Packages/Annoying Plugin/Default.sublime-keymap (or whatever).

I’ve had no problems going between Linux and Windows, with the whole Packages folder synced. (But have not tested with OSX.)

Just my two cents,
Alex

1 Like

#10

[quote=“quodlibet”]Yes, it would be better if it was resolved.

FWIW, I’ve found that syncing just the User folder is not that workable. For example, one of the things that is really useful (in ST3) is to be able disable default keybindings by placing empty files like so:
Packages/Annoying Plugin/Default.sublime-keymap (or whatever).

I’ve had no problems going between Linux and Windows, with the whole Packages folder synced. (But have not tested with OSX.)

Just my two cents,
Alex[/quote]

Most packages will sync perfectly fine across platform, but there are some that will not. I used to sync the entire folder, but now I only sync User and it works really well.

As for voiding out the default keymaps, I can override anything I want in User, I have no need to null them all out, so that’s not a big deal to me.

0 Likes

#11

I also just sync my user folder. Most settings universally sync across platforms with no problem. But there are certain settings that don’t. I wrote up a plugin for personal use to handle certain settings files like preferences.sublime-settings and others. What it does is allow you to specify certain files that are specific for a platform. I just drop the plugin in my user folder, and setup my list of OS specific files. With a shortcut, I can back up all of those files into os specific folders in my User folder. I can also deploy them with a shortcut (after I have synced my User folder via github). When I want to sync a new virgin system, all I have to do is check out my user folder. The plugin will see no files have been unpacked yet, so it will unpack them by itself.

Yes, it is all a bit elaborate, but it works for me. I would love to see OS specific settings recognized for all settings files, but as a stop gap solution, this plugin works for me.

The thread where I share links etc. is here System for Managing OS Specific Settings

0 Likes

#12

Any update on this? Documentation makes it seem like you can customize per OS, but in reality it does not work unless you edit the default files (which will be overwritten with each update).

0 Likes

#13

I just had an idea, but it’s probably stupid:

Have you tried making subfolders in User, such as User/OS/Linux, etc. and then symlinking them from outside the User folder? So that Packages/OS/Linux will point to User/OS/Linux and so on?

If this works (and I haven’t tested it), you would need to create the symlinks on all your machines, but at least the settings will sync.

0 Likes

#14

Actually it’s not stupid at all.

I just tested it on Linux and it works just fine. I moved the settings in my Packages/OS folder under User and created a symlink to it from within Packages, thus:

Symlink: Packages/OS -> Packages/User/OS
Settings go in Packages/User/OS

This will sync just fine. Admittedly, you will need to create the symlink on every setup – but that’s not too much of a hassle (all things considered).

I will test on Win XP & 7 on Tuesday and let you know how it goes.

Alex

0 Likes

#15

Verified on Windows.

I think the time has come for me to stop syncing my entire Packages folder . . . only how do I then keep working on my crummy packages without pushing to GitHub all the time?

0 Likes

#16

Have you thought about using gists (tutsplus.com/lesson/sexy-code-s … ith-gists/).

0 Likes

#17

@owenleonard Sorry, but I don’t see how using gists (or any repo, for that matter) helps resolve the issue of this thread: that OS specific settings will be ignored when placed in Packages/User, which is the recommended folder to sync across Sublime installations.

0 Likes

#18

I found a plugin for doing per platform settings: github.com/randy3k/SyntaxMgr

0 Likes