Andy Wokula wrote:
>Charles E Campbell Jr schrieb:
>
>
>>Hello!
>>
>>Vim is often quite forgiving of user blunders. However, for plugin
>>development, I'd rather it be more strict. I have a tendency of trying
>>bufnr("."), for example, when I should use bufnr("%"). The strange
>>thing is is that it seems to work on occasion (but erratically). I've
>>found other bugs in the past that vim glides over, but that makes it
>>difficult to find them.
>>
>>How about an errorstop option:
>>
>>'errorstop' 'es' boolean (default: off)
>> local to window
>> {not in Vi}
>>
>> This option makes Vim strict with respect to any errors, warnings,
>>etc., when running a script.
>> Vim will immediately terminate the script with E???.
>>
>>Regards,
>>Chip Campbell
>>
>>
>
>Also helpful:
> :h 'debug
>
> :set debug=msg
> :echo bufnr(".")
> E94: No matching buffer for .
> -1
>
>
That bufnr(".") was an example, folks. Not the purpose of the
suggestion. The problem is that its difficult to find bugs in plugins
because vim is forgiving of errors -- which is a good thing for users.
In particular, consider the solution above as applied to the following code:
fun! ABC()
let b= bufnr(".")
endfun
call ABC()
Source it in. No error or error message results. BTW, I note also that
putting the "abort" keyword on the fun!.... line doesn't cause any
stoppages., probably because files starting with "." are allowed. I
think the "solution" of having syntax/vim.vim flag this particular item
with warning highlighting is the best idea -- don't prohibit it, just
make the the programmer is aware of it.
Again: often, errors are silently ignored, and it'd be helpful if there
was an option that would have Vim stop function execution when anything
untoward occurred, for the primary purpose of helping one find the
problems in the first place. I'd give it priority over "silent"s, too.
Regards,
Chip Campbell
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---