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

comments swallowed when expanding template

Open Konfekt opened this issue 7 years ago • 5 comments

The file template=makefile with content

NAME=main
FILES=%HERE%
DEP=$(NAME).pandoc $(FILES)

# vim:ft=make

produces, when calling vim makefile, the following file:

NAME=main
FILES=%HERE%
DEP=$(NAME).pandoc $(FILES)

That is, the comment disappears. In fact, if the comment is not placed at the beginning of the file, all lines below it won't appear when the template is expanded.

Konfekt avatar Mar 26 '17 14:03 Konfekt

@Konfekt: Sorry, I cannot reproduce this using a local template, nor a global one. Are you setting any options for the plugin? If yes, which ones and to which values?

(As a gentle reminder, note that the default file names searched for local templates are .vim-template:<pattern>, and =template=<pattern> for global templates.)

aperezdc avatar Mar 28 '17 21:03 aperezdc

Thank you. Indeed, the problem is naming the template =template=makefile.pandoc and calling vim makefile.pandoc with the plugin 'https://github.com/vim-pandoc/vim-pandoc' installed.

Konfekt avatar Mar 29 '17 07:03 Konfekt

@Konfekt: I am glad that it seems to be working for you now! I guess we can close this issue now. Anyway, if you run into trouble again, or open a new one if you run into any other issue. Bug reports from user are super-useful :wink:

aperezdc avatar Apr 06 '17 13:04 aperezdc

Reopening this, because adding a blank line to the template avoids the comment being swallowed (as per comment in vim-pandoc/vim-pandoc#218). We definitely have some issue with the logic around l:deleteLastLine at templates.vim:453.

aperezdc avatar Apr 08 '17 21:04 aperezdc

I can try to figure a solution, but I am afraid it will take time as I'm quite busy lately. It would be awesome if @muff1nman could take a look at this, as he wrote some of the code around the last line deletion logic.

aperezdc avatar Apr 08 '17 22:04 aperezdc