Skip to main content
added 88 characters in body
Source Link
Mass
  • 14.4k
  • 1
  • 23
  • 48

There's no way to do this directly with highlight! since links and groups are fundamentally different. You can have a highlight that is a link or a highlight with properties, you can't have both.

Instead you can try to use hlget and hlset as follows:

let resolve = v:true   " set to v:false if not wanting to resolve links

let hl = hlget('CocSemVariable', resolve)[0]
let hl.name = 'CocSemMutableVariable'
let hl.cterm = {'underline': v:true}
let hl.gui = {'underline': v:true}
call hlset([hl])

Of course, this is not a real link and vim is not blending anything. If you modify CocSemVariable, these changes will not appear in CocSemMutableVariable. You can mitigate this to some extent via

function! Tweaks()
   ... code from above ...
endfunction
au ColorScheme * call Tweaks()

So that when groups are changed through changing colorschemes (the usual situation), the dependent groups are automatically updated.

There's no way to do this directly with highlight! since links and groups are fundamentally different. You can have a highlight that is a link or a highlight with properties, you can't have both.

Instead you can try to use hlget and hlset as follows:

let hl = hlget('CocSemVariable')[0]
let hl.name = 'CocSemMutableVariable'
let hl.cterm = {'underline': v:true}
let hl.gui = {'underline': v:true}
call hlset([hl])

Of course, this is not a real link and vim is not blending anything. If you modify CocSemVariable, these changes will not appear in CocSemMutableVariable. You can mitigate this to some extent via

function! Tweaks()
   ... code from above ...
endfunction
au ColorScheme * call Tweaks()

So that when groups are changed through changing colorschemes (the usual situation), the dependent groups are automatically updated.

There's no way to do this directly with highlight! since links and groups are fundamentally different. You can have a highlight that is a link or a highlight with properties, you can't have both.

Instead you can try to use hlget and hlset as follows:

let resolve = v:true   " set to v:false if not wanting to resolve links

let hl = hlget('CocSemVariable', resolve)[0]
let hl.name = 'CocSemMutableVariable'
let hl.cterm = {'underline': v:true}
let hl.gui = {'underline': v:true}
call hlset([hl])

Of course, this is not a real link and vim is not blending anything. If you modify CocSemVariable, these changes will not appear in CocSemMutableVariable. You can mitigate this to some extent via

function! Tweaks()
   ... code from above ...
endfunction
au ColorScheme * call Tweaks()

So that when groups are changed through changing colorschemes (the usual situation), the dependent groups are automatically updated.

Source Link
Mass
  • 14.4k
  • 1
  • 23
  • 48

There's no way to do this directly with highlight! since links and groups are fundamentally different. You can have a highlight that is a link or a highlight with properties, you can't have both.

Instead you can try to use hlget and hlset as follows:

let hl = hlget('CocSemVariable')[0]
let hl.name = 'CocSemMutableVariable'
let hl.cterm = {'underline': v:true}
let hl.gui = {'underline': v:true}
call hlset([hl])

Of course, this is not a real link and vim is not blending anything. If you modify CocSemVariable, these changes will not appear in CocSemMutableVariable. You can mitigate this to some extent via

function! Tweaks()
   ... code from above ...
endfunction
au ColorScheme * call Tweaks()

So that when groups are changed through changing colorschemes (the usual situation), the dependent groups are automatically updated.