Charles E Campbell Jr wrote:
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.

Hello!

The autocmd system is always invoked based on the buffer name.
Thus it appears none of the autocmds will fire, including BufWriteCmd,
BufReadCmd, CursorHold, etc.
The only alternative that I can think of is to use maps, for example, try
to catch a newline in insert mode.

Regards,
Chip Campbell




With * as the pattern, the autocommand _is_ triggered, but...

Experiment:

1. Define an autocommand

        :au BufAdd * echo "New buffer:" expand("<afile>")

2. Trigger it

        :new

New buffer:

        :new dummy

New buffer: dummy
"dummy" [New File]
Reading viminfo file "/root/.viminfo" marks

expand() is necessary, otherwise I get errors culminating in E15 Invalid expression


Best regards,
Tony.

Reply via email to