J.Doe J.Doe - 3 years ago 128
HTML Question

Automatically load heading page

Is there a simple way to ask

vim
to automatically load the normal heading each time I create a
.html
file?

<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>

<body>
The content of the document......
</body>

</html>

Answer Source

The keyword you're after is "template".

See :h template.

You'll find explanations regarding how to initiate this in your .vimrc. However, it'll be a simple (and efficient) solution that won't automatically compute stuff on the fly. Search for a template expander plugin that suits you if this is what you want.

Some people prefer to load these templates on demand (and not automatically), and thus they are perfectly happy with snippet plugins. Some plugins do both (snippets on demand and templates on new files).

Any way, I'm quite sure this question already has answers here or on vi.SE. It may not be about HTML, but about LaTeX, C, php..., but in any case, the generic solutions apply identically.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download