Thursday, November 24, 2011

rename groups of files in vim

This came from the help inside vim.
Code:
Renaming files *rename-files*

Say I have a directory with the following files in them (directory picked at
random :-):

buffer.c
charset.c
digraph.c
...

and I want to rename *.c *.bla. I'd do it like this: >
        $ vim
        :r !ls *.c
        :%s/\(.*\).c/mv & \1.bla
        :w !sh
        :q!

You invoke the help within vim by entering the colon then typing help.

or try:

renamer.vim : Use the power of vim to rename groups of files 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

http://www.linuxquestions.org/questions/linux-newbie-8/renaming-a-file-in-vim-646394/

No comments: