I have an abbrevation for running
git blame on the current file, but it fails in the presence of symlinks.
Here's the abbreviation
cnoreabbrev gbl ! ( cd %:h ; exec git blame %:t )
.vimrc is a symlink to
$ ls -l .vimrc | cut -d' ' -f8- 16 Jan 29 20:54 .vimrc -> config/vim/vimrc
When I open my
.vimrc from the home directory, it doesn't show me the git blame because I'm not inside the project root.
Is there something kind of like
realpath(3) that I can use from the vim side to get a canonical path to the current file? I'd like to replace
%:h with a canonical path to the directory containing the current file and
%:t the corresponding file name.