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

Re: Manipulate selected text

Expand Messages
  • Kyle Lippincott
    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
    Message 1 of 9 , Sep 30, 2011
    • 0 Attachment
      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 ;)

      On Sep 30, 2011, at 8:44, Tony Mechelynck <antoine.mechelynck@...> wrote:

      > On Sep 29, 6:26 pm, Kyle Lippincott <spect...@...> wrote:
      >> This sounds an awful lot like select mode to me. Verify before you hit :
      >> that you're in 'VISIUAL' not 'SELECT' mode. Investigate the 'selectmode'
      >> option and 'behave' command to see why this might be getting turned on.
      >> It's meant to mimic Microsoft Windows selection model behavior, but I find
      >> it very confusing..
      >>
      >> If you *want* to use select mode but switch to visual for something, ctrl-o
      >> will switch to visual for one command, ctrl-g will straight up switch. If
      >> you accidentally erase something in select mode when you meant to hit
      >> ctrl-[og] to get to visual first, you can undo it by hitting 'u', then 'gv'
      >> to regain the previous selection (but you'll still be in select mode, so
      >> don't forget the ctrl-o or ctrl-g this time ;)).
      >
      > gv will put you back in Visual mode, even if you were in Select mode
      > before. At least that's how it happens on GTK2 gvim, and I can't see
      > why MacVim would do it differently. Not knowing about Ctrl-G, I've
      > often used <Esc>gv to go from Select to Visual.
      >
      > --
      > 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
    • 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 2 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 3 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 4 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.