Yakov Lerner wrote:
Now that my attempt to write unnamed buffer under
name /tmp/N failed, I want to autoname empty buffer.
My first attempt does not work. Autoevent is ot invoked.
function! TempName()
let x=1
while filereadable("/tmp/".x)
let x = x + 1
endwhile
return "/tmp/".x
endfun
au BufNew * if(expand('<afile>') == '') | call input("AAA") | endif
au BufNew * if(expand('<afile>') == '') | exe "file ".TempName() | endif
Yakov
add for debugging
echo <afile> |
before the "if". If it still doesn't work, add <nested> to the autocommand.
Best regards,
Tony.