7
How to repeat character in a snippet?
Post Body
I tried searching for this, but can't find anything.
I have a really simple snippet:
<snippet>
<content><![CDATA[
% _______________ want to repeat underscore... x{100-TM_LINE_INDEX} times
%% ${1:DESCRIPTION}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>:%%</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.matlab,source.octave</scope>
<description>Cell block</description>
</snippet>
Basically when I type ":%%" I want the top line to add underscores from the caret position until column 100. So the output will look something like this:
%_________________ ... __________________________
%% DESCRIPTION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . column 100 here ↑
I figured out how to calculate the number of underscores, which is what it prints currently, with this command:
{100-TM_LINE_INDEX}
But I cannot figure out how to do iterated replacement/while loop/for loop/whatever. I'm sure there must be a simple way of doing this!
Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
78,403
Link Karma
10,302
Comment Karma
66,821
Profile updated: 3 days ago
Posts updated: 7 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/SublimeText...