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

Filetype specificity for menus

Expand Messages
  • Tim Johnson
    I m using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04. I ve used vim for many years but have not figured out how to do the following : Make a menu item coded
    Message 1 of 5 , May 30, 2014
    • 0 Attachment
      I'm using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04.

      I've used vim for many years but have not figured out how to do the
      following :

      Make a menu item coded for a specific filetype *not* be present in a
      buffer of a different filetype.

      Example : with python.vim, a menu for python-specific actions is
      installed. Switching to a javascript buffer, the python menu
      remains. It would be great if it were to go away.

      thanks
      --
      Tim
      tim at tee jay forty nine dot com or akwebsoft dot com
      http://www.akwebsoft.com, http://www.tj49.com

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • hermitte@...
      Hello, ... Years ago I have patched Michaels Gedes s buffer-menu plugin. The end result is there:
      Message 2 of 5 , May 31, 2014
      • 0 Attachment
        Hello,


        > Make a menu item coded for a specific filetype *not* be present in a
        > buffer of a different filetype.
        >
        > Example : with python.vim, a menu for python-specific actions is
        > installed. Switching to a javascript buffer, the python menu
        > remains. It would be great if it were to go away.

        Years ago I have patched Michaels Gedes's buffer-menu plugin.
        The end result is there: https://code.google.com/p/lh-vim/source/browse/misc/trunk/plugin/buffermenu.vim

        Just use :Bmenu, :Binoremenu, etc to define a new menu entry.


        If you want to define a menu entry and a mapping in one go, I have defined several functions in lh-vim-lib that exploit buffermenu if installed: https://code.google.com/p/lh-vim/wiki/lhVimLib#Menus_related_functions

        See the test file: https://code.google.com/p/lh-vim/source/browse/vim-lib/trunk/tests/lh/test-menu-map.vim

        I also provide a way to define cyclic options (like: Build in {Debug, Release, ReleaseWithInfo}). See the test file: https://code.google.com/p/lh-vim/source/browse/vim-lib/trunk/tests/lh/test-toggle-menu.vim

        HTH,

        --
        Luc Hermitte
        http://lh-vim.googlecode.com/

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Christian Brabandt
        Hi Tim! ... I think, all that is possible is to disable a certain menu but you can t actually removed it once it was defined. Best, Christian -- Die Arroganz
        Message 3 of 5 , May 31, 2014
        • 0 Attachment
          Hi Tim!

          On Fr, 30 Mai 2014, Tim Johnson wrote:

          > I'm using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04.
          >
          > I've used vim for many years but have not figured out how to do the
          > following :
          >
          > Make a menu item coded for a specific filetype *not* be present in a
          > buffer of a different filetype.
          >
          > Example : with python.vim, a menu for python-specific actions is
          > installed. Switching to a javascript buffer, the python menu
          > remains. It would be great if it were to go away.

          I think, all that is possible is to disable a certain menu but you can't
          actually removed it once it was defined.

          Best,
          Christian
          --
          Die Arroganz der Kleinen ist es, immer von sich, die der Großen nie
          von sich zu reden.
          -- François Marie Voltaire

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Tim Johnson
          ... thanks Christian. At long last I have found something that I like better about that editor that starts with e . Since that is pretty much the only thing I
          Message 4 of 5 , May 31, 2014
          • 0 Attachment
            * Christian Brabandt <cblists@...> [140531 05:19]:
            > Hi Tim!
            >
            > On Fr, 30 Mai 2014, Tim Johnson wrote:
            >
            > > I'm using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04.
            > >
            > > I've used vim for many years but have not figured out how to do the
            > > following :
            > >
            > > Make a menu item coded for a specific filetype *not* be present in a
            > > buffer of a different filetype.
            > >
            > > Example : with python.vim, a menu for python-specific actions is
            > > installed. Switching to a javascript buffer, the python menu
            > > remains. It would be great if it were to go away.
            >
            > I think, all that is possible is to disable a certain menu but you can't
            > actually removed it once it was defined.
            thanks Christian. At long last I have found something that I like
            better about that editor that starts with 'e'. Since that is
            pretty much the only thing I like better .... I wonder if the
            following is possible in vim :

            Disable the installation of filetype-specific menus.
            Of course I could do it by tweaking the code of the .vim source
            file, but that is a "rigged" solution IMHO. Is there a vim
            command that would stop a menu from being loaded in the first
            place?
            This would be useful if I were using an alternate computer, such
            as one of my netbooks with a small screen which might not be able
            to accomadate the number of menus that might accumulate if I have
            a session with multiple filetypes.

            thanks
            --
            Tim
            tim at tee jay forty nine dot com or akwebsoft dot com
            http://www.akwebsoft.com, http://www.tj49.com

            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Tony Mechelynck
            ... Since you would want to make a menu appear or disappear depending on which file was current (even when editing files of different types side-by-side, let s
            Message 5 of 5 , Jun 6, 2014
            • 0 Attachment
              On 31/05/14 20:57, Tim Johnson wrote:
              > * Christian Brabandt <cblists@...> [140531 05:19]:
              >> Hi Tim!
              >>
              >> On Fr, 30 Mai 2014, Tim Johnson wrote:
              >>
              >>> I'm using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04.
              >>>
              >>> I've used vim for many years but have not figured out how to do the
              >>> following :
              >>>
              >>> Make a menu item coded for a specific filetype *not* be present in a
              >>> buffer of a different filetype.
              >>>
              >>> Example : with python.vim, a menu for python-specific actions is
              >>> installed. Switching to a javascript buffer, the python menu
              >>> remains. It would be great if it were to go away.
              >>
              >> I think, all that is possible is to disable a certain menu but you can't
              >> actually removed it once it was defined.
              > thanks Christian. At long last I have found something that I like
              > better about that editor that starts with 'e'. Since that is
              > pretty much the only thing I like better .... I wonder if the
              > following is possible in vim :
              >
              > Disable the installation of filetype-specific menus.
              > Of course I could do it by tweaking the code of the .vim source
              > file, but that is a "rigged" solution IMHO. Is there a vim
              > command that would stop a menu from being loaded in the first
              > place?
              > This would be useful if I were using an alternate computer, such
              > as one of my netbooks with a small screen which might not be able
              > to accomadate the number of menus that might accumulate if I have
              > a session with multiple filetypes.
              >
              > thanks
              >

              Since you would want to make a menu appear or disappear depending on
              which file was current (even when editing files of different types
              side-by-side, let's say an HTML page with its CSS and JS included
              scripts), you would need to have BufEnter autocommands to set the menus
              you want in the window being entered but not in others, and BufLeave
              autocommands to unset them when leaving. Or you might disable them
              instead, which would not entail full re-creation; I don't know whether
              in that case the disabled menus would be hidden or just greyed-out.

              Best regards,
              Tony.
              --
              "With so many mindbytes to be downloaded, so many mental codons to be
              replicated, it is no wonder that child brains are gullible, open to
              almost any suggestion, vulnerable to subversion, easy prey to Moonies,
              Scientologists and nuns. Like immune-deficient patients, children are
              wide open to mental infections that adults might brush off without
              effort."
              [Richard Dawkins, "Viruses of the Mind"]

              --
              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            Your message has been successfully submitted and would be delivered to recipients shortly.