有没有办法在Vim中为新文件添加版权文本?

例如,如果我在 vim中打开一个全新的文件,它已经包含以下文本:
/*
  The MIT License

  copyright (c) 2009 Apphacker apphacker@gmail.com

  Permission is hereby granted,free of charge,to any person obtaining a copy
  of this software and associated documentation files (the "Software"),to deal
  in the Software without restriction,including without limitation the rights
  to use,copy,modify,merge,publish,distribute,sublicense,and/or sell
  copies of the Software,and to permit persons to whom the Software is
  furnished to do so,subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
  IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,fitness FOR A PARTIculaR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR copYRIGHT HOLDERS BE LIABLE FOR ANY CLaim,damAGES OR OTHER
  LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

不得不输入/复制&将其粘贴到每个新文件中.

如何创建保存MIT许可证的文本文件〜/ .vim / mit.txt?然后是.vimrc中的以下内容
map :mit :0r ~/.vim/mit.txt

…所以你只需输入:用于插入许可证的mit.

或者,如果您确实一直想要这种行为:

autocmd BufNewFile *
\ 0r ~/.vim/mit.txt
augroup END

相关文章

解决方案:解决linux下vim乱码的情况:(修改vimrc的内容)全...
Linuxvi/vim所有的UnixLike系统都会内建vi文书编辑器,其他的...
      vim正则匹配:空行:/^$/  /^[\t]*$/注释...
$select-editorSelectaneditor.Tochangelater,run'sele...
上次手贱忘了保存,这次就简单做个备忘吧,把踩过的坑记一下...
Linux之文本编译器小结vim的优势所有的UNIX-LIKE习通都会内置...