renamer.vim : Use the power of vim to rename groups of files
| script karma
Downloaded by 3370
Comments, bugs, improvements
script versions (upload new version)
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
|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 XP Right Click Menu Option:
To add running this script on a directory as a right click menu option,
in Windows XP, if you are confident working with the registry, do as
follows (NOTE - THESE INSTRUCTIONS CAME FROM THE WEB AND WORKED FOR
ME, BUT I CAN'T GUARANTEE THEY ARE 100% SAFE):
- Run the Registry Editor (REGEDIT.EXE).
- Open My Computer\HKEY_CLASSES_ROOT\Directory and click on the
- 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 meny, eg Rename Files with Vim Renamer, and press Enter.
- Highlight the new key in the left pane, select New from the Edit menu,
and then select Key again.
- Type the word Command 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 command as per the following
"C:\Program Files\vim\vim70\gvim.exe" -c "cd %1|Renamer"
Change the path as required, press Enter when done.
- Close the Registry Editor when finished.
Click on the package to download.
ip used for rating: 22.214.171.124
||- fix permitted filenames problem on Mac OS - thanks Adam Courtemanche.
- fix bug when launching from within an existing buffer.
||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!
||Fix filename handling for linux - thanks Antonio Monizio
Improve :w support to avoid delay showing command line - thanks Sergey Bochenkov
Other minor improvements
||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.