Add :XchangeClear, deprecate :ExchangeClear

References #28, #29
This commit is contained in:
Tom McDonald 2015-02-14 10:38:48 -05:00
parent 5cb2a3733a
commit e6bf71a53a

View File

@ -98,12 +98,15 @@ function! s:exchange_set(type, ...)
endif endif
endfunction endfunction
function! s:exchange_clear() function! s:exchange_clear(...)
unlet! b:exchange unlet! b:exchange
if exists('b:exchange_matches') if exists('b:exchange_matches')
call s:highlight_clear(b:exchange_matches) call s:highlight_clear(b:exchange_matches)
unlet b:exchange_matches unlet b:exchange_matches
endif endif
if a:0
echohl WarningMsg | echo ":ExchangeClear will be deprecated in favor of :XchangeClear" | echohl None
endif
endfunction endfunction
function! s:save_reg(name) function! s:save_reg(name)
@ -225,7 +228,8 @@ vnoremap <silent> <Plug>(Exchange) :<C-u>call <SID>exchange_set(visualmode(), 1)
nnoremap <silent> <Plug>(ExchangeClear) :<C-u>call <SID>exchange_clear()<CR> nnoremap <silent> <Plug>(ExchangeClear) :<C-u>call <SID>exchange_clear()<CR>
nnoremap <silent> <Plug>(ExchangeLine) :<C-u>set opfunc=<SID>exchange_set<CR>g@_ nnoremap <silent> <Plug>(ExchangeLine) :<C-u>set opfunc=<SID>exchange_set<CR>g@_
command! ExchangeClear call s:exchange_clear() command! ExchangeClear call s:exchange_clear(1)
command! XchangeClear call s:exchange_clear()
if exists('g:exchange_no_mappings') if exists('g:exchange_no_mappings')
finish finish