On 19/09/09 00:54, bgold12 wrote:
>
> I recently started doing searches with 'very magic' turned on using
> \v. Obviously it would be really annoying to have to type the \v every
> time you want to search for something, so I mapped / to /\v, but this
> is still undesirable as it doesn't cover the * and # operations, and
> it adds an unnecessary element to the search expression. Why is there
> not a setting for 'very magic' that would preclude having to include
> the \v in every search expression, for example set magic=very?
>
> Thanks.
":set magic=very" is not possible, and I believe never will be, because
'magic' is a Boolean option, and IIUC Bram won't break compatibility for
this kind of reason.
Changing an existing option from Boolean to String or vice-versa has
unpleasant properties, as follows:
command Boolean option String option
-----------------------------------------------------------------
:set magic set to TRUE display
:set nomagic set to FALSE syntax error
:set magic! toggle syntax error
:set invmagic toggle syntax error
:set magic=very syntax error set to "very"
:let foo = &magic Number (0 or 1) String (actual value)
:let &magic = 0 set to FALSE set to "0"
:let &magic = 1 set to TRUE set to "1"
:let &magic = "very" set to FALSE set to "very"
In theory one could e.g. define a 'verymagic' option, also Boolean, with
the following properties:
'noverymagic' 'verymagic'
(default)
-----------------------------------------------------------------
'magic' (default) magic very magic
'nomagic' nomagic very nomagic
but unless you want (and feel capable) to program that yourself as an
unofficial patch to the C code, I don't think it's going to appear out
of the blue.
I think the reason 'magic' exists at all is that old Vi scripts assumed
the equivalent of 'nomagic' (see ":help 'magic'); in most cases it is
recommended to keep 'magic' on constantly because that's what "modern"
scripts assume; you may however set any _individual_ search to very
nomagic, (ordinary) nomagic, (default) magic, or very magic by means of
modifiers within the pattern. If you could, and did, set 'very magic'
constantly, I have a hunch that you would see some functions and
commands fail in mysterious ways: for instance because \( and \) in
their patterns would suddenly start searching for literal parentheses
instead of grouping subexpressions as they normally do.
Best regards,
Tony.
--
In Boston, it is illegal to hold frog-jumping contests in nightclubs.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---