Answer the question
In order to leave comments, you need to log in
How to override keystroke sequence?
I
want to redefine the keys in such a way that, for example:
space + u does Ctrl + u
But at the same time:
space + uu does Ctrl +
uu i press u a second time (without releasing space the first time), then u works like undo .
But I want the space key to work the same way as the Ctrl key, when I hold down Ctrl once and then press u as many times as I wantnnoremap <space>u <C-u>
while holding down Ctrl .
What to do?
Answer the question
In order to leave comments, you need to log in
It seems to me that you want something very strange. The keys ctrl, alt, shift, mod, win and others are modifier keys that are tracked in parallel with "regular" alphanumeric keys (including space). And to say that we now have space as a modifier key is obviously to go below the vim level. And that's why nnoremap u works differently - pressing u is regarded by vim as a sequential press: first , then u, you can see.
I support SilentFl, but as an option (and if you're using *nix), you can try using xcape to give space a dual behavior: like Ctrl in combination with another key, and like space when pressed alone.
I don't see the problem: nnoremap uu
When you hit the space bar and u twice, everything works as intended. But it will also work if you press space + u and again space + u.
That is, the second will be the correct behavior, the first - side.
And yes, you will have to work it out as one team, and not as two separate ones.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question