vim-template
vim-template copied to clipboard
move this content to ftdetect/filetype.vim?
in plugin/templates.vim
" Syntax autocommands {{{1
"
" Enable the vim-template syntax for template files
" Usually we'd put this in the ftdetect folder, but because
" g:templates_name_prefix doesn't get defined early enough we have to add the
" template detection from the plugin itself
execute "au BufNewFile,BufRead " . g:templates_name_prefix . "* "
\. "let b:vim_template_subtype = &filetype | "
\. "set ft=vim-template"
blabla
i recommend move these lines to ftdetect/filetype.vim
. because if user use some plugin manager to lazy load this plugin, such as
call dein#add('aperezdc/vim-template', {
\ 'on_cmd': ['Template', 'TemplateHere'],
\ })
plugin/templates.vim
will be sourced after :Template
. if user open a template, these autocmd will not be source.
thanks!
Unfortunately, these lines can't be moved to ftdetect/vim-template.vim
without modification, since they use configuration variables, which are placed in vimrc
, but vimrc
is loaded after ftdetect/*
, and therefore these variables are not available in ftdetect/*
. Maybe there is a tricky way to perform this, but I don't know any
Some ways that came to my mind are either to move configuration into a place where they are available in ftdetect/*
, or to remove this configuration at all. Both of these ways will beak backward compatibility, so they are very undesirable