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?


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, privacy policy and cookie policy

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