Tuesday, April 23, 2013

Use vim custom command to copy current file location (Mac OSX, Mountain Lion, MacVim)

Copy the location of the currently active file to the OS clipboard so it may be pasted later (even outside of vim).

[~/.vimrc]
:command! FnameRel :r!echo "%:h"/"%:p:t" | pbcopy

[vim]
:so ~/.vimrc
:FnameRel
References:

No comments:

Post a Comment