使用vim创建新文件时如何自动添加一些骨架代码 [英] How can I automatically add some skeleton code when creating a new file with vim

查看:23
本文介绍了使用vim创建新文件时如何自动添加一些骨架代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用vim新建文件时,我想自动添加一些骨架代码.

When creating a new file with vim, I would like to automatically add some skeleton code.

比如新建一个xml文件时,我想添加第一行:

For example, when creating a new xml file, I would like to add the first line:

  <?xml version="1.0"?>

或者在创建html文件时,我想添加:

Or when creating an html file, I would like to add:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title></title>
  </head>
  <body>
  </body>
</html>

推荐答案

如果您想根据上下文或用户选择调整您的骨架,请查看 vim.wikia

If you want to adapt your skeleton to the context, or to the user choices, have a look at the template-expander plugins listed on vim.wikia

这篇关于使用vim创建新文件时如何自动添加一些骨架代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆