Skip to content

Commit

Permalink
refactor rename file.
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoah0a authored and garybernhardt committed Mar 15, 2014
1 parent 30704e5 commit 2005691
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .vimrc
Expand Up @@ -180,11 +180,10 @@ map <leader>v :view %%
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
let new_name = input('New file name: ', old_name, 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
call rename(old_name, new_name)
exec ':e ' . new_name
endif
endfunction
map <leader>n :call RenameFile()<cr>
Expand Down

0 comments on commit 2005691

Please sign in to comment.