Skip to main content

Editor Rulers

Add vertical column rulers to the editor to keep track of line lengths. By default, a single ruler is set at the 120-character position.

Enabling and Disabling Rulers

Toggle the visibility of rulers through the View > Rulers menu option.

Screenshot from 2024-04-27 12-42-50

Adding Multiple Rulers

To add multiple rulers, edit the preferences file:

  1. Navigate to File > Open Preferences File.
  2. Add the following entries to the JSON configuration:
{
// existing json items
"editor.rulers": [40, 80],
"editor.rulerColors": ["green", "#f34d5a"],
}

These settings introduce two rulers at the 40th and 80th character positions, colored green and red respectively.

image

Configuration Options

  1. editor.rulers : Specifies an array of column numbers where vertical rulers will appear.
  2. editor.rulerColors : An optional array to set colors for each ruler, corresponding to the positions listed in editor.rulers.

FAQ

Q: How do I add different rulers for each project?

To set up different rulers for individual projects, create a .phcode.json file in the root directory of each project. Include the same ruler configurations as shown in the example above.