vim-templates icon indicating copy to clipboard operation
vim-templates copied to clipboard

How to handle the template depending on the filetype?

Open GiancarloAparicio opened this issue 3 years ago • 3 comments

In files like file.blade.php the plugin ignore blade.php.template and takes it as just a php file In files with the filetype modified as (file.tsx -> typescriptreact) the same thing happens too. Trying to fix it I created a little function that reads the current filetype and executes the corresponding template

function! s:CreateNewFile(file)
  call inputsave()
  let l:input = input(a:file, '', 'file')
  silent execute "!ad ".l:input
  silent execute "e ".l:input
  call inputrestore()

  execute 'TemplateInit ' . &filetype
endfunction

El problema es que al crear un archivo directamente desde el shell (archivo vim) obviamente esto no funciona :(

For now I have only limited myself to blocking it with 'g: tmpl_auto initialize' but direct creation is very useful :(

GiancarloAparicio avatar Mar 17 '21 00:03 GiancarloAparicio