NLKNguyen / papercolor-theme

:art: Light & Dark Vim color schemes inspired by Google's Material Design

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I change cursor color in Neovim Lua?

jeschkies opened this issue Β· comments

πŸ‘‹ I'm using Neovim and love this theme. However, the cursor is too light. How can I change its color via Lua?

You can do it in VimL. I'm not sure how to do it via Lua in NeoVim.
There is instruction for overriding colors in README. You can look up names of colors you want to override here https://github.com/NLKNguyen/papercolor-theme/blob/master/colors/PaperColor.vim#L126 or here https://github.com/NLKNguyen/papercolor-theme/blob/master/DESIGN.md#color-names

Example:

let g:PaperColor_Theme_Options = {
  \   'theme': {
  \     'default.dark': {
  \       'override' : {
  \           'cursor_fg' : ['#1c1c1c', '234'],
  \           'cursor_bg' : ['#c6c6c6', '251'],
  \       }
  \     }
  \   }
  \ }

For anyone stumbling across this issue while looking for lua to dict syntax (as I did), I think it would look something like this:

vim.g.PaperColor_Theme_Options = {
     theme = {
       ['default.dark'] = {
         override = {
             cursor_fg = {'#1c1c1c', '234'},
             cursor_bg = {'#c6c6c6', '251'},
         }
       }
     }
   }

Key differences:

  • string keys are unquoted, except for default.dark, which uses lua's [] syntax to make a complex string.
  • Lists use the {} syntax rather than []
  • let g: becomes vim.g

Thanks it worked. Except that I had to correct the second line to theme =.