Tom
Tom

Reputation: 828

Creating template on vim-latex suite (Ubuntu)

I have asked a same question on tex stack overflow, but I had no responses for two days, so I will post it here instead (it is more of a technical problem than tex problem). I will delete the question on tex overflow in two hours.
https://tex.stackexchange.com/questions/230881/creating-templates-on-vim-latex-suit-template
Here are the exactly the same question from the link above. I have a question on creating templates on vim-LaTeX suite.
I placed a template file on

/usr/share/vim/addons/ftplugin/latex-suite/templates/

with the content of

<+      +>      !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!
%
\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}

Then I created the soft link of it in directory:

/var/lib/vim/addons/ftplugin/latex-suite/templates/

If everything goes well, when create a new tex file on vim and type

:TTemplate

on the command line, I should be getting:
File with file name,
Created with date and time of creation
Last Change with date and time of when the last change was made.
and starting cursor should be on \lhead{ cursor here }

However, it seems that it won't show up any vim-formatted dates and initial position of the cursor doesn't be on where I want it to be.

Is there any solution to this problem?

I am using ubuntu 14.04, vim-latex suit.
Thank in advance.

Upvotes: 0

Views: 1323

Answers (2)

Jia Ruipeng
Jia Ruipeng

Reputation: 151

cd /home/coder352/.vim/plugged/vim-latex/ftplugin/latex-suite/templates. And there four standard templates, you can copy and change them. I use vim-plug, so the path is 'plugged'

Upvotes: 0

FDinoff
FDinoff

Reputation: 31429

The first line of your file is wrong. The fields for the first line are tab delimited. Yours are currently spaced delimited.

<+^I+>^I!comp!^I!exe!

So everywhere I wrote ^I should be a literal tab.


The other problem is <++> in four different places in your template. The cursor only shows up at the first one and leaves the rest of them untouched. (I don't know if this is accurate, but thats what it seems to do)


Lately there should be no reason to modify the global vim installation. You should be able to place the tempaltes in following.

~/.vim/ftplugin/latex-suite/templates/

Upvotes: 1

Related Questions