aperezdc / vim-template

Simple templates plugin for Vim
371 stars 152 forks source link

Question: correct using of bespoke templates #122

Closed konradzdeb closed 6 years ago

konradzdeb commented 6 years ago

Hi, I just came across this plugin and I would like to ensure that I'm using it correctly. I would like to create a *.tex template with some widgets that I like to have handy when drafting quick notes. I've created a directory to keep my templates in ~/.vim/vim-templates/. My notes will always have notes in the file name, for instance 11Dec17_indicators_art_notes.tex or notes_3May16_feedback_proj.tex. How should I name my custom template so it's loaded automatically when creating a Tex documents with notes in the file name?


I've added the following to my ~/.vimrc

" -- Vim templates --
" Configure additional directory to keep vim templates
let g:templates_directory='~/.vim/vim-templates'
" --
aperezdc commented 6 years ago

@konradedgar: You have to name your template file:

~/.vim/vim-templates/=template=<pattern>

Remember that you can use wildcards in <pattern>, so a template with the following name will match any file which contains notes somewhere followed by a .tex suffix:

~/.vim/vim-templates/=template=*notes*.tex

(You may need to escape the = and * symbols in the shell in order to create the template.)

konradzdeb commented 6 years ago

Thanks for getting back to me.

aperezdc commented 6 years ago

@konradedgar: You're welcome! I'm glad that the plugin is working for you :smile: