How to handle the template depending on the filetype?
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 :(
Hi Eric,
I am currently very busy and will not be able to work on this plugin in near future. However if you are willing to work on it, I will be happy to guide you.
#12 same as this issue
Hi Eric,
I am currently very busy and will not be able to work on this plugin in near future. However if you are willing to work on it, I will be happy to guide you.
Yes, sorry for the delay in responding, I wanted to finish learning a little more about vimscript before trying to give a solution.
I first tried to get the filetype and run TemplateInit, but since bufNewFile triggers filetype it doesn't work, so I tried to catch the filetype just before fetching the template and to my surprise it works.
I really felt silly because there are only 5 new lines and it took me 2 days
