In my .vimrc,f5 was binded with CheckMark function to change all into ..

function! CheckMark()  
    if search('。')  
        let s:line=search('。')  
        execute s:line . "s/。/\./g" 

map <F5> :call CheckMark()<CR>

How to color the selected character with red ,instead of changing it?

1 Answer 1


You can use the :match command to do this:

:highlight CheckMark ctermfg=red guifg=red
:match CheckMark /。/

If you want this highlighting only to occur when you invoke your mapping, you can replace the contents of your CheckMark() function with the :match command.

See :help :match for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.