Here's a way to number bullet points in helix.
Let's start with a bulleted list.
- Item one
- Item two over
two lines
- Item three
We can number this using the nl
command line tool and replacing selections with the result of piping the selection
to a shell command.
- Select all the text above.
- Press the
|
key, which is the primitive for piping a selection to a command and replacing the selection with its output. - Use this command:
nl -s. -w1 -bp^-
.
The nl -s. -w1 -bp^-
command does line numbering, with a '.' at the end of the number (-s.
), no padding (-w1
), and
only on lines that start with a hyphen (-bp^-
).
At this point you'll get the following.
1.- Item one
2.- Item two over
two lines
3.- Item three
From here you can do the following to get rid of the unwanted hyphens and spaces.
- Select the block.
- Use the
s
primitive to select within the selection using a regex. - Use the regex
^\d+\.-
to select every line starting with numbers, a period, and a hyphen. - Press
;
to collapse each selection to a single cursor, which will be at the end of the selection (the hyphens). d
to delete all the hyphens.
You might want to repeat the above, but using ^
as the regex to get rid of the extra space left at the beginning
of subsequent lines on a multi-line list item.