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

diff options set to late to use autocommands in diffsplit

Expand Messages
  • Mikolaj Machowski
    Hello, Looks almost like a bug. When doing :diffsplit diff option is set too late to make an influence of autocommands like BufRead, BufReadPost, BufWinEnter.
    Message 1 of 6 , Jul 29, 2005
    • 0 Attachment
      Hello,

      Looks almost like a bug.

      When doing :diffsplit diff option is set too late to make an influence
      of autocommands like BufRead, BufReadPost, BufWinEnter.

      'if &diff' hint from diff.txt is useful only when starting vimdiff.

      m.
    • Bram Moolenaar
      ... Try this patch, is it sufficient? ... *************** ... { /* Pretend it was a :split fname command */ eap- cmdidx = CMD_split; + curwin- w_p_diff =
      Message 2 of 6 , Jul 29, 2005
      • 0 Attachment
        Mikolaj Machowski wrote:

        > Looks almost like a bug.
        >
        > When doing :diffsplit diff option is set too late to make an influence
        > of autocommands like BufRead, BufReadPost, BufWinEnter.
        >
        > 'if &diff' hint from diff.txt is useful only when starting vimdiff.

        Try this patch, is it sufficient?

        *** src/diff.c~ Sat Jun 25 23:20:31 2005
        --- src/diff.c Fri Jul 29 20:28:10 2005
        ***************
        *** 1009,1014 ****
        --- 1009,1015 ----
        {
        /* Pretend it was a ":split fname" command */
        eap->cmdidx = CMD_split;
        + curwin->w_p_diff = TRUE;
        do_exedit(eap, old_curwin);

        if (curwin != old_curwin) /* split must have worked */

        --
        DENNIS: Look, strange women lying on their backs in ponds handing out
        swords ... that's no basis for a system of government. Supreme
        executive power derives from a mandate from the masses, not from some
        farcical aquatic ceremony.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// 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 ///
      • Gary Johnson
        ... I m not saying that it wouldn t be helpful if &diff was set a little earlier than it is now, but there is a workaround: you can use the FilterWritePre
        Message 3 of 6 , Jul 29, 2005
        • 0 Attachment
          On 2005-07-29, Mikolaj Machowski <mikmach@...> wrote:

          > When doing :diffsplit diff option is set too late to make an influence
          > of autocommands like BufRead, BufReadPost, BufWinEnter.
          >
          > 'if &diff' hint from diff.txt is useful only when starting vimdiff.

          I'm not saying that it wouldn't be helpful if &diff was set a little
          earlier than it is now, but there is a workaround: you can use the
          FilterWritePre event like this:

          au FilterWritePre * if &diff | set virtualedit=all | endif

          This works for me whether I'm running vimdiff or executing
          diffsplit.

          HTH,
          Gary

          --
          Gary Johnson | Agilent Technologies
          garyjohn@... | Wireless Division
          | Spokane, Washington, USA
        • Mikolaj Machowski
          ... No. m.
          Message 4 of 6 , Jul 29, 2005
          • 0 Attachment
            Dnia piątek 29 lipiec 2005 21:15, Bram Moolenaar napisał:
            > Mikolaj Machowski wrote:
            > > Looks almost like a bug.
            > >
            > > When doing :diffsplit diff option is set too late to make an influence
            > > of autocommands like BufRead, BufReadPost, BufWinEnter.
            > >
            > > 'if &diff' hint from diff.txt is useful only when starting vimdiff.
            >
            > Try this patch, is it sufficient?

            No.

            m.
          • Bram Moolenaar
            ... Well, then you need to explain what you are doing. Remember that one buffer is already loaded when you do :diffsplit , thus a BufRead autocommand for that
            Message 5 of 6 , Jul 30, 2005
            • 0 Attachment
              Mikolaj Machowski wrote:

              > > > Looks almost like a bug.
              > > >
              > > > When doing :diffsplit diff option is set too late to make an influence
              > > > of autocommands like BufRead, BufReadPost, BufWinEnter.
              > > >
              > > > 'if &diff' hint from diff.txt is useful only when starting vimdiff.
              > >
              > > Try this patch, is it sufficient?
              >
              > No.

              Well, then you need to explain what you are doing.

              Remember that one buffer is already loaded when you do ":diffsplit",
              thus a BufRead autocommand for that buffer won't be triggered. Only for
              the newly opened buffer.

              --
              Mrs Abbott: I'm a paediatrician.
              Basil: Feet?
              Mrs Abbott: Children.
              Sybil: Oh, Basil!
              Basil: Well, children have feet, don't they? That's how they move
              around, my dear. You must take a look next time, it's most
              interesting. (Fawlty Towers)

              /// 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. Gary Johnson s trick works for me. m.
              Message 6 of 6 , Aug 1, 2005
              • 0 Attachment
                Dnia sobota 30 lipiec 2005 12:52, Bram Moolenaar napisał:
                > Well, then you need to explain what you are doing.

                OK. Gary Johnson's trick works for me.

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