clever-f.vim icon indicating copy to clipboard operation
clever-f.vim copied to clipboard

Mark character color, how get it working?

Open ReneFroger opened this issue 10 years ago • 8 comments

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} ?

ReneFroger avatar Nov 28 '14 23:11 ReneFroger

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.

rhysd avatar Nov 29 '14 02:11 rhysd

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 avatar Nov 29 '14 22:11 ReneFroger

@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.

rhysd avatar Dec 04 '14 02:12 rhysd

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?

ReneFroger avatar Dec 04 '14 23:12 ReneFroger

any updates?

smhmd avatar Feb 10 '20 01:02 smhmd

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.

rhysd avatar Feb 12 '20 07:02 rhysd

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.

emr-arvig avatar Jun 07 '21 14:06 emr-arvig

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

BertrandSim avatar Jul 29 '22 09:07 BertrandSim