clever-f.vim
clever-f.vim copied to clipboard
Mark character color, how get it working?
Thanks for sharing this awesome plugin! How does g:clever_f_mark_char_color
work? I found no example by yet.
For example, when I do: g:clever_f_mark_char_color="Statement"
And in my colorscheme the Statement is defined as:
hi Statement guifg=#8a3824 guibg=NONE guisp=NONE gui=bold
But I see no another colors of the matching character when I press f{insert character} ?
Hi, @ReneFroger .
g:clever_f_mark_char_color
should be set before clever-f.vim is loaded (e.g. in your .vimrc
). This is because clever-f.vim defines the highlight of marks in being loaded.
Please write the setting in your .vimrc
and restart Vim.
Thanks for your reply. I tried that already, but it didn't worked. I have set this in my .vimrc:
let g:clever_f_mark_char_color=1
Then restarted my Vimrc. But I see no highlights when I type f{insert random character}.
I found no example of configuration in the well written documentation, my compliments for the quality. Maybe I'm something missing?
@ReneFroger
Sorry for the delay (I was busy last weekend...)
You seem to set wrong variable. What you should do is
let g:clever_f_mark_char = 1
let g:clever_f_mark_char_color = "Statement"
Please try above.
Thanks for your reply, I tried it.
let g:clever_f_mark_char = 1
let g:clever_f_mark_char_color = "Statement"
In my Vimrc. And
hi Statement guifg=#8a3824 guibg=NONE guisp=NONE gui=bold
In my colorscheme.
After restarting Vim, I press f
and typed a character which occurs multiple times on the same sentence. The Clever F is working. But no marks are appearing. As it seems, something is wrong. But where to begin with debugging?
any updates?
At least on my laptop above config I showed works fine with both GUI version and CUI version. What I can say is,
hi Statement guifg=#8a3824 guibg=NONE guisp=NONE gui=bold
this color definition only defines colors for GUI version. It does not make any color on CUI version.
This worked for me
Had to put after colorscheme
highlight CustomH ctermfg=white ctermbg=NONE cterm=bold,underline guifg=white guibg=NONE gui=bold,underline
highlight link CleverFChar CustomH
I am not sure why the highlight link is not working when there is an obvious if statement that should do it, but for whatever reason this is what I had to do.
Changing the :colorscheme
resets all highlights to their defaults (including those specified with :hi link
). That is why the custom highlighting commands have to go after :colorscheme
. This can be mitigated with an autocommand, eg.
function! Highlight-clever-f()
highlight CustomH ctermfg=white ctermbg=NONE cterm=bold,underline guifg=white guibg=NONE gui=bold,underline
highlight link CleverFChar CustomH
endfunction
call Highlight-clever-f()
autocmd Colorscheme * call Highlight-clever-f()
Regarding the setting of
let g:clever_f_mark_char = 1
let g:clever_f_mark_char_color = "Statement"
The highlights will be cleared after a change in colorscheme. This should be fixed in the plugin itself... let me issue a patch for this