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

Re: [vim] howto make menu command depend on mouse click?

Expand Messages
  • Benji Fisher
    ... Menus: I do not think vim can distinguish between different mouse event on the menus. Maybe I am wrong, because it can distinguish between left, right,
    Message 1 of 2 , Jan 31 6:24 PM
      Sven Guckes wrote:
      >
      > From: Olaf Krische <oeschirk@...-berlin.de>
      > Newsgroups: comp.editors
      > Subject: [vim] mouse in menus
      > Date: 29 Jan 2001 20:26:58 GMT
      > Message-ID: <954jmi$fd7mf$1@...>
      > User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (IRIX64/6.4 (IP27))
      > Xref: uni-berlin.de comp.editors:50511
      >
      > Hello all!
      >
      > And i come to my questions: is it possible to give a menu item more
      > context? Maybe, when i click the left mouse button on a menu item
      > the specified command will be executed. And when i click the right button
      > on the item, the name for the item will be inserted into the current text.
      >
      > When it is possible, where can i get the ideas for doing this?
      >
      > The use case:
      >
      > In a source file i have a set of functions and attributes defined and
      > showed as menu items. I can jump to the positions in the sourcefile of the
      > definitions when i click on the menuitem. But sometimes i want to have
      > the name of the functions or attributes too for using them in the
      > sourcefile. I could of course build two menus, one for jump to the
      > positions, one for inserting. But this seems to be a waste of space.
      >
      > Hm.
      >
      > And btw. is it possible to execute perl source files in vim with using
      > the functions of vim for perl? I use perl for creating the menus above,
      > but the definition for the commands for perl on one line is very
      > ugly. Maybe i just need a little tip, that would be great. :-)
      >
      > Thank you!
      >
      > Have a nice day and....bye!

      Menus: I do not think vim can distinguish between different mouse
      event on the menus. Maybe I am wrong, because it can distinguish between
      left, right, shift, etc. mouse clicks. I think that vim leaves menus to
      the GUI, and only understands one sort of click.

      OTOH, you may be able to get what you want using :imenu and :nmenu.
      Something like

      :imenu Mymenu.Foo <CR>Foo<CR>
      :nmenu Mymenu.Foo gg/Foo<CR>

      :help creating-menus
      :help map-modes

      Perl: There is a Perl interface for vim, but it is a compile-time
      option. Check the output of :version for +perl or -perl or :echo
      has("perl"). If your vim has Perl support compiled in then

      :help perl

      should help.

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