在 vim-latex 套件 (Ubuntu) 上创建模板
Creating template on vim-latex suite (Ubuntu)
我在 tex stack overflow 上问过同样的问题,但是我已经两天没有回复了,所以我会 post 在这里代替它(它更像是一个技术问题而不是 tex 问题)。 tex overflow的问题我会在两小时后删除
https://tex.stackexchange.com/questions/230881/creating-templates-on-vim-latex-suit-template
这是来自上面 link 的完全相同的问题。
我对在 vim-LaTeX 套件上创建模板有疑问。
我在
上放置了一个模板文件
/usr/share/vim/addons/ftplugin/latex-suite/templates/
内容为
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '', 'g')!comp!
%
\documentclass[a4paper]{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{{<++>}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\newcommand{\norm}[1]{\lVert#1\rVert}
\begin{document}
\lhead{<++>}
\rhead{<++>}
\cfoot{\thepage}
<++>
\end{document}
然后我在目录中创建了它的软件link:
/var/lib/vim/addons/ftplugin/latex-suite/templates/
如果一切顺利,在 vim 上创建一个新的 tex 文件并输入
:TTemplate
在命令行上,我应该得到:
文件名的文件,
使用创建日期和时间创建
上次更改的日期和时间是上次更改的时间。
开始光标应该在
\lhead{ 光标在这里 }
但是,它似乎不会显示任何 vim 格式的日期,并且光标的初始位置不在我想要的位置。
这个问题有什么解决办法吗?
我正在使用 ubuntu 14.04,vim-乳胶套装。
提前致谢。
你的文件的第一行是错误的。第一行的字段以制表符分隔。你的当前是用空格分隔的。
<+^I+>^I!comp!^I!exe!
所以我写的每个地方 ^I
都应该是文字标签。
另一个问题是 <++>
在您模板的四个不同位置。光标只出现在第一个,其余的保持不变。 (我不知道这是否准确,但这就是它所做的)
最近应该没有理由修改全局 vim 安装。您应该能够将模板放在下面。
~/.vim/ftplugin/latex-suite/templates/
cd /home/coder352/.vim/plugged/vim-latex/ftplugin/latex-suite/templates。并且有四个标准模板,您可以复制和更改它们。
我用的是vim-plug,所以路径是'plugged'
我在 tex stack overflow 上问过同样的问题,但是我已经两天没有回复了,所以我会 post 在这里代替它(它更像是一个技术问题而不是 tex 问题)。 tex overflow的问题我会在两小时后删除
https://tex.stackexchange.com/questions/230881/creating-templates-on-vim-latex-suit-template
这是来自上面 link 的完全相同的问题。
我对在 vim-LaTeX 套件上创建模板有疑问。
我在
/usr/share/vim/addons/ftplugin/latex-suite/templates/
内容为
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '', 'g')!comp!
%
\documentclass[a4paper]{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{{<++>}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\newcommand{\norm}[1]{\lVert#1\rVert}
\begin{document}
\lhead{<++>}
\rhead{<++>}
\cfoot{\thepage}
<++>
\end{document}
然后我在目录中创建了它的软件link:
/var/lib/vim/addons/ftplugin/latex-suite/templates/
如果一切顺利,在 vim 上创建一个新的 tex 文件并输入
:TTemplate
在命令行上,我应该得到:
文件名的文件,
使用创建日期和时间创建
上次更改的日期和时间是上次更改的时间。
开始光标应该在
\lhead{ 光标在这里 }
但是,它似乎不会显示任何 vim 格式的日期,并且光标的初始位置不在我想要的位置。
这个问题有什么解决办法吗?
我正在使用 ubuntu 14.04,vim-乳胶套装。
提前致谢。
你的文件的第一行是错误的。第一行的字段以制表符分隔。你的当前是用空格分隔的。
<+^I+>^I!comp!^I!exe!
所以我写的每个地方 ^I
都应该是文字标签。
另一个问题是 <++>
在您模板的四个不同位置。光标只出现在第一个,其余的保持不变。 (我不知道这是否准确,但这就是它所做的)
最近应该没有理由修改全局 vim 安装。您应该能够将模板放在下面。
~/.vim/ftplugin/latex-suite/templates/
cd /home/coder352/.vim/plugged/vim-latex/ftplugin/latex-suite/templates。并且有四个标准模板,您可以复制和更改它们。 我用的是vim-plug,所以路径是'plugged'