Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] only GUI colours are supported #17

Closed
balazser opened this issue May 19, 2022 · 4 comments
Closed

[enhancement] only GUI colours are supported #17

balazser opened this issue May 19, 2022 · 4 comments

Comments

@balazser
Copy link

I'm facing an issue something like this
Could you help me with what went wrong and why the conflict sections are not highlighted?

The plugin loads correctly, and the keymapping also does the job, although the highlight is somehow not applied.
In the doc, I can see you mentioned the two highlight groups should be defined, which is done in my case:

 highlights = { -- They must have background color, otherwise the default color will be used
    incoming = 'DiffText',
    current = 'DiffAdd',
  }

DiffText xxx cterm=bold ctermbg=9 gui=bold guibg=Red
DiffAdd xxx ctermbg=4 guibg=DarkBlue

Interestingly this solution from StackOverflow highlights the sections but only with autoloading otherwise, it neither works.

Screenshots

git-conflict.nvim
image
StackOverflow
image

@akinsho
Copy link
Owner

akinsho commented May 19, 2022

@balazser the issue is that you are using cterm colours and this plugin presumes you are using termguicolors and guifg,guibg highlights. Tbh I just assumed everyone was using gui colour. So that will be the issue, you need to use those, or you unfortunately won't be able to get this plugin to work.

@akinsho akinsho changed the title Highlighting doesn't work [enhancement] only GUI colours are supported May 19, 2022
@balazser
Copy link
Author

balazser commented May 19, 2022

Thank you for your quick reply! You are right. If I set set termguicolors then it seems to work.
image

I don't understand how because syn list prints nothing even your plugin works but it seems I still can use your awesome plugin and cterm with this autocmd:

function! ConflictsHighlight() abort
    " https://github.com/jsit/conflict-syntax.vim/blob/master/syntax/conflict.vim
    syn region conflict start="^<<<<<<<.*$" end="^>>>>>>>.*$" keepend contains=DiffAdd,conflictCommon,DiffText

    syn region DiffAdd start="^<<<<<<<.*$" end="^|||||||\|=======$"me=e-7 keepend contains=conflictMarker
    syn region conflictCommon start="^|||||||.*$" end="^=======$"me=e-7 keepend contains=conflictMarker
    syn region DiffText start="^=======" end="^>>>>>>>.*$" keepend contains=conflictMarker

    syn match conflictMarker "^\(<<<<<<<.*\||||||||.*\|>>>>>>>.*\|=======\)$" contained
endfunction
augroup MyColors
    autocmd!
    autocmd BufEnter * call ConflictsHighlight()
augroup END

image

@akinsho
Copy link
Owner

akinsho commented May 19, 2022

@balazser I think there's a fundamental misunderstanding around what this plugin is doing. It isn't using Vim's built-in syntax matching. It's using neovim's newer buffer extmarks. The example you showed of it working is actually nothing to do with my plugin since actually you have added your own syntax-based highlighting on top of the conflict marker.

@akinsho
Copy link
Owner

akinsho commented Jun 15, 2022

Gonna close this out since there's nothing specific to do here. If someone who uses cterm colors wants to contribute those, please feel free

@akinsho akinsho closed this as completed Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants