Initial commit
This commit is contained in:
commit
af4c1b8b0d
|
@ -0,0 +1,11 @@
|
|||
# renamefile.vim
|
||||
|
||||
This function, ripped directly from [Gary Bernhardt's dotfiles](https://github.com/garybernhardt/dotfiles)
|
||||
renames a file in place.
|
||||
|
||||
## Usage
|
||||
|
||||
This plugin adds the command `:RenameFile`. When called, it will prompt you for
|
||||
a new file name. If the filename is blank or the same as the previous file
|
||||
name, nothing will happen. If the new name is different, the file will be
|
||||
saved as the new name and the old file will be delated.
|
|
@ -0,0 +1,11 @@
|
|||
function! s:RenameFile()
|
||||
let old_name = expand('%')
|
||||
let new_name = input('New file name: ', expand('%'), 'file')
|
||||
if new_name != '' && new_name != old_name
|
||||
exec ':saveas ' . new_name
|
||||
exec ':silent !rm ' . old_name
|
||||
redraw!
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command! RenameFile call <SID>RenameFile()
|
Loading…
Reference in New Issue