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

Re: Command-key menu equivalents

Expand Messages
  • raindog@mediaone.net
    ... Not without a good deal of effort, I m afraid. Carbon menu routines support only single-key equivalents with optional modifiers. To display arbitrary
    Message 1 of 16 , Jan 11, 2002
      On Friday, January 11, 2002, at 11:20 AM, Benji Fisher wrote:

      > :menu TeX.run\ tex<Tab>\t \t
      > :map \t :call TeX()<CR>
      >
      > Is there any way to get '\t' (my keyboard shortcut for running
      > tex) right-justified in the menu?

      Not without a good deal of effort, I'm afraid. Carbon menu routines
      support only single-key equivalents with optional modifiers. To display
      arbitrary text, one would have to implement a custom menu (known as an
      "MDEF")--not an easy task thanks to I18N considerations. (It's a
      different
      story in Cocoa, incidentally, where it looks to be a relatively
      simple matter
      of overriding a couple of NSMenuItemCell methods.)

      > The menu command and the key mapping both work, but I do not see
      > '\t' in
      > the menu.

      Out of curiosity, does ":menu TeX.run\ tex<Tab><D-t> :call TeX()<CR>"
      work for you (i.e., does it allow you to type Cmd-t to run TeX)?
      Since I applied Dany St-Amant's patch (correctly this time, I think),
      command-key equivalents such as this don't work for me, unless at least
      one other modifier key is involved. This one has me stumped.

      RD
    • Benji Fisher
      ... That s too bad. How about a workaround, so that we can use the same menu files in Mac OS X as in other OS s? A couple of spaces between the run TeX and
      Message 2 of 16 , Jan 12, 2002
        raindog@... wrote:
        >
        > On Friday, January 11, 2002, at 11:20 AM, Benji Fisher wrote:
        >
        > > :menu TeX.run\ tex<Tab>\t \t
        > > :map \t :call TeX()<CR>
        > >
        > > Is there any way to get '\t' (my keyboard shortcut for running
        > > tex) right-justified in the menu?
        >
        > Not without a good deal of effort, I'm afraid. Carbon menu routines
        > support only single-key equivalents with optional modifiers. To display
        > arbitrary text, one would have to implement a custom menu (known as an
        > "MDEF")--not an easy task thanks to I18N considerations. (It's a
        > different
        > story in Cocoa, incidentally, where it looks to be a relatively
        > simple matter
        > of overriding a couple of NSMenuItemCell methods.)

        That's too bad. How about a workaround, so that we can use the same menu
        files in Mac OS X as in other OS's? A couple of spaces between the "run TeX"
        and the "\t" would be good enough. A little extra work might get some
        approximation to right-justified.

        > > The menu command and the key mapping both work, but I do not see
        > > '\t' in
        > > the menu.
        >
        > Out of curiosity, does ":menu TeX.run\ tex<Tab><D-t> :call TeX()<CR>"
        > work for you (i.e., does it allow you to type Cmd-t to run TeX)?
        > Since I applied Dany St-Amant's patch (correctly this time, I think),
        > command-key equivalents such as this don't work for me, unless at least
        > one other modifier key is involved. This one has me stumped.

        I cannot test it right now, but I think that <D-s> and <D-S> (or maybe
        <D-S-s>) are working properly for File.Save and File.Save\ As. The latter
        brings up a browser window, which still does not work. :-( Maybe someone else
        is using the binary I posted, with the Mac-customized File menu, and can test
        it now.

        --Benji Fisher
      • Benji Fisher
        ... I think I see the problem now. Adding to the :menu command does not do anything besides add (right justified) text to the menu item. You
        Message 3 of 16 , Jan 14, 2002
          On Saturday, January 12, 2002, at 12:19 PM, Benji Fisher wrote:

          > raindog@... wrote:
          >>
          >> On Friday, January 11, 2002, at 11:20 AM, Benji Fisher wrote:
          >>> [snip]
          >> Out of curiosity, does ":menu TeX.run\ tex<Tab><D-t> :call TeX()<CR>"
          >> work for you (i.e., does it allow you to type Cmd-t to run TeX)?
          >> Since I applied Dany St-Amant's patch (correctly this time, I think),
          >> command-key equivalents such as this don't work for me, unless at least
          >> one other modifier key is involved. This one has me stumped.

          I think I see the problem now. Adding "<Tab><D-t>" to the :menu
          command does not do anything besides add (right justified) text to the
          menu item. You need a :map command as well. From my gvimrc file:

          aunmenu &File.&New
          amenu 10.325 &File.&New<Tab><D-n> <D-n>
          nmap <D-n> :confirm enew<CR>

          and there are also :[vico]map lines. I just tested it: Cmd-n seems to
          work. (I think I tested all of the menu commands when I wrote the
          gvimrc file a couple of months ago.)

          I think the binary on my i-disk did not include the patch for
          showing menu equivalents. I have just posted a version that includes
          this patch, along with the official ones through 131.

          --Benji Fisher
        • raindog@mediaone.net
          ... It s supposed to do more, actually: gui_mac_doKeyEvent() dispatches each keystroke to the Menu Manager, which responds with the ID of a menu if the key is
          Message 4 of 16 , Jan 14, 2002
            On Saturday, January 12, 2002, at 12:19 PM, Benji Fisher wrote:
            >
            > raindog@... wrote:
            >>
            >> Out of curiosity, does ":menu TeX.run\ tex<Tab><D-t> :call TeX()<CR>"
            >> work for you (i.e., does it allow you to type Cmd-t to run TeX)?
            >> Since I applied Dany St-Amant's patch (correctly this time, I think),
            >> command-key equivalents such as this don't work for me, unless at
            >> least
            >> one other modifier key is involved. This one has me stumped.
            >
            > I think I see the problem now. Adding "<Tab><D-t>" to the
            > :menu command does not do anything besides add (right justified)
            > text to the menu item. You need a :map command as well.

            It's supposed to do more, actually: gui_mac_doKeyEvent() dispatches each
            keystroke to the Menu Manager, which responds with the ID of a menu
            if the
            key is a registered equivalent for one of that menu's items. In
            that case,
            the command associated with the item is executed.

            This works in some cases:

            :menu File.Test<Tab><D-S-t> :echo "Test"<CR>

            causes Cmd-Shift-t to print "Test", but

            :menu File.Test<Tab><D-t> :echo "Test"<CR>

            doesn't have the same effect for Cmd-t.

            RD
          • Benji Fisher
            ... I would rather not have the menu code define key mappings. Vim scripts written for use on OS X should work the same on other OS s, and vice versa. Of
            Message 5 of 16 , Jan 15, 2002
              raindog@... wrote:
              >
              > On Saturday, January 12, 2002, at 12:19 PM, Benji Fisher wrote:
              > >
              > > raindog@... wrote:
              > >>
              > >> Out of curiosity, does ":menu TeX.run\ tex<Tab><D-t> :call TeX()<CR>"
              > >> work for you (i.e., does it allow you to type Cmd-t to run TeX)?
              > >> Since I applied Dany St-Amant's patch (correctly this time, I think),
              > >> command-key equivalents such as this don't work for me, unless at
              > >> least
              > >> one other modifier key is involved. This one has me stumped.
              > >
              > > I think I see the problem now. Adding "<Tab><D-t>" to the
              > > :menu command does not do anything besides add (right justified)
              > > text to the menu item. You need a :map command as well.
              >
              > It's supposed to do more, actually: gui_mac_doKeyEvent() dispatches each
              > keystroke to the Menu Manager, which responds with the ID of a menu
              > if the
              > key is a registered equivalent for one of that menu's items. In
              > that case,
              > the command associated with the item is executed.
              >
              > This works in some cases:
              >
              > :menu File.Test<Tab><D-S-t> :echo "Test"<CR>
              >
              > causes Cmd-Shift-t to print "Test", but
              >
              > :menu File.Test<Tab><D-t> :echo "Test"<CR>
              >
              > doesn't have the same effect for Cmd-t.

              I would rather not have the menu code define key mappings. Vim scripts
              written for use on OS X should work the same on other OS's, and vice versa.
              Of course, there is the difference that <D-> is not available on other
              systems, but this difference is visible to the person writing the menu in the
              vim script.

              --Benji Fisher
            Your message has been successfully submitted and would be delivered to recipients shortly.