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
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui