Flaviu Simihaian's Blog - Entrepreneur and Developer

How to Rename a File in Vim

We’ve all had to mv a file from the Terminal when we wanted to rename it.

But what if you have the buffer open in Vim already? Vim has a :saveas [new_file] , but it does not delete the old file.

Meet the Rename Vim Plugin:

1
:rename <newfile>

vim

Yup, that is all you have to type in Vim to rename a file.

However, if you want to use Rename with the Janus collection of plugins, you’ll need to install Rename using the github link

Just add this to your ~/.janus.rake

1
vim_plugin_task "rename", "https://github.com/wojtekmach/vim-rename.git"

vim

Then, run rake in your ~/.vim/ directory, and all the plugins will install.

Yay!

Comments

Fork Flaviu on GitHub