lalitmetkar / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

set+= incorrectly adds suboptions to 'clipboard' option #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider the following script:

    vim -u NONE -c 'set clipboard=exclude:pattern' \
                -c 'set clipboard+=autoselect'

You will see that 'clipboard' option is now containing 
`exclude:pattern,autoselect`, while it should contain 
`autoselect,exclude:pattern` as `exclude:` interprets rest of the options as 
its argument.

Original issue reported on code.google.com by zyx....@gmail.com on 13 Oct 2011 at 4:15

GoogleCodeExporter commented 9 years ago
The error is in the script. :set with += appends at end to a string option or 
adds to a numeric option.

To append in front, use ^= instead, like this:
  :set clipboard^=autoselect

On the command-line (and unless the second part of the line is bracketed by an 
ifdef in a Makefile or similar) you could set both sub-options in one command:
  vim -N -u NONE -c 'set clipboard=autoselect,exclude:cons\\|linux'

See
    :help :set+=
    :help :set^=

Best regards,
Tony.
-- 
Schwiggle, n.:
    The amusing rotation of one's bottom while sharpening a
pencil.
        -- Rich Hall, "Sniglets"

Original comment by antoine....@gmail.com on 13 Oct 2011 at 7:50

GoogleCodeExporter commented 9 years ago
oops, ...exclude:cons\\\|linux

Original comment by antoine....@gmail.com on 13 Oct 2011 at 7:58

GoogleCodeExporter commented 9 years ago
What Tony said

Original comment by brammool...@gmail.com on 13 Oct 2011 at 8:00