sponsor Vim development Vim logo Vim Book Ad

qtmplsel.vim : quick template selector with expression expansion

 script karma  Rating 3/3, Downloaded by 2930  Comments, bugs, improvements  Vim wiki

created by
Takahiro SUZUKI
 
script type
utility
 
description
This plugin enables you to select a template on creating a new file.
Templates are typically placed in ~/.vim/template .
On creating a file, corresponding templates, if any, are listed up. You
can select one of them by k(up)/j(down). Press Enter to load the selected
template, or press 'q' to load no templates.
You can cancel the insertion of selected template by pressing 'u'(undo).

There is an optional global varialbe:
  g:qts_templatedir : specifies the template dir
                      (default: ~/.vim/template)

Template search rules:
  1) by filetype
    filetype=python -> ~/.vim/template/python_*
  2) by suffix
    *.cpp           -> ~/.vim/template/*.cpp
  3) by filename
    Makefile        -> ~/.vim/template/Makefile_*

Note that especially in case 3, 'Makefile_' is a legal template name
but 'Makefile' is not even if you have no other template file.

New in 1.1.0 - expression expansion:
  String surrounded by '@{@' '@}@' in the template file is regarded as a vim
  expression, and will be eval()ed on loading.
  e.g.)
    @{@expand('%:t')@}@          ->  newfile.py
    @{@strftime('%Y-%m-%d')@}@   ->  2009-08-30
 
install details
Place this file in /usr/share/vim/vim*/plugin or ~/.vim/plugin/
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
qtmplsel.vim 1.1.2 2012-06-10 7.3 Takahiro SUZUKI bug fix, show the template list immediately.
qtmplsel.vim 1.1.1 2010-01-10 7.0 Takahiro SUZUKI up and down arrow keys as well as j/k, quit on <Esc>
qtmplsel.vim 1.1.0 2009-09-07 7.0 Takahiro SUZUKI expression expansion (@{@vim-expression@}@)
qtmplsel.vim 1.0.0 2009-08-29 7.0 Takahiro SUZUKI Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github