On 17-Oct-2011 16:50, Ben Fritz wrote:

> [...]
> And, cpo isn't the only "problem setting". Many script authors make
> assumptions about 'magic', 'selection', and others. Even the very good
> surround.vim plugin screws up with 'selection' set to exclusive. We
> cannot truly ignore ALL these settings in sourced scripts. And, how
> would you tell the script, "use whatever option value the user
> currently has set" using the suggested scheme?

A very good observation. Most scripts first get developed for personal use (with
a certain set of settings), and only after publishing does the script author
learn where differing settings break the plugin. Some options (like 'selection')
have far-reaching consequences, others ('report') will only cause subtle
differences, some (like 'ignorecase') are annoying to consider and work around
everywhere in scripts.

> 1. Have an "envpush" and "envpop" command (or similar) which would
> create a restorable state of all options which could be pushed and
> popped at will by script authors. Authors would do "envpush" at the
> beginning of each script, and at the beginning of each function, then
> "set all&", then "envpop" and the end of the script/function.
> 2. Have script-local options similar to buffer/window/tab/script-local
> variables and buffer/window/tab-local options. This would introduce
> commands like "setscript" and a new pattern similar to :set cpo&
> or :set cpo< which currently set the option to the default or to the
> global value, to set a script-local option to the current local/global
> value. Any options set local to the script would retain their value in
> mappings and autocmds, similar to how script-local variables work.
> Authors would probably ":setscript all&" at the beginning of the
> script, and individually set options which ought to use the user
> settings to do so.
> 3. Leave things as-is, and rely on script authors to find and account
> for problem settings. There are plugins to help with this, I think Dr.
> Chip has one on his site.

I like the suggestions, especially :setscript. I'm afraid it won't be trivial to
implement, though.

-- regards, ingo

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui