When I exchange with colleagues about the code, when I refer to given functions, I like to also mention the file.
Since this exchange does not usually take place within vim, I usually copy them out using the *
register.
It's easy to copy the name of the function (typically, I would use "*yiw
). However, for the file name, I can only think of using the command line as
:let @*=expand('%:t')
So I know that I can map that to a command. But is there a built-in way to achieve that?
And maybe there is a way to set to any register, which would not be available with a fixed mapping to the line above?
%
register. It contains the filename for the current buffer, but you may still need to runexpand()
on it, if you just want to have the full path or just the final filename%
onto*
?let @*=@%
?