Option to show line numbers in editor

Quick hack in userchrome.css:

.CodeMirror-code
{
	counter-reset: line;
}

.CodeMirror-line:before
{
	counter-increment: line;
	content: counter(line);
	width: 2rem; /*  Adjust if you have lot of lines, big numbers */
	display: inline-block;
	padding: 0 0.5em;
	margin-right: 0.5em;
	border-right: 1px solid #DDD;
	color: #888
}

Looks a bit strange on long, wrapped lines, but might be usable.

5 Likes