On 6/10/06, Marc Weber <[EMAIL PROTECTED]> wrote:
I want to type \mv to be able to move/rename a file
the RenameFile command works fine
The \mv mapping should enter :RenameFile /<path>/<cursor><filename>
So that I can use Ctrl-e/k to delete change whatever I want..
That's why I'm trying to substiute every character of the filname to
<left> to move the cursor. But I don't know what to put there exactly
This is my attempt:
" fun Exec () executes different strings in order (I can't cope with the |"{{{
" syntax in commandline)
fun! Exec(...)
let i=1
while i<=a:0
exec a:{i}
let i+=1
endwhile
endfun"}}}
command -nargs=1 -complete=file RenameFile call Exec("call delete(expand('%'))","saveas
<args>")
map <leader>mv
:RenameFile<space><c-r>=expand('%')<cr><c-r>=substitute(expand('%:t'),'.','\\\<lt>left>','')<cr>
What to put there instead of \\\<lt>left> ?
Hello Marc,
I understand what you're trying to do.
The following solution does exactly
what you were asking for, seems to work:
-----------------------
map <leader>mv :RenameFile<space>
\<c-r>=expand('%')<cr>
\<c-r>=Empty(setcmdpos(getcmdpos()-length(expand('%:t'))))<cr>
function! Empty(...)
return ""
endfun
-----------------------------
Does it work for you.
Yakov