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

BUG: map and map-script work differently

Expand Messages
  • GI
    hi map and map-script handle remaping of the arguements differently: consider the following script: imap b hello imap a b world imap d
    Message 1 of 3 , Dec 2, 2003
      hi

      map and map-script handle remaping of the arguements differently:

      consider the following script:

      imap <script> \b hello
      imap <script> \a \b world

      imap \d hello
      imap \c \d world

      after starting up vim by using vim -N -u NONE and sourceing the script,
      the following happens :

      "\b" produces "hello"
      "\a" produces "\b world"
      "\d" produces "hello"
      "\c" produces "hello world"

      "\a" should produce "hello world" not "\b world". I did not find this
      mentioned in todo.txt under known-bugs.

      GI
    • Gary Johnson
      ... I don t think it s a bug, although I don t completely understand how that argument works. Note the comment in :help :map- about . Then
      Message 2 of 3 , Dec 2, 2003
        On 2003-12-02, GI <gautam@...> wrote:
        > hi
        >
        > map and map-script handle remaping of the arguements differently:
        >
        > consider the following script:
        >
        > imap <script> \b hello
        > imap <script> \a \b world
        >
        > imap \d hello
        > imap \c \d world
        >
        > after starting up vim by using vim -N -u NONE and sourceing the script,
        > the following happens :
        >
        > "\b" produces "hello"
        > "\a" produces "\b world"
        > "\d" produces "hello"
        > "\c" produces "hello world"
        >
        > "\a" should produce "hello world" not "\b world". I did not find this
        > mentioned in todo.txt under known-bugs.

        I don't think it's a bug, although I don't completely understand how
        that argument works. Note the comment in ":help :map-<script>"
        about "<SID>". Then looking at some examples under $VIMRUNTIME,
        e.g., macros/less.vim and mswin.vim, may help you figure out how
        that argument is used. If I understand this correctly, your first
        two mappings should be:

        imap <SID>\b hello
        imap <script> \a <SID>\b world

        The results are then:

        "\b" produces "\b"
        "\a" produces "hello world"
        "\d" produces "hello"
        "\c" produces "hello world"

        HTH,
        Gary

        --
        Gary Johnson | Agilent Technologies
        garyjohn@... | Wireless Division
        | Spokane, Washington, USA
      • GI
        ... aha. oops, my bad (as always) i ve not figured out that buisness yet, but this helps. for some reason i understood that part of the documentation to
        Message 3 of 3 , Dec 2, 2003
          > I don't think it's a bug, although I don't completely understand how
          > that argument works. Note the comment in ":help :map-<script>" about
          > "<SID>".

          aha. oops, my bad (as always)

          i've not figured out that <SID> buisness yet, but this helps. for some
          reason i understood that part of the documentation to mean that any
          mapping that was redefined in the script would be recursively remapped.
          not that mappings only starting with <SID>

          many thanks. i spent a while abusing the computer screen ;)

          GI
        Your message has been successfully submitted and would be delivered to recipients shortly.