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

Re: Possible bug related to visual mode

Expand Messages
  • Andy Wokula
    An attempt to implement v_R: File: vbreplace.vim Created: 2007 Oct 02 Last Change: 2007 Oct 02 Implement v_b_R: works like v_b_I, but
    Message 1 of 6 , Oct 2 10:48 AM
      An attempt to implement v_R:

      " File: vbreplace.vim
      " Created: 2007 Oct 02
      " Last Change: 2007 Oct 02

      " Implement v_b_R: works like v_b_I, but starts replace mode in every line.
      " This is different from v_s (change the selection).
      " Note: You should stick with Esc and Ctrl-C to quit replace mode.

      vno R :<c-u>call <sid>Rstart()<cr>R

      func! <sid>Rstart()
      if visualmode() != "\<c-v>"
      return
      endif
      let s:col = virtcol(".")
      ino <esc> <esc>:call <sid>Repeat()<cr>
      ino <c-c> <c-c>:call <sid>Rend()<cr>
      endfunc

      func! <sid>Repeat()
      let sav_ve = &ve
      " set virtualedit+=onemore
      set virtualedit=all
      " without ve: would change the last char of a line if one column behind
      exec "'<,'>g/\\%>".(s:col-1).'v/normal! '.s:col.'|.'
      normal! `<m[
      let &ve = sav_ve
      call <sid>Rend()
      endfunc

      func! <sid>Rend()
      iun <esc>
      iun <c-c>
      endfunc

      " just found a bug:
      " :set ve+=onemore
      "
      " works with "2|", but not with ":normal! 2|" (check out with the above
      " line)

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Richard Hartmann
      On 02/10/2007, Andy Wokula wrote: Heh, thanks. I am really amazed by the community around vim :) Did you put that script on the Wiki? I
      Message 2 of 6 , Oct 4 4:21 PM
        On 02/10/2007, Andy Wokula <anwoku@...> wrote:


        Heh, thanks. I am really amazed by the community around vim :)

        Did you put that script on the Wiki? I suspect others might like
        it, as well.


        Richard

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