Sublime Forum

Standardrb --fix

#1

Is it possible to create a shortcut that runs a command on the current file?
I want a shortcut that runs ‘standardrb --fix CURRENT_FILE’.

0 Likes

#2

Or run on save would be also nice

0 Likes

#3

This is what build systems are for; choose Tools > Build System > New Build System from the menu and replace the stub content with the following, and then save it in the location Sublime will offer with a name of your choosing (make sure it has the sublime-build extension):

{
    "shell_cmd": "standardrb --fix \"${file}\"",
    "selector": "source.ruby"
}

Make sure that in Tools > Build System that the checkmark is next to either Automatic or the entry with the name you saved the file as, and then while you’re editing one of your files you can use Tools > Build or the key binding associated with it (visible in the menu) to run the command.

0 Likes