Copy Current Filename and Line Number to Clipboard With Vim
Today I was working with a colleague and reasoned about some code over chat. We sent filename and line number frequently and I got the impression that this is another perfect candidate for automation.
Hence, I came up with the following solution, which can also be found on my .vimrc on github. Note that you need to check for the system vim is running on (linux/mac) or just pick the one line that matches your system.
" mac version
nnoremap <leader>cfn :let @*=expand("%").":".line(".")
" linux version<CR>
nnoremap <leader>cfn :let @+=expand("%").":".line(".")<CR>
That’s it again,
iss