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

Re: Manipulate selected text

Expand Messages
  • Tony Mechelynck
    ... I have selectmode set to key,mouse , meaning that it will be started by a mouse drag, by a shift-click or by a shift-arrow key, but not by hitting v V
    Message 1 of 9 , Oct 1, 2011
    • 0 Attachment
      On Sep 30, 7:13 pm, Kyle Lippincott <spect...@...> wrote:
      > It probably depends on selectmode then.. I think by default on Marin
      > behavior it's only set to 'mouse', but I set it to all three
      > (including 'cmd') before writing that.  Even more reason for me to
      > dislike the feature - too hard to tell what's going to happen ;)

      I have 'selectmode' set to "key,mouse", meaning that it will be
      started by a mouse drag, by a shift-click or by a shift-arrow key, but
      not by hitting v V or Ctrl-V

      I see that 'selectmode' is set by the :behave command; I use
      neither :behave mswin nor :behave xterm but some intermediate values,
      as follows:
      set selectmode=mouse,key
      set mousemodel=popup
      set keymodel=startsel
      set selection=inclusive

      Best regards,
      Tony.
      --
      Reader, suppose you were an idiot. And suppose you were a member of
      Congress. But I repeat myself.
      -- Mark Twain

      --
      You received this message from the "vim_mac" 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
    • Carl Jacobsen
      ... Another similar approach (and what I usually use) is with marks; set a mark at one end of the range, then maneuver to the other end of the range and set
      Message 2 of 9 , Oct 6, 2011
      • 0 Attachment
        On Thu, 29 Sep 2011, Andrew Stewart wrote:

        > On Sep 29, 4:07 pm, bterkuile <bterku...@...> wrote:
        >> How can I fix this? Or is there even a better way of doing this
        >> (meaning typing commands, not just replacing text). I cannot find the
        >> solution on google.
        >
        > Yes, use ranges. Turn on line numbers with `:set number`, then to
        > substitute (for example) over lines 4 to 6 use `:4,6s/foo/bar/g`. See
        > `:help range` for other line numbers you can use, such as % (the whole
        > file), $ (the last line in the file), and so on. You can even use
        > offsets.

        Another similar approach (and what I usually use) is with marks; set
        a mark at one end of the range, then maneuver to the other end of the
        range and set another mark (e.g. I'll often mark the top line using
        "ma" and the bottom line with "mb"), then use:

        :'a,'bs/foo/bar/g

        I suppose it's more keystrokes than using "v" for visual mode, but it
        has worked since long before Vim arrived on the scene, and it isn't
        subject to the changes in behavior depending on various options that
        this thread seems to be finding. See ":help mark-motions" for more.

        Cheers,
        Carl

        --
        You received this message from the "vim_mac" 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
      • Benjamin ter Kuile
        After using the good old terminal vim for a while again I will give it another shot. Thanks for all the suggestions/workarounds. The many tips to work around
        Message 3 of 9 , Nov 15, 2011
        • 0 Attachment
          After using the good old terminal vim for a while again I will give it another shot. Thanks for all the suggestions/workarounds. The many tips to work around the problems shows how versatile vim is. For me there were two tips that made it work for me, so here the summary:

          typing ctrl-g when text is selected makes it possible to do actions on the selected text (not replacing it) (thanks to Kyle Lippincott)
          And my final solution given by Tony Mechelynck, add the following to your ~/.gvimrc file:
             set selectmode=mouse,key
             set mousemodel=popup
             set keymodel=startsel
             set selection=inclusive
          This returns the for me expected behaviour. 

          Thanks for the help!

          On 7 October 2011 02:33, Carl Jacobsen <carl@...> wrote:
          On Thu, 29 Sep 2011, Andrew Stewart wrote:

          On Sep 29, 4:07 pm, bterkuile <bterku...@...> wrote:
          How can I fix this? Or is there even a better way of doing this (meaning typing commands, not just replacing text). I cannot find the solution on google.

          Yes, use ranges.  Turn on line numbers with `:set number`, then to substitute (for example) over lines 4 to 6 use `:4,6s/foo/bar/g`.  See `:help range` for other line numbers you can use, such as % (the whole file), $ (the last line in the file), and so on.  You can even use offsets.

          Another similar approach (and what I usually use) is with marks; set a mark at one end of the range, then maneuver to the other end of the range and set another mark (e.g. I'll often mark the top line using "ma" and the bottom line with "mb"), then use:

                 :'a,'bs/foo/bar/g

          I suppose it's more keystrokes than using "v" for visual mode, but it has worked since long before Vim arrived on the scene, and it isn't subject to the changes in behavior depending on various options that this thread seems to be finding. See ":help mark-motions" for more.

          Cheers,
          Carl


          --
          You received this message from the "vim_mac" 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 from the "vim_mac" 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
        Your message has been successfully submitted and would be delivered to recipients shortly.