Tim Pope wrote: >On Wed, Jan 23, 2008 at 05:11:53PM -0500, Charles E Campbell Jr wrote: > > >>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???. >> >> > >Are you familiar with the abort qualifier to a function definition? >Documented a bit below :help a:firstline . It's applies to a function >rather than a window, though I'm not quite sure how the latter makes >sense. > >With regards to the specific example, bufnr() accepts several kinds of >arguments, including partial buffer names. So :e .vimrc|echo bufnr('.') >would return that buffer's number, as the filename starts with a dot. > > I'd be changing a lot of function definitions, sometimes scattered across multiple files, and I don't want to impose that behavior by distributing them that way.
I think I'll use Thomas's suggestion and have bufnr(".") be highlighted with WarningMsg highlighting (not Error, as its possible to be correct in using it as your example shows). Regards, Chip Campbell --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---