vim-speeddating icon indicating copy to clipboard operation
vim-speeddating copied to clipboard

Can no longer remap <Plug>SpeedDatingUp if mapping C-a or C-x

Open idbrii opened this issue 6 years ago • 3 comments

I remap increment/decrement and use C-a for select all. The addition of integration with other increment plugins in a418667 breaks user remapping of SpeedDating commands.

" .vimrc
let g:speeddating_no_mappings = 1

" .vim/plugin/speeddating-david.vim
if exists("g:loaded_speeddating") && g:loaded_speeddating
	nmap  <C-x><C-s>     <Plug>SpeedDatingUp
	nmap  <C-x><C-x>     <Plug>SpeedDatingDown
endif


:Verbose nmap <c-x>

n  <C-X><C-X>    <Plug>SpeedDatingDown
	Last set from ~/.vim/after/plugin/speeddating-david.vim line 6
n  <C-X><C-S>    <Plug>SpeedDatingUp
	Last set from ~/.vim/after/plugin/speeddating-david.vim line 5

Inserting a 0, leaving insert mode, executing <C-X><C-X> does not increment the 0. Instead, it selects some portion of the buffer.

The SpeedDatingFallback definition is assuming that anything mapped to C-a or C-x is for inc/decrement. But for me it's not:

:Verbose ec maparg('<C-A>', 'n')
1GVG

I'd assume the same is true for users of mswin.vim too.

idbrii avatar Feb 25 '19 19:02 idbrii

Does something like this fix it?

nnoremap <Plug>SpeedDatingFallbackUp   <C-A>
nnoremap <Plug>SpeedDatingFallbackDown <C-X>

tpope avatar Mar 08 '19 20:03 tpope

Looks like it does. Could that be the default value if g:speeddating_no_mappings == 1 ?

Doesn't fix mswin either.

Feels to me like integrating with other plugins should be an option instead of the default. But I can go with your solution if you want to close.

idbrii avatar Apr 03 '19 05:04 idbrii

I don't really want to change that now, but I'd entertain special casing for not chaining to gggH<C-O>G, or something like that.

tpope avatar Apr 04 '19 03:04 tpope