Combining information from a couple of other answers: If you want to yank the current full path to a file and put it into the command buffer in another window, first do :let @" = expand("%:p")
, then move to another window and type Ctrl+R "
.
Useful for copying a file while staying in the same directory and keeping the old one open. For example:
Start: Editing src/com/benatkin/paint/shapes/Circle.java
Type :let @" = expand("%:p")
(The path gets yanked to the main clipboard buffer.)
Open a new window with :sp
Type :e Ctrl+R"
Use the arrow keys to go back to Circle and change it to Square, and press <CR>
End: Editing src/com/benatkin/paint/shapes/Square.java