Skip to end of metadata
Go to start of metadata

Overview

Sometimes you want a snippet, command, sample, or another item to only appear on certain platforms. To do so, you can use some platform specifiers.

Wrapping an item in a per-platform conditional

In the example below, we only want the sample to appear on OSX.

Platform

Test

Windows

is_windows?

Windows XP

is_windows_xp?

Windows Vista

is_windows_7?

Windows 7

is_windows_vista?

OS X

is_mac?

Unix (includes Linux)

is_unix?

Specifying per-platform options

Sometimes, you want an item to be bound to a different key per-platform. That can be done by using the PLATFORM_SPECIFIER. However, you could accomplish the same thing by conditionally setting the property using the same syntax as above with Ruble.is_mac, for example.

Currently, only the following properties support platform specifiers:

  • key_binding
  • invoke

Alternatively, you could also wrap the setting of various properties in conditionals that test the platform using the calls from the previous section.