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

44149Re: Terminal-based auto-paste.

Expand Messages
  • Yakov Lerner
    Jul 7, 2006
    • 0 Attachment
      On 7/7/06, Sean Reifschneider <jafo@...> wrote:
      > On Fri, Jul 07, 2006 at 11:35:41AM +0300, Yakov Lerner wrote:
      > >On 7/7/06, Sean Reifschneider <jafo@...> wrote:
      > >>What I'm really looking for is that when I paste using the mouse, that
      > >>"paste" is set.
      > >
      > >How about this
      > >
      > >:map <MiddleMouse> :set paste<cr>"*p:set nopaste<cr>
      > >and similar thing for imap
      > I believe that's what vim does when you do "set mouse". I would like to be
      > able to do that when I do not have "set mouse", based on number of
      > characters in the input buffer, or characters read in the last 100ms or
      > something.

      It's interesting idea to detect paste from mouse when 'set mouse' is
      empty based on the size of typeahead buffer. I don't want to
      disappoint you. But I believe there is no possibility to automatically
      do something based on number of character in the input buffer.

      It would probably be useful to tell vim to react only to
      MiddleMouse and ignore all other mouse events. This might be
      possible by setting 'set mouse=' to nonempty and then redefining
      all mouse events except <MiddleMouse> to <nop>s. This might
      lead you to what you want. To see mouse events that you'll
      need to redefine: :help <*Mouse<tab>

      If you insist on having 'set mouse' empty, then I believe
      you're left with one of the following:

      1) just ':set paste', or
      2) :set nocindent indentexpr= indentkeys= nosmartindent=
      3) or some mapping like map <f5> :set paste!<cr>
      or some one-key mapping to (2)

      I personally use (2): absolutely no autoindenting.

    • Show all 25 messages in this topic