Yank file name / path of current buffer in Vim

Posted by Dave Tapley on Stack Overflow See other posts from Stack Overflow or by Dave Tapley
Published on 2009-05-27T16:56:30Z Indexed on 2010/05/04 3:18 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

Assuming the current buffer is a file open for edit, so :e does not display E32: No file name.

I would like to yank one or all of:

  • The file name exactly as show on the status line, e.g. ~\myfile.txt
  • A full path to the file, e.g. c:\foo\bar\myfile.txt
  • Just the file name, e.g. myfile.txt

© Stack Overflow or respective owner

Related posts about vim

Related posts about clipboard