cola
cola

Reputation: 12466

How can i rename a filename from vim?

vim .

Now I get the list of directory and files.

Now how can I rename a filename from that list of files?

Upvotes: 2

Views: 6041

Answers (3)

Eugene Yarmash
Eugene Yarmash

Reputation: 149736

You can use the external mv command like this:

  :! mv oldfile newfile

Upvotes: 3

Uku Loskit
Uku Loskit

Reputation: 42040

In command mode:

:E opens up the directory view. R renames the selected file. The shortcuts are listed above the listing.

If you use vim . you can rename with R (because it is the very same thing as above).

Upvotes: 8

sehe
sehe

Reputation: 392833

You can use qmv (on debian-like systems apt-get install renameutils) which does exactly that and it honours your system default editor (VISUAL, EDITOR, execvp("editor"))

qmv *.cs

opens up an editor, you can %s///g what you like, use C-a / C-x to increment/decrement numbers - in short everything you ever wanted to. You can also rename in circular fashion, e.g.

      a.txt         b.txt
      b.txt         a.txt

or

      a.txt         b.txt
      b.txt         c.txt
      c.txt         a.txt

etc.

Upvotes: 4

Related Questions