Skip to content

How to handle the template depending on the filetype? #16

@GiancarloAparicio

Description

@GiancarloAparicio

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 :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions