Closed baldore closed 3 years ago
Yes, you can use the sneak#wrap
function, with that you can customize the behavior (:h sneak#wrap
).
Set g:sneak#label = 0
, and define these mappings for "labeled sneak" (change x/X
in the example to the desired keys). The first three arguments after op
correspond to the normal s/S
behavior, and the last argument is set to 2
, that enforces label-mode for the particular command, regardless of the global setting.
nnoremap <silent> x :<C-U>call sneak#wrap('', 2, 0, 2, 2)<CR>
nnoremap <silent> X :<C-U>call sneak#wrap('', 2, 1, 2, 2)<CR>
xnoremap <silent> x :<C-U>call sneak#wrap(visualmode(), 2, 0, 2, 2)<CR>
xnoremap <silent> X :<C-U>call sneak#wrap(visualmode(), 2, 1, 2, 2)<CR>
onoremap <silent> x :<C-U>call sneak#wrap(v:operator, 2, 0, 2, 2)<CR>
onoremap <silent> X :<C-U>call sneak#wrap(v:operator, 2, 1, 2, 2)<CR>
Or equivalently, set g:sneak#label = 1
, and change the last argument to 0
in the function calls above (that enforces "no-label-mode" for the particular command).
It works great! Thanks a lot.
Hello!
Is it possible to have both functionalities at the same time? I would like to be able to use
s
andS
to sneak normally, but have another keybinding to use the labeled one. Is that possible?