renamer.vim : Use the power of vim to rename groups of files
| script karma
Downloaded by 4369
Comments, bugs, improvements
script versions (upload new version)
|NOTE! This location is no longer the latest code - it's moved to github, and set up as a pathogen-style bundle, here:
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 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
follows (NOTE - THESE INSTRUCTIONS CAME FROM THE WEB AND WORKED FOR
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
- 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
"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.
Click on the package to download.
ip used for rating: 220.127.116.11
||- 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.