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:

:rename <newfile>


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

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


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



Fork Flaviu on GitHub