I write comments of the form
#############
## Example ##
#############
Always one line, always just like that. It's a way of breaking up code more visually. I have lately taken to the following way of typing them out:
- Type double #, space, the comment, space, double #.
- Look at the ruler in right hand corner for the horizontal position.
<esc>ki#<esc><the_number_from_step_2_minus_one>.<esc>yyjp
to entern
#'s, yank it, and paste it at the bottom.
But even this seems redundant. I would like to define a macro of the form:
:let @a='k<n>#i<esc><esc>yyjp<esc>'
Where <n>
is the length of the line I will execute the macro on:
## Example ##
But I do not know how to record and store the position of the last character on the particular line. Suggestions?
I have found this suggestion from the vim wikia but I don't want a plugin, and this from Stack Overflow but this seems like overkill again.
Note: I don't use any plugins and would prefer not to. I literally have none. And a fairly short vimrc (<50 lines after a recent doubling).