Using external code editors ↩
RoboFont provides its own Scripting Window for writing and running scripts. Thanks to the RoboFont shell command, you can also use an external code editor to write your scripts and have them execute inside RoboFont.
Installing RoboFont as a shell command
In order to use your code editor’s build system with RoboFont, you’ll need to install the RoboFont shell command first. To do that, go to Preferences > Extensions > Shell and click on the Install button.
To check if the command is working: open the Terminal, type robofont -h
and hit return. The command line help will be printed to the console.
Configuring your external editor
In order to run a script in RoboFont, you’ll need to save it first.
Sublime Text
Steps for setting up a RoboFont build system in SublimeText, contributed by Bahman Eslami.
{
"cmd": ["robofont", "-p", "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python",
}
-
Save the file above inside the SublimeText user folder:
Library/Application Support/Sublime Text 3/Packages/User
-
In the SublimeText main menu, go to Tools > Build System and select RoboFont.
-
Run the script using the standard keyboard shortcut ⌘ + b, and the code will be executed inside RoboFont.
Atom
Steps for setting up a RoboFont build system in Atom, contributed by Rafał Buchner.
"atom-shell-commands":
commands: [
{
arguments: [
"-p"
"{FilePath}"
]
command: "roboFont"
name: "build robofont"
options:
keymap: "alt-r"
pwd: "{FileDir}"
}
]
-
Install atom-shell-commands.
-
In the Atom main menu, go to File > Open Your Config to open your config file.
-
To add a command to your
atom-shell-commands
configurations, copy the above code after the line*:
. -
Run the script, and the code will be executed inside RoboFont.
Visual Studio Code
Steps for setting up a RoboFont build system in VS Code, contributed by Stephen Nixon.
{
"version": "2.0.0",
"tasks": [
{
"label": "Run in RoboFont",
"type": "shell",
"command": "robofont",
"args": [
"-p",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
-
In VS Code, open a folder that you wish to run scripts from. This might be a type project, the central RoboFont scripts folder, or somewhere else. VS Code calls this a “workspace”, and you can give it specific settings in a
.vscode
folder. -
Use the shortcut ⌘ + ⇧ + p to open the Command Palette.
-
Search for Tasks: Configure Default Build Task and select it.
-
Select Create tasks.json file from template, and finally Other. This will create the file
tasks.json
in a.vscode
workspace folder. -
Paste the above
tasks.json
code in place of the template. -
Run the script using the standard keyboard shortcut ⌘ + ⇧ + b, and the code will be executed inside RoboFont.
- Yes, the version number is
2.0.0
because it refers to VS Code’s task system.- If you are managing the workspace as a Git project, you should probably add
.vscode
to your.gitignore
file.
PyCharm
Steps for setting up a RoboFont build system in PyCharm, contributed by Rafał Buchner.
-
In the PyCharm main menu, go to Preferences > External Tools.
-
Click on the + button to create a new external tool.
-
Fill in the Name field with the name of the tool, for example “RoboFont”.
-
Fill in the remaining fields like this:
- Program
roboFont
- Arguments
-p $FilePath$
- Working directory
$Projectpath$
-
Optionally, you can choose the name of the group for this tool – it is set to External Tools by default.
-
Click on OK and then on Apply to save your changes.
-
Run the script using the main menu Tools > External Tools > RoboFont, or with External Tools > RoboFont from the contextual menu (use right click to display it).
You can define a keyboard shortcut for this command in the PyCharm Preferences.
VIM
Steps for setting up a RoboFont build system in VIM, contributed by Jan Šindler.
-
Open your
.vimrc
config file. -
Add
nnoremap <silent> <F3> :!robofont "%:p"<CR>
to run your files from normal mode. -
Add
inoremap <silent> <F3> <ESC> :!robofont "%:p"<CR>
to run your files from insert mode. -
Save the changes.
-
Run the script using the key to which the commands were assigned (in the example above, F3). The code will be executed inside RoboFont.
- You can choose other keys to run your files in RoboFont.
- In macOS, this example .vimrc file can be found in the
~
folder (user home directory).