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

autocmd {pattern} doesn't work on osx gVim

Expand Messages
  • Aman Patel
    Hello! I ve recently encountered a situation where the {pattern} argument to autocmd command doesn t work correctly on the Mac. Here are more details: I put
    Message 1 of 5 , Jul 6, 2004
    • 0 Attachment
      Hello!

      I've recently encountered a situation where the {pattern} argument to
      autocmd command doesn't work correctly on the Mac. Here are more
      details:

      I put this in my vimrc (it is a common vimrc for my peecee and mac):

      au GUIEnter *.php,*.html,*.css,*.js se co=120 lines=60

      It works on the PC, but not on the Mac. I tried reducing the command to:

      au GUIEnter * se co=120 lines=60

      And this works on the PC and the Mac. Anyone have any clue on why the
      {pattern} argument might not match on the Mac?

      thanks,
      Aman
    • Benji Fisher
      ... I cannot reproduce the problem. I added the line au GUIEnter *.jsp,*.html let bar = expand( ) to my vimrc file. I then started vim from the
      Message 2 of 5 , Jul 6, 2004
      • 0 Attachment
        On Tue, Jul 06, 2004 at 11:54:37AM -0500, Aman Patel wrote:
        > Hello!
        >
        > I've recently encountered a situation where the {pattern} argument to
        > autocmd command doesn't work correctly on the Mac. Here are more
        > details:
        >
        > I put this in my vimrc (it is a common vimrc for my peecee and mac):
        >
        > au GUIEnter *.php,*.html,*.css,*.js se co=120 lines=60
        >
        > It works on the PC, but not on the Mac. I tried reducing the command to:
        >
        > au GUIEnter * se co=120 lines=60
        >
        > And this works on the PC and the Mac. Anyone have any clue on why the
        > {pattern} argument might not match on the Mac?
        >
        > thanks,
        > Aman

        I cannot reproduce the problem. I added the line

        au GUIEnter *.jsp,*.html let bar = expand("<afile>")

        to my vimrc file. I then started vim from the command line, using

        $ gvim foo.html
        :echo bar

        (where gvim is the shell script from the binary distribution). It
        worked as expected.

        It may be that it depends on how you start vim. Aha! When I drag
        a file icon (index.html) onto the Vim icon on my Dock, I see the
        problem. When I replace the {pattern} with *, it seems that the buffer
        name is empty.

        :echo "#" . bar . "#"
        ##

        So it seems that there is a problem with the GUIEnter event when you
        start vim from the Dock (or the Finder in general?).

        I do not have the same problem when I use VimEnter instead of
        GUIEnter. Will that work for you as a workaround?

        HTH --Benji Fisher
      • Bram Moolenaar
        ... It works just fine for me. Any idea what you could be doing that is different? -- Lawmakers made it obligatory for everybody to take at least one bath
        Message 3 of 5 , Jul 7, 2004
        • 0 Attachment
          Aman Patel wrote:

          > I've recently encountered a situation where the {pattern} argument to
          > autocmd command doesn't work correctly on the Mac. Here are more
          > details:
          >
          > I put this in my vimrc (it is a common vimrc for my peecee and mac):
          >
          > au GUIEnter *.php,*.html,*.css,*.js se co=120 lines=60
          >
          > It works on the PC, but not on the Mac. I tried reducing the command to:
          >
          > au GUIEnter * se co=120 lines=60
          >
          > And this works on the PC and the Mac. Anyone have any clue on why the
          > {pattern} argument might not match on the Mac?

          It works just fine for me. Any idea what you could be doing that is
          different?

          --
          Lawmakers made it obligatory for everybody to take at least one bath
          each week -- on Saturday night.
          [real standing law in Vermont, United States of America]

          /// 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 at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
        • Aman Patel
          ... I tried doing what Benji Fisher did: ~/.vimrc au GUIEnter *.php,*.html let bar = expand( ) ... ## The buffer name would be blank when I try to open
          Message 4 of 5 , Jul 7, 2004
          • 0 Attachment
            On Jul 7, 2004, at 4:13 AM, Bram Moolenaar wrote:
            > Aman Patel wrote:
            >
            >> I've recently encountered a situation where the {pattern} argument to
            >> autocmd command doesn't work correctly on the Mac. Here are more
            >> details:
            >>
            >> I put this in my vimrc (it is a common vimrc for my peecee and mac):
            >>
            >> au GUIEnter *.php,*.html,*.css,*.js se co=120 lines=60
            >>
            >> It works on the PC, but not on the Mac. I tried reducing the command
            >> to:
            >>
            >> au GUIEnter * se co=120 lines=60
            >>
            >> And this works on the PC and the Mac. Anyone have any clue on why the
            >> {pattern} argument might not match on the Mac?
            >
            > It works just fine for me. Any idea what you could be doing that is
            > different?

            I tried doing what Benji Fisher did:

            ~/.vimrc
            au GUIEnter *.php,*.html let bar = expand("<afile>")

            :echo "#" . bar . "#"
            ##

            The buffer name would be blank when I try to open a file from Finder or
            the Dock. When I open from command line (terminal) it would work fine.
            On the other hand, the VimEnter autocmd event seems to work just fine
            every-time. That is a good workaround for now.

            Aman
          • Bram Moolenaar
            ... This would mean that when the GUIEnter event is triggered there is no file name yet. If gvim is started from Finder, then how does it get the file name?
            Message 5 of 5 , Jul 7, 2004
            • 0 Attachment
              Aman Patel wrote:

              > I tried doing what Benji Fisher did:
              >
              > ~/.vimrc
              > au GUIEnter *.php,*.html let bar = expand("<afile>")
              >
              > :echo "#" . bar . "#"
              > ##
              >
              > The buffer name would be blank when I try to open a file from Finder or
              > the Dock. When I open from command line (terminal) it would work fine.
              > On the other hand, the VimEnter autocmd event seems to work just fine
              > every-time. That is a good workaround for now.

              This would mean that when the GUIEnter event is triggered there is no
              file name yet.

              If gvim is started from Finder, then how does it get the file name?
              Does this happen in between starting the GUI and triggering the VimEnter
              event? Strange...

              --
              "I love deadlines. I especially like the whooshing sound they
              make as they go flying by."
              -- Douglas Adams

              /// 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 at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
            Your message has been successfully submitted and would be delivered to recipients shortly.