Skip to content
Sublime Text plugin that formats Rust code with rustfmt
Branch: master
Clone or download
mitranim improvements in flags, hotkeys, warnings
* no mandatory subprocess flags
* no mandatory hotkeys
* don't ignore rustfmt warnings
Latest commit 273c929 Jan 6, 2019


RustFmt is a Sublime Text 3 plugin that auto-formats Rust code with rustfmt or another executable.

Unlike BeautifyRust, it's fast and works on buffers that have yet not been saved as files. Unlike RustFormat, it preserves the buffer scroll position. It also supports rustfmt.toml.


Requires Sublime Text version 3124 or later.

Requires rustfmt to be on PATH. Installation:

rustup component add rustfmt


Package Control

  1. Get Package Control
  2. Open command palette: Shift+Super+P or Shift+Ctrl+P
  3. Package Control: Install Package
  4. RustFmt


  1. Open Sublime Text menu → Preferences → Browse Packages. This should open the packages folder in your OS file manager.

  2. Clone repo:

git clone RustFmt


By default, RustFmt will autoformat files before saving. You can trigger it manually with the RustFmt: Format Buffer command in the command palette.

If the plugin can't find the executable:

  • run which rustfmt to get the absolute executable path
  • set it as the executable setting, see Settings below

On MacOS, it might end up like this:

  "executable": ["/Users/username/.cargo/bin/rustfmt"]

Can pass additional arguments:

  "executable": ["rustup", "run", "nightly", "rustfmt"]


See RustFmt.sublime-settings for all available settings. To override them, open:

Preferences → Package Settings → RustFmt → Settings

RustFmt looks for settings in the following places:

  • "RustFmt" dict in general Sublime settings, possibly project-specific
  • RustFmt.sublime-settings, default or user-created

The general Sublime settings take priority. To override them on a per-project basis, create a "RustFmt" entry:

  "RustFmt": {
    "format_on_save": false


In Sublime's command palette:

  • RustFmt: Format Buffer


To avoid potential conflicts, this plugin does not come with hotkeys. To hotkey the format command, add something like this to your .sublime-keymap:

  "keys": ["ctrl+super+k"],
  "command": "rust_fmt_format_buffer",
  "context": [
      "key": "selector",
      "operator": "equal",
      "operand": "source.rust"


You can’t perform that action at this time.