Configuring Positron
Overview
This unit discusses a few ways you can configure and customize Positron.
Goals
- Change themes, fonts, and key bindings to suit your preferences.
Reading
Introduction
Positron is highly customizable just like VS Code the software it is based on. This flexibility allows you to tailor the editor to your specific workflow and preferences. There’s a lot you can customize, we’ll only briefly look at a few main areas here.
Settings
Under the gear symbol in the lower left corner, you can access all of Positron’s settings. These control everything from editor behavior to appearance.
There are way too many settings to cover them all here, but you can search for specific settings using the search bar. Some of the most useful settings include:
- Editor Font Size: Adjust the font size for better readability.
- Editor Word Wrap: Enable or disable word wrapping in the editor.
One important fact to keep in mind: You can change settings globally (for all projects) or per project. If you want to change a setting only for the current project, make sure to select the Workspace tab at the top of the settings window. If you want to change it globally, select the User tab at the top of the settings window.
Themes
You can change the layout and look of Positron to suit your preferences. The easiest way to do so is to explore pre-made themes. If you want to have even more control, you can customize further. For most users, this is probably not worth it.
You can explore themes by clicking on the gear icon in the lower left corner, then selecting Themes and Color Theme. This opens a list of available themes. Explore them to see what you might like.
Theme selection can help adjust things to make work as ergonomic for you as possible. It’s completely your choice how you set up your colors. To be clear, the themes do not change anything about the code; they are just potentially helping you read/write code.
Key Bindings
Some users prefer different keyboard shortcuts for common commands. Positron allows you to customize these key bindings to match your workflow.
You can access key bindings by clicking the gear icon in the lower left corner, then selecting Keyboard Shortcuts. This opens a list of all available commands and their current key bindings. You can search for specific commands and change their shortcuts by clicking the pencil icon next to them.
For instance, in Positron, to quickly turn code into comments (by adding a # in front of it for R code), the default is to select the code chunk you want to comment out and then press the Ctrl/Cmd + / keyboard shortcut. This differs from RStudio, where it is the Ctrl/Cmd + Shift + C shortcut. If you prefer the RStudio shortcut, you can change it in Positron.
More customization
It should be clear from just this brief discussion that Positron is highly customizable. You can change almost anything, from the layout of the editor to how it behaves when you run code. You want to make sure to explore the settings a bit and find what works best for you, but not waste too much time trying out every possible setting.
In general, if you find yourself thinking “I wish I could change Positron to do/show X”, there’s probably a way to do so. If it’s not built into Positron, you might find the needed functionality in an extension, which is discussed in a separate unit.
And again remember, while Positron is fairly new, it’s based on VS Code which has been around for a while and is widely used. So if you are trying to figure out to customize something, it’s probably better to search for “How do I do X in VS Code” instead of “How do I do X in Positron”. Many of the same principles and settings apply.
Summary
You can customize Positron to fit your workflow and preferences. You can change almost anything. It is useful to slowly explore the settings and find what works best for you.
Further Resources
- Fun with Positron - in this blog post, Andrew Heiss discusses some ways he likes to customize Positron.
Test yourself
How do you set a Positron setting so it applies only to the current project instead of globally?
Select the Workspace tab at the top of the Settings panel; changes there apply only to the current project.
- False
- False
- True
- False
What is the quickest built-in way to browse and switch Positron color themes?
Themes are available directly from the gear menu via Themes > Color Theme.
- True
- False
- False
- False
If you want the RStudio-style shortcut for toggling comments, how can you change it in Positron?
Use the Keyboard Shortcuts panel (gear icon) to edit the toggle comment shortcut to your preferred keys.
- True
- False
- False
- False
Practice
- Change the font size to 16px and enable word wrap.
- Install a new color theme (for instance one of the many Solarized themes) and give it a try.