Loading ...
Sorry, an error occurred while loading the content.

vim7: ^= operator for :let [PATCH]

Expand Messages
  • Mikolaj Machowski
    Hello, Good addition for let arsenal would be ^= operator for adding {rhs} _before_ {lhs} let a = asdf let a ^= 1234 Would return 1234asdf There is
    Message 1 of 3 , May 14, 2005
    • 0 Attachment
      Hello,

      Good addition for let arsenal would be ^= operator for adding {rhs}
      _before_ {lhs}

      let a = 'asdf'
      let a ^= '1234'

      Would return
      1234asdf

      There is precedence with set option ^= something
      where something was added before old value of optionl

      Attaching half baked patch against current vim7 CVS. Works good for
      ordinary variables but destroys special $VARS, @a and &vars.

      --
      LaTeX + Vim = http://vim-latex.sourceforge.net/
      Vim-list(s) Users Map: (last change 12 Feb)
      http://skawina.eu.org/mikolaj/vimlist
      CLEWN - http://clewn.sf.net
    • Bram Moolenaar
      ... I m afraid I don t like this. For options you need an operator like ^= to be able to prepend something to an option value with :set . For ... I think
      Message 2 of 3 , May 15, 2005
      • 0 Attachment
        Mikolaj Machowski wrote:

        > Good addition for let arsenal would be ^= operator for adding {rhs}
        > _before_ {lhs}
        >
        > let a = 'asdf'
        > let a ^= '1234'
        >
        > Would return
        > 1234asdf
        >
        > There is precedence with set option ^= something
        > where something was added before old value of optionl
        >
        > Attaching half baked patch against current vim7 CVS. Works good for
        > ordinary variables but destroys special $VARS, @a and &vars.

        I'm afraid I don't like this. For options you need an operator like ^=
        to be able to prepend something to an option value with ":set". For
        assignments it's very easy to do:

        :let a = '1234' . a

        I think this is used infrequent, at least not often enough to justify
        adding another operator. It's not obvious what it does either, since

        let a ^= x

        would logically mean:

        let a = a ^ x

        --
        Q: How many hardware engineers does it take to change a lightbulb?
        A: None. We'll fix it in software.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
      • Mikolaj Machowski
        ... OK. m. -- LaTeX + Vim = http://vim-latex.sourceforge.net/ Vim-list(s) Users Map: (last change 15 May) http://skawina.eu.org/mikolaj/vimlist CLEWN -
        Message 3 of 3 , May 15, 2005
        • 0 Attachment
          Dnia niedziela 15 maj 2005 13:42, Bram Moolenaar napisaƂ:
          > I'm afraid I don't like this.

          OK.

          m.

          --
          LaTeX + Vim = http://vim-latex.sourceforge.net/
          Vim-list(s) Users Map: (last change 15 May)
          http://skawina.eu.org/mikolaj/vimlist
          CLEWN - http://clewn.sf.net
        Your message has been successfully submitted and would be delivered to recipients shortly.