Vim command for markdown headline
This is a sequence that I’ve been using quite a lot since I started to learn Vim.
I write a lot of markdown and for H1
and H2
headings I often use the underlining style of setting ===
or ---
under the title instead of prefixing #
or ##
.
1
2
3
4
5
6
7
Heading 1
=========
instead of `#`
Heading 2
---------
instead of `##`
To make it visually more pleasing I like to have the underlining be as long as the title itself.
The below sequence makes this really easy.
1
2
3
yyp // duplicate line
V // select line
r= // replace every character in the line with `=`
This post is licensed under CC BY 4.0 by the author.