sponsor Vim development Vim logo Vim Book Ad

ReplaceFile : Replace Current File with new File

 script karma  Rating 4/1, Downloaded by 894  Comments, bugs, improvements  Vim wiki

created by
Jan Mollowitz
 
script type
utility
 
description
Life-changing utility for saving files under new names in Vim with automated clean up of the old file's buffer and hard disk version.

Usage:
Call the function by one of the methods below. Insert the desired new /optional/newpath/filename and press <Enter>.
The new file will be saved, a buffer for it will be opened, the old file's buffer closed and the old file deleted (if was written to disk).

Method 1 (preferred):
    <leader>R
brings up the function call with the current file's full path.

Method 2:
     :Repfile
will operate from Vim's CWD, not with the buffers directory.

Mapping:
The default mapping is:
    <leader>R

If you want to change that, put
    let g:RepCall="yourmapping"
in your vimrc.

Added BufKill support to be able to delete/unload/wipeout a buffer without loosing it's window.
Get BufKill here: vimscript#1147 (not neccessary, but really recommended)
 
install details
Just put the repfile.vim in your .vim/plugin directory and restart vim!
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
repfile.vim 0.9.4 2011-07-20 7.0 Jan Mollowitz * added bufkill support
* added custom mapping functionality
repfile.vim 0.9.1 2011-07-19 7.0 Jan Mollowitz * beautified cmd-line input
* silenced everything
repfile.vim 0.9 2011-06-22 7.0 Jan Mollowitz Initial upload
ip used for rating: 18.191.234.62

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github