Wednesday, August 5, 2015

Re: autocmd with

2015-08-05 21:33 GMT+03:00 Nikolay Pavlov <zyx.vim@gmail.com>:
> 2015-08-05 5:40 GMT+03:00 Frank Dinoff <frank.dinoff@gmail.com>:
>> One of the options according to the help for buffer local autocmds is <buffer=abuf>. I can't seem to figure out how to use it. The help (:help <buffer=abuf>) provides an example
>>
>> :au CursorHold <buffer=abuf> echo 'hold'

Though example is rather strange. This variant will work only if you
put it into an autocmd:

autocmd BufNew * autocmd CursorHold <buffer=abuf> echo 'hold'

. It is not generally incorrect though: the following will work and
contain line from help file literally:

autocmd BufNew * :call DefineAu()
function DefineAu()
:au CursorHold <buffer=abuf> echo 'hold'
endfunction

. But if you read examples without understanding the documentation
first it will be misleading.

>>
>> which seems to always generate
>>
>> E680: <buffer=0>: invalid buffer number
>>
>> How is <buffer=abuf> supposed to be used?
>
> It is directly explained in help. *Call from an autocmd.*
>
> I.e. use autocommand to define an autocommand with <buffer=abuf>.
>
>>
>> (This originally came up as a Stack Overflow question http://stackoverflow.com/questions/31820529/how-do-you-use-buffer-local-autocommands-in-vimscript)
>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment