From fc9adf1cfe95f7318763cccc6b48dcca847edd88 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 21 Apr 2021 23:56:40 +0200 Subject: [PATCH] feat: optional italic for variables (fix #8) --- README.md | 1 + lua/tokyonight/config.lua | 1 + lua/tokyonight/theme.lua | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 02146d1..f5427e7 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ The theme comes in two styles, `storm` and a darker variant `night`. | tokyonight_italic_comments | `true` | Make comments italic | | tokyonight_italic_keywords | `true` | Make keywords italic | | tokyonight_italic_functions | `false` | Make functions italic | +| tokyonight_italic_variables | `false` | Make variables and identifiers italic | | tokyonight_transparent | `false` | Enable this to disable setting the background color | | tokyonight_hide_inactive_statusline | `false` | Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. | | tokyonight_sidebars | `{}` | Set a darker background on sidebar-like windows. For example: `["quickfix", "__vista__", "terminal"]` | diff --git a/lua/tokyonight/config.lua b/lua/tokyonight/config.lua index 8e607c9..15d8a64 100644 --- a/lua/tokyonight/config.lua +++ b/lua/tokyonight/config.lua @@ -17,6 +17,7 @@ config = { commentStyle = opt("italic_comments", true) and "italic" or "NONE", keywordStyle = opt("italic_keywords", true) and "italic" or "NONE", functionStyle = opt("italic_functions", false) and "italic" or "NONE", + variableStyle = opt("italic_variables", false) and "italic" or "NONE", hideInactiveStatusline = opt("hide_inactive_statusline", false), terminalColors = opt("terminal_colors", true), sidebars = opt("sidebars", {}), diff --git a/lua/tokyonight/theme.lua b/lua/tokyonight/theme.lua index 4c33171..7f566d7 100644 --- a/lua/tokyonight/theme.lua +++ b/lua/tokyonight/theme.lua @@ -89,7 +89,7 @@ function M.setup(config) -- Boolean = { }, -- a boolean constant: TRUE, false -- Float = { }, -- a floating point constant: 2.3e10 - Identifier = { fg = c.magenta }, -- (preferred) any variable name + Identifier = { fg = c.magenta, style = config.variableStyle }, -- (preferred) any variable name Function = { fg = c.blue, style = config.functionStyle }, -- function name (also: methods for classes) Statement = { fg = c.magenta }, -- (preferred) any statement @@ -218,7 +218,7 @@ function M.setup(config) -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. -- TSType = { }; -- For types. -- TSTypeBuiltin = { }; -- For builtin types. - -- TSVariable = { }; -- Any variable name that does not have another highlight. + TSVariable = { style = config.variableStyle }, -- Any variable name that does not have another highlight. TSVariableBuiltin = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. -- TSTag = { }; -- Tags like html tag names. @@ -314,7 +314,7 @@ function M.setup(config) -- Sneak Sneak = { fg = c.bg_highlight, bg = c.magenta }, - SneakScope = { bg = c.bg_visual } + SneakScope = { bg = c.bg_visual }, } -- LuaLine