I want to define a command that jumps to the next closest Chinese period or Chinese comma and perhaps other punctuations, and another command that does the same but for the previous closest punctuation.
To simplify the situation, let us say I want to jump to the next/previous closest x, y, or z.
So I defined in ~/.vimrc
map <silent> <C-k> ?[xyz]<CR> :noh<CR>
map <silent> <C-j> /[xyz]<CR> :noh<CR>
And try this in such line:
abcx1y2z3def abcx1y2z3def abcx1y2z3def
But when I place my cursor at a, press ctrl-j, the cursor jumps to 1; again press ctrl-j, then to 2; again press ctrl-j, then to 3.
It always jumps to the character on the right of the next match.
And when I place my cursor at f, and press ctrl-k, the cursor jumps to 3; again press ctrl-k many times, but no use. It only jumps to the character on the right of the previous match.
Despite that, when I press /[xyz]<CR> :noh<CR> or ?[xyz]<CR> :noh<CR> explicitly, I get desired behavior.
Why? Have I made some syntax errors?
:noh<CR>part. – nobe4 Dec 20 '16 at 17:39