1

In my init.vim configuration script for "Vim" I configure comments to be in italic like this (credits):

highlight Comment cterm=italic gui=italic

This does not work in init.lua for "Neovim". How can I port this settings to Lua in order to use it in "Neovim"?

71GA
  • 1,132
  • 6
  • 36
  • 69

2 Answers2

3

I managed to derive my answer by looking (here). The answer is this:

vim.highlight.create('Comment', {cterm='italic', gui='italic'}, false)
71GA
  • 1,132
  • 6
  • 36
  • 69
2

Using neovim 0.9 here. What actually worked is the following:

vim.api.nvim_set_hl(0, 'Comment', { italic=true })
Lucas Efe
  • 136
  • 2
  • This could be better than my answer. Note that I had to also add `fg = #ffffff` to the array in order for this to work. It seems that it resets fg color of the comments to the default. – 71GA Jan 13 '23 at 20:06