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

Macro processing system

Open pipoprods opened this issue 9 years ago • 2 comments

Some dynamic stuff handling would be great.

PR coming

pipoprods avatar Aug 12 '16 10:08 pipoprods

Hi, thank you for the patch. I don’t think I’ll be accepting it in this form, sorry. The filename macro makes obvious sense, but your timestamp macro seems too specific to one particular use already. I think the requested feature makes sense but its design needs to be more generic.

The filetype-dependent macro mechanism can be written much more simply using :runtime (something like exe 'runtime' fnameescape(g:templates_path . a:filetype . '-macros.vim')) but it seems probably unnecessary in the first place: you can already use e.g. ~/after/ftplugin/html.vim to run a script for the html filetype. Is there something you can’t do that way, or not easily?

ap avatar Aug 15 '16 01:08 ap

No problem for me if you don’t accept my patch ;)

I’m not really used to vim programming (I didn’t know about ~/after/ftplugin mechanism).

The "problem" with placing macros in ~/after/ftplugin/html.vim is that they would require creating a file for each filetype, which is something I try to avoid, prefering generic methods.

What kind of more generic design would seem correct to you?

pipoprods avatar Aug 17 '16 07:08 pipoprods