Rename the current file in the vim buffer + retain relative path.
Pull request Compare This branch is 7 commits ahead, 3 commits behind danro:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Git branch of

rename.vim - Rename a buffer within Vim and on the disk

Copyright June 2007 by Christian J. Robinson (

Updated August 2011 by Dan Rogers (

Updated February 2012 with fixes by Andrew Raw, added by Henrik Nyh.

Distributed under the terms of the Vim license. See ":help license".


Give the current file a new name in the same directory:

:Rename bar.txt

Give the current file a new name in a directory relative to the working directory:

:Rename sub/bar.txt
:Rename ../sibling/bar.txt

Give the current file a new name in an absolute directory:

:Rename /tmp/bar.txt

Add a bang to create the directories if they don't exist:

:Rename create/these/dirs/bar.txt!
:Rename! create/these/dirs/bar.txt

The bang is required so typos don't create unintended directories.