/rename.vim

Rename the current file in the vim buffer + retain relative path.

Primary LanguageVim Script

Git branch of http://www.vim.org/scripts/script.php?script_id=1928

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

Copyright June 2007 by Christian J. Robinson (infynity@onewest.net).

Updated August 2011 by Dan Rogers (dan@danro.net).

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

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

Usage:

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.