我正在尝试为vim-latex编写自己的模板,该模板将使用我自己的example.sty包
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\usepackage{example}
\documentclass[a4paper]{article}
\begin{document}
<++>
\end{document}
vim是否有一种方法可以将example.sty文件从模板文件夹自动复制到使用模板的文件夹中?
提前感谢。
我已经找到了一个解决方案,但它更多是一个hack:
%!comp!writefile(readfile('pathtofile/example.sty'),'example.sty')!comp!
此单行代码将文件example.sty复制到新文件的目录中,因此看起来效果很好。但是,这会有不想要的行为,因为该命令还会给出输出“ 0”,这就是为什么我在前面添加了%(这也是为什么我将其称为hack)的原因。
据我所知,!comp!和!exe! vim-latex的命令在manual中没有很好地记录,因为模板不是该软件包的主要目标。我的假设是,如果您想要比上述解决方案更复杂的方法,则应考虑使用“适当的”模板包。
ps.s。感谢Luc Hermitte提供readfile()的提示!