Vim copy file name to clipboard
Copy current file path to "unnamed register":
let @"=@%
Then you can paste it in another vim buffer. If your Vim is configured to use system clipboard you can paste in another application (you might need to use let @* =
instead, but it's a different story).
To copy only file name:
let @" = expand("%:t")
or just directory relative to working dir:
let @" = expand("%:h")
Written by Wojtek Kruszewski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#