file_name inserted in first line
If {{file_name}} is inserted in the header template, no matter which line, when opening an existing file, the first line is substituted with the line from the header template containing {{file_name}}
could you provide the language you were using and the contents of the header/template file? testing with python, with the template file 2nd line being "# File name: {{file_name}}" did not reproduce the issue.
it was with c++ language files (extensions c/cc/h/hh)
sorry i can't reproduce the issue. my cpp file:
/*
* @Author: gilletthernandez
* @Date: 2016-07-27 22:56:27
* @File name: base.cpp
* @Last Modified by: gilletthernandez
* @Last Modified time: 2016-08-16 20:06:48
*/
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
cout << "Hello World!" << endl;
return 0;
}
and my tmpl file "C++.tmpl"
/*
* @Author: {{author}}
* @Date: {{create_time}}
* @File name: {{file_name}}
* @Last Modified by: {{last_modified_by}}
* @Last Modified time: {{last_modified_time}}
*/
and the command was just a simple Add Header to an existing file.
I just noticed this issue w/ a custom Python template.
I overrode the default Python template with a simpler one in my User plugins folder (also namedPython.tmpl).
###
# {{file_name}}
#
# Tony Andrys <[email protected]>
###
Ctrl+super+a adds the template to an open file correctly. However, switching to a different file in the editor (or perhaps returning to the initial) seems to trigger the bug.

The issue does seem to be related to the file_name variable; replacing {{file_name}} with {{created_time}} eliminates the problem.