rhysd / conflict-marker.vim

Weapon to fight against conflicts in Vim.
488 stars 18 forks source link

Highlighting doesn't work #17

Open AnatoleLucet opened 3 years ago

AnatoleLucet commented 3 years ago

This plugin seems great, but I can't get the highlighting to work.

image The errors signs are from CoC, I assume this plugin might interfere with it?

Neither the default nor the example in the readme works. I'm a vim newbie, so I don't really know what info to provide, but feel free to ask me.

AnatoleLucet commented 3 years ago

Fixed it by installing: https://github.com/vim-scripts/guicolorscheme.vim It doesn't seem to work with every themes though.

AnatoleLucet commented 3 years ago

Well, I was wrong. It didn't fix it. it seems like this plugin's highlighting doesn't work with some themes. For example is doesn't work with one dark

ranelpadon commented 3 years ago

Highlighting works on my end, and I'm using Neovim and One Dark theme:

Screen Shot 2021-03-15 at 9 16 43 AM

Need to set these though:

" disable the default highlight group
let g:conflict_marker_highlight_group = ''

" Include text after begin and end markers
let g:conflict_marker_begin = '^<<<<<<< .*$'
let g:conflict_marker_end   = '^>>>>>>> .*$'

highlight ConflictMarkerBegin guifg=#e06c75
highlight ConflictMarkerOurs guibg=#2e5049
highlight ConflictMarkerSeparator guifg=#e06c75
highlight ConflictMarkerTheirs guibg=#344f69
highlight ConflictMarkerEnd guifg=#e06c75
reybeamde commented 3 years ago

Also 'NLKNguyen/papercolor-theme' is not working, with ranelpadon seetings. (vim 8.2 and nvim 0.5)

mosheavni commented 3 years ago

Highlight doesn't work for me either, tried palenight and one-dark, also added this to vimrc:

highlight ConflictMarkerBegin guifg=#e06c75
highlight ConflictMarkerOurs guibg=#2e5049
highlight ConflictMarkerSeparator guifg=#e06c75
highlight ConflictMarkerTheirs guibg=#344f69
highlight ConflictMarkerEnd guifg=#e06c75
ranelpadon commented 3 years ago

@reybeamde @mosheavni Make sure that this is set:

let g:conflict_marker_highlight_group = ''

and highlight overrides should come after the colorscheme is loaded/set. Or try to move those overrides at the bottom of your .vimrc or init.vim.

mosheavni commented 3 years ago

@reybeamde @mosheavni Make sure that this is set:

let g:conflict_marker_highlight_group = ''

and highlight overrides should come after the colorscheme is loaded/set. Or try to move those overrides at the bottom of your .vimrc or init.vim.

ok it's working after moving it after setting the colorscheme, however, why's that? Why can't this plugin have its own highlight group and just set its own syntax matching and highlights? Thanks.

ranelpadon commented 3 years ago

@mosheavni IIRC, based on customizing the highlighting in other Vim plugins, they usually advise to do the override after the colorscheme is loaded since it sets its own highlighting group as well. I think because the last setting/highlighting will win, just like when overriding a variable. Otherwise, the colorscheme will win if you set your custom highlighting too early. Cheers.

aprowe commented 2 years ago

I was able to fix highlighting with a timer function to defer the highlighting:

function! HighlightConflictMarker() abort
    highlight ConflictMarkerBegin guibg=#2f7366
    highlight ConflictMarkerOurs guibg=#2e5049
    highlight ConflictMarkerTheirs guibg=#344f69
    highlight ConflictMarkerEnd guibg=#2f628e
    highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81
endfunction
call timer_start(200, { tid -> execute('call HighlightConflictMarker()') })
" OR 
" autocmd VimEnter * call HighlightConflictMarker()
lytex commented 2 years ago

I got it working using terminal colors instead of gui:

" from https://michurin.github.io/xterm256-color-picker/
highlight ConflictMarkerBegin ctermbg=34 
highlight ConflictMarkerOurs ctermbg=22  
highlight ConflictMarkerTheirs ctermbg=27 
highlight ConflictMarkerEnd ctermbg=39 
highlight ConflictMarkerCommonAncestorsHunk ctermbg=yellow