Skip to content

Instantly share code, notes, and snippets.

@airblade
Last active February 4, 2020 12:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airblade/f78946ed45ac10011ef8 to your computer and use it in GitHub Desktop.
Save airblade/f78946ed45ac10011ef8 to your computer and use it in GitHub Desktop.
Vim highlight groups

Changing attributes on a group linked to another disconnects the link

Link a highlight group to another.

:hi link Foo Comment

:hi Foo
Foo  xxx links to Comment

Setting attributes on the group disconnects the link.

:hi Foo guifg=red

:hi Foo
Foo  xxx guifg=red

A group with attributes can only be linked to another group with highlight!

:hi Bar guifg=red

:hi Bar
Bar  xxx guifg=red

:hi link Bar Comment
E414: group has settings, highlight link ignored

:hi! link Bar Comment
Bar  xxx guifg=red
         links to Comment

This combines the attributes and the link.

Linking an already linked group overrules the first link unless default is used

:hi link Baz Comment

:hi Baz
Baz  xxx links to Comment

:hi link Baz Operator

:hi Baz
Baz  xxx links to Operator

:hi default link Baz Keyword

:hi Baz
Baz  xxx links to Operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment