How should I rename my current file in Vim?
For example:
- I am editing
person.html_erb_spec.rb
- I would like it renamed to
person.haml_spec.rb
- I would like to continue editing
person.haml_spec.rb
How would I go about doing this, elegantly?
vivim
How should I rename my current file in Vim?
For example:
person.html_erb_spec.rb
person.haml_spec.rb
person.haml_spec.rb
How would I go about doing this, elegantly?
Best Answer
The command is called
:saveas
, but unfortunately it will not delete your old file, you'll have to do that manually. see:help saveas
for more info.EDIT:
Most vim installations have an integrated file explorer, which you can use for such operations. Try
:Explore
in command mode (I would actually map that to a function key, it's very handy). You can rename files withR
or delete them withD
, for example. But pressing<F1>
in the explorer will give you a better overview.