rhysd / clever-f.vim

Extended f, F, t and T key mappings for Vim.
https://rhysd.github.io/clever-f.vim
1.01k stars 44 forks source link

Mark character color, how get it working? #19

Closed ReneFroger closed 1 year ago

ReneFroger commented 9 years ago

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

rhysd commented 9 years ago

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.

ReneFroger commented 9 years ago

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?

rhysd commented 9 years ago

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

ReneFroger commented 9 years ago

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?

smhmd commented 4 years ago

any updates?

rhysd commented 4 years ago

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.

emr-arvig commented 3 years ago

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.

BertrandSim commented 2 years ago

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