I'm trying to save the current relative path of my file and line number into my clipboard.
I would like to have application/models/my_model.rb:34
But I don't understand how expand works.
They have this example :
Example:
:let &tags = expand("%:p:h") . "/tags"
But I failed when I want to combine relative path expand("%:h")
and file_name expand("%:t")
.
:echom expand("%:h:t") . ':' . line(".")
returns model:34
Any ideas ?
%:h
is not the relative path - it's (the path - filename). Wouldn't justexpand('%') . ':' . line(".")
do? For example, I get.vim/vimrc:1
when I runvim .vim/vimrc
from~
. – muru Mar 18 '16 at 17:06