Created
July 11, 2013 20:37
-
-
Save stephenmm/5979019 to your computer and use it in GitHub Desktop.
RenameCurrentFile with auto-completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! RenameCurrentFile(newName) | |
let l:currentFile = expand("%:p") | |
silent! exe "saveas " . a:newName | |
if delete(l:currentFile) | |
echoerr "Could not delete " . l:currentFile | |
endif | |
endfunction | |
command! -nargs=1 -complete=file -bang RenameCurrentFile :call RenameCurrentFile("<args>") | |
noremap <Leader>rf :RenameCurrentFile <C-R>=expand("%:p")<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment