A custom syntax highlighting plugin for the Sway programming language in Sublime Text. This plugin provides highlighting for Sway's syntax elements, including keywords, types, functions, structs, attributes (e.g., #[storage(read, write)]
, #[payable]
), storage blocks, and more. It includes a tailored Monokai dark color scheme with vibrant colors for better readability.
- Syntax Highlighting: Covers Sway-specific elements like
contract;
,storage { ... }
,impl ... for ...
, asm blocks, and fixed-size strings (str[8]
). - Custom Scopes: Keywords in magenta, types in cyan, functions in green, fields and parameters in orange, attributes with neon purple brackets,
storage
andpayable
in blue,read
andwrite
in cyan. - Nested Support: Proper highlighting inside structs, storage/configurable blocks, function bodies, and attributes.
- Theme Integration: A modified Monokai scheme (
Sway-Monokai.sublime-color-scheme
) optimized for dark mode. - File Association: Automatically applies to
.sw
files.
-
Open Sublime Text and navigate to your User packages directory:
- macOS:
~/Library/Application Support/Sublime Text/Packages/User/
- Windows:
%APPDATA%\Sublime Text\Packages\User\
- Linux:
~/.config/sublime-text/Packages/User/
- macOS:
-
Create a new folder named
Sway
(optional, but recommended for organization). -
Copy the following files into the folder:
Sway.sublime-syntax
: The main syntax definition file.Sway-Monokai.sublime-color-scheme
: The custom color scheme file.
-
Restart Sublime Text.
-
Select the Color Scheme:
- Go to Preferences > Color Scheme and choose "Sway-Monokai".
-
Associate File Extension:
- Open a
.sw
file. - If not automatically detected, go to View > Syntax > Sway.
- Open a
MIT License. See LICENSE for details.