diff options
| author | Ellison Leão <ellisonleao@gmail.com> | 2021-03-13 15:03:26 -0300 |
|---|---|---|
| committer | Ellison Leão <ellisonleao@gmail.com> | 2021-03-13 15:03:26 -0300 |
| commit | 888a2b3d2438a5b076067a6e441f5170f50ca745 (patch) | |
| tree | f7181ee1d2011b24e53b9d3c004e7a2bb8e7977f | |
| parent | 391158723f2f4de4ac67d30b2a8e5704fd7a86bc (diff) | |
| download | gruvbox-888a2b3d2438a5b076067a6e441f5170f50ca745.tar.gz gruvbox-888a2b3d2438a5b076067a6e441f5170f50ca745.tar.xz | |
adding tobool func helper
| -rw-r--r-- | lua/gruvbox/init.lua | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/lua/gruvbox/init.lua b/lua/gruvbox/init.lua index 4cc811e..8dc7865 100644 --- a/lua/gruvbox/init.lua +++ b/lua/gruvbox/init.lua @@ -61,28 +61,35 @@ for k, val in pairs(settings) do end end +local function tobool(val) + if val == 0 or not val then + return false + end + return true +end + -- styles check -if not vim.g.gruvbox_bold then +if not tobool(vim.g.gruvbox_bold) then styles.bold = "" end -if not vim.g.gruvbox_underline then +if not tobool(vim.g.gruvbox_underline) then styles.underline = "" end -if not vim.g.gruvbox_italic then +if not tobool(vim.g.gruvbox_italic) then styles.italic = "" end -if not vim.g.gruvbox_inverse then +if not tobool(vim.g.gruvbox_inverse) then styles.inverse = "" end -if not vim.g.gruvbox_inverse then +if not tobool(vim.g.gruvbox_inverse) then styles.inverse = "" end -if not vim.g.gruvbox_undercurl then +if not tobool(vim.g.gruvbox_undercurl) then styles.undercurl = "" end @@ -150,32 +157,32 @@ if vim.g.gruvbox_vert_split ~= nil then end local invert_signs -if vim.g.gruvbox_invert_signs then +if tobool(vim.g.gruvbox_invert_signs) then invert_signs = styles.inverse end local invert_selection = styles.inverse -if not vim.g.gruvbox_invert_selection then - invert_selection = nil +if not tobool(vim.g.gruvbox_invert_selection) then + invert_selection = "NONE" end local invert_tabline -if vim.g.gruvbox_invert_tabline then +if tobool(vim.g.gruvbox_invert_tabline) then invert_tabline = styles.inverse end local tabline_sel = green -if vim.g.gruvbox_tabline_sel then +if tobool(vim.g.gruvbox_tabline_sel) then tabline_sel = hsl(colors[vim.g.gruvbox_tabline_sel]) end local italic_comments = styles.italic -if not vim.g.gruvbox_italicize_comments then - italic_comments = "" +if not tobool(vim.g.gruvbox_italicize_comments) then + italic_comments = "NONE" end local italic_strings = "NONE" -if vim.g.gruvbox_italicize_strings then +if tobool(vim.g.gruvbox_italicize_strings) then italic_strings = styles.italic end |
