Monday, September 29, 2014

Re: How to create blue & white color of status bar for input () function?

Ben,
I was not clear enough. I just wanted to see question to be displayed in blue & white and when Enter is pressed I just don't want to have blue & white color in status bar anymore. I thought that there is some command to define color of status bar to blue & white and after it needs to be reset back to normal black & white color. But like you have now explained there is no need for some kind of status bar coloring, but instead there exists "a color of prompt" and so my blue & white problem is automatically solved after Enter is pressed, because there is no prompt anymore.

I solved the problem with the following code:

function! ReplaceIt()
call inputsave()
echohl DiffAdd
let replacement = input('Type in your name and Enter: ')
echohl None
call inputrestore()
execute '%s/USER_NAME/'.replacement.'/g'
endfunction
:let mapleader = ","
:nnoremap <leader>r :call RepalceIt()

So adding "echohl DiffAdd" before input() function and resetting echo colors to "echohl None" to make sure that any following echo/input() message is not affected by this highlighting.

To see all possible highlight groups to select from, there is a command :highlight

Thanks a lot for help. Problem solved.
Regards

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: