If you have a file open, you can yank the current buffer’s path to a register using the expand
command:
1
|
|
Since I’m using the unnamed buffer as system clipboard, my vim config/alias for this is:
1 2 |
|
This way, typing cp
in a buffer will copy it’s file path to the vim clipboard and to the Linux X Window system’s clipboard.
By the way: have a look at the expand() command: :help expand
, it’s very useful.
Source/Credits: http://stackoverflow.com/questions/916875/yank-file-name-path-of-current-buffer-in-vim