sponsor Vim development Vim logo Vim Book Ad

renamer.vim : Use the power of vim to rename groups of files

 script karma  Rating 523/150, Downloaded by 5961  Comments, bugs, improvements  Vim wiki

created by
John Orr
script type
NOTE! This location is no longer the latest code - it's moved to github, and set up as a pathogen-style bundle, here:


Basic Usage:
Show a list of file names in a directory, rename then in the vim
buffer using vim editing commands, then have vim rename them on disk
Start the plugin with the command :Renamer

Renaming a single file is easily done via an operating system file explorer,
the vim file explorer (netrw.vim), or the command line.  When you want to
rename a bunch of files, especially when you want to do a common text
manipulation to those file names, this plugin may help.  It shows you all
the files in the current directory, and lets you edit their names in the vim
buffer.  When you're ready, issue the command ":Ren" to perform the mass
rename.  The intention is to rename files in the same directory, but
relative paths can be specified to move files around - provided the
destination directories exist
install details
The usual - drop this file into your $HOME/.vim/plugin directory (unix)
or $HOME/vimfiles/plugin directory (Windows), etc.
Use the commands defined below to invoke the functionality (or redefine them
elsewhere to what you want), and set the User Configurable Variables as

Installing As Windows Right Click Menu Option:
To add running this script on a directory as a right click menu option,
if you are confident working with the registry, do as
ME for both Windows 7 and XP, BUT I CAN'T GUARANTEE THEY ARE 100% SAFE):
- Run the Registry Editor (REGEDIT.EXE) - make sure you have administrator privileges.
- Open My Computer\HKEY_CLASSES_ROOT\Directory and click on the
  sub-item 'shell'.
- Select New from the Edit menu, and then select Key.
- Here, type VimRenamer and press Enter.
- Double-click on the (Default) value in the right pane, and type the name
  to see in the menu, eg Rename Files with Vim Renamer - and then press Enter.
- Click on the new key in the left pane, select New from the Edit menu,
  and then select Key again.
- Type the word 'command' (without quotes) for the name of this new key, and press Enter.
- Double-click on the (Default) value in the right pane, and type the full
  path and filename to vim, along with the vim command as per the following
  example line:
  "C:\Program Files\vim\vim70\gvim.exe" -c "cd %1|Renamer"
  Change the path according to the location of gvim on your system. Press Enter when done.
- Close the Registry Editor.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
renamer.vim 1.4 2011-11-16 7.0 John Orr - fix permitted filenames problem on Mac OS - thanks Adam Courtemanche.
- fix bug when launching from within an existing buffer.
renamer.vim 1.3 2011-11-13 7.0 John Orr 1.3 - check that proposed filenames are valid before applying them
    - add support for creating required directories - thanks to Glen Miner
      for the request that made it finally happen.
    - fix location of intermediate files to be the same as the source file.
      (Particularly important for large files on slow-access media, as
      they were being copied to and from local media.)
      Thanks to Adam Courtemanche for finding and fixing the bug!
renamer.vim 1.2 2010-06-11 7.0 John Orr Fix filename handling for linux - thanks Antonio Monizio
Improve :w support to avoid delay showing command line - thanks Sergey Bochenkov
Other minor improvements
renamer.vim 1.1 2010-02-09 7.0 John Orr Added options to
      a) support :w as substitute for :Ren, and
      b) ignore wildignore settings when reading in files.
Fixed a bug with highlighting after file deletion.
Various other minor changes, eg naming the buffer.
renamer.vim 1.0 2006-11-29 7.0 John Orr Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github