I often need to delineate "sections" of source code files using a comment character to create horizontal lines. For example if I wanted to draw such a line in a python file I could do
:Hline # 79
where the first argument is the character and the second character is the number of times it is to be repeated to create a line. The thing I could come up with is this:
command! -nargs=1 Hline let b:horiz_line = repeat('<args>', 79) <bar>
\ exe "norm i" . b:horiz_line
Which allows me to say :Hline #
.
- I can't thing of a way to specify both the arguments
- Would it be possible to specify default values ? Like for example, the first argument could be set to the commentstring and the second argument could be set to the textwidth? Or if not set defaults to
-
and 79 characters.