История изменений
Исправление xaizek, (текущая версия) :
" ------------------------------------------------------------------------------
" text paste motion
" replace text captured by a {motion} with contents of a register
nnoremap <silent> cp :let g:changepaste_buffer = v:register \| set opfunc=SubstituteMotion<CR>g@
function! SubstituteMotion(type, ...)
let l:reg = g:changepaste_buffer
if a:0
" visual mode, use '< and '> marks
silent exe "normal! `<" . a:type . "`>\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'line'
" linewise
silent exe "normal! '[V']\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'block'
" blockwise-visual
silent exe "normal! `[\<C-V>`]\"_c\<c-r>" . l:reg . "\<esc>"
else
" characterwise
silent exe "normal! `[v`]\"_c\<c-r>" . l:reg . "\<esc>"
endif
endfunction
cpw — заменить часть до начала следующего слова содержимым буфера cpf) — заменить часть до символа ) содержимым буфера и т.д.
Исправление xaizek, :
" ------------------------------------------------------------------------------
" text paste motion
" Replace text captured by a {motion} with contents of a register.
nnoremap <silent> cp :let g:changepaste_buffer = v:register \| set opfunc=SubstituteMotion<CR>g@
function! SubstituteMotion(type, ...)
let l:reg = g:changepaste_buffer
if a:0 " Invoked from Visual mode, use '< and '> marks.
silent exe "normal! `<" . a:type . "`>\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'line'
silent exe "normal! '[V']\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'block'
silent exe "normal! `[\<C-V>`]\"_c\<c-r>" . l:reg . "\<esc>"
else
silent exe "normal! `[v`]\"_c\<c-r>" . l:reg . "\<esc>"
endif
endfunction
cpw — заменить часть до начала следующего слова содержимым буфера cpf) — заменить часть до символа ) содержимым буфера и т.д.
Исходная версия xaizek, :
" ------------------------------------------------------------------------------
" text paste motion
" Replace text captured by a {motion} with contents of a register.
nnoremap <silent> cp :let g:changepaste_buffer = v:register \| set opfunc=SubstituteMotion<CR>g@
function! SubstituteMotion(type, ...)
let l:reg = g:changepaste_buffer
if a:0 " Invoked from Visual mode, use '< and '> marks.
silent exe "normal! `<" . a:type . "`>\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'line'
silent exe "normal! '[V']\"_c\<c-r>" . l:reg . "\<esc>"
elseif a:type == 'block'
silent exe "normal! `[\<C-V>`]\"_c\<c-r>" . l:reg . "\<esc>"
else
silent exe "normal! `[v`]\"_c\<c-r>" . l:reg . "\<esc>"
endif
endfunction
cpw — заменить часть до конца текущего слова содержимым буфера cpf) — заменить часть до символа ) содержимым буфера и т.д.