Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical rulers in Visual Studio Code

How can vertical rulers (note the plural) be configured in Visual Studio Code?

In Sublime Text 2 I can do

"rulers": [72, 80, 100, 120] 

How does this work in Visual Studio?

"editor.ruler": 80 

produces only one vertical ruler.

like image 284
nalply Avatar asked Apr 30 '15 13:04

nalply


People also ask

How do you select vertically in VSCode?

Keyboard shortcut for vertical block selection: To select code block vertically in your visual studio code, use Shift + Alt and then use the mouse to select lines vertically, from top-left to bottom-right.

What are vertical rulers?

Definitions. A bar displayed along the left side of a document window. You can use the vertical ruler to adjust the top and bottom page margins and the row height in tables.


2 Answers

Visual Studio Code 0.10.10 introduced this feature. To configure it, go to menu FilePreferencesSettings and add this to to your user or workspace settings:

"editor.rulers": [80,120] 

The color of the rulers can be customized like this:

"workbench.colorCustomizations": {     "editorRuler.foreground": "#ff4081" } 
like image 87
Dimitar Asenov Avatar answered Sep 28 '22 05:09

Dimitar Asenov


In addition to global "editor.rulers" setting, it's also possible to set this on a per-language level.

For example, style guides for Python projects often specify either 79 or 120 characters vs. Git commit messages should be no longer than 50 characters.

So in your settings.json, you'd put:

"[git-commit]": {"editor.rulers": [50]}, "[python]": {     "editor.rulers": [         79,         120     ] } 
like image 27
Jeff Widman Avatar answered Sep 28 '22 04:09

Jeff Widman