In my .vimrc:
noremap z w
When I examine the mappings, :map z shows only:
z * w
When I press z, my cursor moves as expected (to the next word). However, when I try to use something like diz or ciz, nothing happens. At the bottom of my screen, di andci appear as I'm typing them, but once I type z, Vim gleefully sits idle. diw and ciw still work as expected.
What else do I need to do? Is there a mapping mode I don't know about?
On MS-Windows, if the mswin. vim file is used, then CTRL-V is mapped to paste text from the clipboard. In this case, you can use CTRL-Q or CTRL+SHIFT+V instead of CTRL-V to escape control characters. In the above command to enter a single ^V, you have to press Ctrl and v.
@geowa4, J was probably down because Ctrl+J is line feed in ASCII.
The problem is that iw is a single text object, it is not modifier i + motion w. You need to map iz and az in this case:
onoremap iz iw
onoremap az aw
. Note that this will wait for you to press z only for some amount of time (see :h 'timeoutlen'). To make it work like iw (e.g., wait for z forever), you should try the following:
function s:MapTOPart(tostart)
let char=getchar()
if type(char)==type(0)
let char=nr2char(char)
endif
return a:tostart.((char is# 'z')?('w'):(char))
endfunction
onoremap iz iw
onoremap az aw
onoremap <expr> i <SID>MapTOPart('i')
onoremap <expr> a <SID>MapTOPart('a')
You will have to do the same for all i* and a* text objects you use because with the above code only iz and az works fine; for some reason iw must be either typed too slow or typed as iww.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With