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

Mouse in console Vim: only trap left click

Expand Messages
  • Raúl Núñez de Arenas Coronado
    Hi all :) I use console Vim, and I would like to use the mouse to position the cursor into the Vim window, but *only for that*. I want the terminal emulator
    Message 1 of 3 , Jan 29, 2009
    • 0 Attachment
      Hi all :)

      I use console Vim, and I would like to use the mouse to position the
      cursor into the Vim window, but *only for that*. I want the terminal
      emulator control the right click even when using Vim. I'm using Vim
      under Linux, with "set ttymouse=xterm2", BTW.

      I thought that doing "set mouse=a", "set mousemodel=popup" and NOT
      LOADING any menu (so the right click popup won't pop up any menu) the
      terminal would catch the right click. But no, Vim uses an
      "all-or-nothing" approach, just like any other console application I
      know of. Probably is a limitation of the terminal emulator (I've never
      written a program supporting mouse on terminal under Linux, so..).

      Well, adding up, what I want is to position the cursor using left click
      but leave right click to the terminal emulator (so it shows the terminal
      emulator popup menu); what I have is that Vim catches the right click
      too.

      Can this be changed?

      Thanks a lot in advance :)

      Raúl "DervishD" Núñez de Arenas Coronado
      --
      Linux Registered User 88736 | http://www.dervishd.net
      It's my PC and I'll cry if I want to... RAmen!
      We are waiting for 13 Feb 2009 23:31:30 +0000 ...

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Matt Wozniski
      ... I m gonna take a swing at this and say no . At the very least, it s not possible from within vim. When vim takes over the mouse, it sends CSI ? 1000 h
      Message 2 of 3 , Jan 31, 2009
      • 0 Attachment
        On Thu, Jan 29, 2009 at 9:08 AM, Raúl Núñez de Arenas Coronado wrote:
        >
        > Hi all :)
        >
        > I use console Vim, and I would like to use the mouse to position the
        > cursor into the Vim window, but *only for that*. I want the terminal
        > emulator control the right click even when using Vim. I'm using Vim
        > under Linux, with "set ttymouse=xterm2", BTW.
        ...
        > Can this be changed?

        I'm gonna take a swing at this and say "no". At the very least, it's
        not possible from within vim. When vim takes over the mouse, it sends
        CSI ? 1000 h (or CSI ? 1002 h for "xterm2") to the terminal emulator,
        and the terminal emulator takes it from there, encoding mouse clicks
        into strings and sending them to the application. Most terminal
        emulators let you override this behavior per-click by holding in
        shift, but I don't know of any that let you override it
        per-mouse-button. Of course, you could hack the code of your terminal
        emulator to allow it, but there's nothing that can be done from the
        vim side.

        ~Matt

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Raúl Núñez de Arenas Coronado
        Saluton Matt :) ... That s what I supposed, but I wasn t fully sure :( ... Well, not having the terminal emulator right-click popup menu in editing sessions is
        Message 3 of 3 , Feb 1, 2009
        • 0 Attachment
          Saluton Matt :)

          On Sat, 31 Jan 2009 06:52:09 -0500, Matt Wozniski dixit:
          > On Thu, Jan 29, 2009 at 9:08 AM, Raúl Núñez de Arenas Coronado wrote:
          > > I use console Vim, and I would like to use the mouse to position the
          > > cursor into the Vim window, but *only for that*. I want the terminal
          > > emulator control the right click even when using Vim. I'm using Vim
          > > under Linux, with "set ttymouse=xterm2", BTW.
          > ..
          > > Can this be changed?
          >
          > I'm gonna take a swing at this and say "no". At the very least, it's
          > not possible from within vim. When vim takes over the mouse, it sends
          > CSI ? 1000 h (or CSI ? 1002 h for "xterm2") to the terminal emulator,

          That's what I supposed, but I wasn't fully sure :(

          > Of course, you could hack the code of your terminal emulator to allow
          > it, but there's nothing that can be done from the vim side.

          Well, not having the terminal emulator right-click popup menu in editing
          sessions is not a great deal, really. It would be good, but it's very
          usable as-is. Hacking the terminal emulator sources just for that
          doesn't worth the effort, specially because that would involve hacking
          libvte, probably.

          Thanks a lot for the explanation, Matt :))

          Raúl "DervishD" Núñez de Arenas Coronado
          --
          Linux Registered User 88736 | http://www.dervishd.net
          It's my PC and I'll cry if I want to... RAmen!
          We are waiting for 13 Feb 2009 23:31:30 +0000 ...

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.