aboutsummaryrefslogtreecommitdiff
path: root/autoload/replace_operator.vim
blob: c152657572e34c7c89ee7a26b47208f5caa3dbcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
" Replace the operated text with the contents of a register
function! replace_operator#Operatorfunc(type) abort
  let l:text = getreg()
  if a:type ==# 'v' || a:type ==# 'V' || a:type ==# "\<C-V>"
    normal! gvd
  elseif a:type ==# 'line'
    normal! `[V`]d
  else
    normal! `[v`]d
  endif
  call setreg(v:register, l:text)
  normal! P
endfunction