Permalink
Browse files

Make :Rename keep the working directory unless a path is specified.

  • Loading branch information...
1 parent 3ec8c70 commit 0d93245c756855bfd3cb24c88ac6c7b5d2dfaa34 @Soares committed Oct 12, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 plugin/eunuch.vim
View
5 plugin/eunuch.vim
@@ -20,16 +20,17 @@ command! -bar -bang Remove :Unlink<bang>
command! -bar -nargs=1 -bang -complete=file Rename :
\ let s:file = expand('%:p') |
+ \ let s:arg = <q-args> =~# '/' ? <q-args> : expand('%:h').'/'.<q-args> |
\ setlocal modified |
- \ keepalt saveas<bang> <args> |
+ \ execute 'keepalt saveas<bang> '.s:arg |
\ if s:file !=# expand('%:p') |
\ if delete(s:file) |
\ echoerr 'Failed to delete "'.s:file.'"' |
\ else |
\ execute 'bwipe '.fnameescape(s:file) |
\ endif |
\ endif |
- \ unlet s:file
+ \ unlet s:file s:arg
command! -bar -bang -complete=file -nargs=+ Find :call s:Grep(<q-bang>, <q-args>, 'find')
command! -bar -bang -complete=file -nargs=+ Locate :call s:Grep(<q-bang>, <q-args>, 'locate')

0 comments on commit 0d93245

Please sign in to comment.