Blame view: %(file) refers to old file name, %(file_old) is blank
In the blame view of a renamed file, the %(file) contains the name of the file at each row's creation.
For example, running :echo %(file) on the two lines below (from src/refs.c) results in the echoing of column number two in the blame view.
395611e src/refs.c Thomas Koutcher 2022-05-09
5fd811f src/branch.c Jonas Fonseca 2014-02-25
I have not found a use case for the old filename, and my custom commands are not working on these lines, since they try to operate on a file that does not exist anymore.
I think it would be logical to set %(file) to the current filename, and maybe use %(file_old) to refer to the name of the file at the time of the commit.
Is this a bug or a feature? 😄
I have made a workaround for my use case.
Nice find.
%(file_old) was only implemented for the diff view, we should fix it for the blame view too. I think changing %(file) be the new filename is unlikely to break anyone.
I think the code in src/blame.c uses %(file) (look for string_ncopy(view->env->file,) because at that time there was no %(file_old).
Yeah, I saw that %(file_old) was introduced recently for the diff view, when I stumbled upon it, and discovered it was blank.
It is not listed in the github.io manual, by the way. 😊