Skip to content

Commit

Permalink
Replace o with go
Browse files Browse the repository at this point in the history
This is to reflect a recent neovim update that has changed how to set global options
  • Loading branch information
Th3Whit3Wolf authored Jun 2, 2021
1 parent cafd48c commit d6e62bc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lua/one-nvim.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local vim, api, fn, exe = vim, vim.api, vim.fn, vim.api.nvim_command
local vim, api, fn, exe, go = vim, vim.api, vim.fn, vim.api.nvim_command, vim.go

--[[ VARIABLES ]]
-- These are constants for the indexes in the colors that were defined before.
Expand All @@ -10,8 +10,8 @@ local _TYPE_STRING = 'string'
local _TYPE_TABLE = 'table'

-- Determine which set of colors to use.
local _USE_HEX = vim.o.termguicolors
local _USE_256 = tonumber(vim.go.t_Co) > 255
local _USE_HEX = go.termguicolors
local _USE_256 = tonumber(go.t_Co) > 255
or string.find(vim.env.TERM, '256')

--[[ HELPER FUNCTIONS ]]
Expand Down Expand Up @@ -68,7 +68,7 @@ local function tohex(rgb) return string.format('#%06x', rgb) end
-- Load specific &bg instructions
local function use_background_with(attributes)
return setmetatable(
attributes[vim.o.background],
attributes[go.background],
{['__index'] = attributes}
)
end
Expand All @@ -78,7 +78,7 @@ end
local highlite = {}

function highlite.group(group_name)
local no_errors, group_definition = pcall(api.nvim_get_hl_by_name, group_name, vim.o.termguicolors)
local no_errors, group_definition = pcall(api.nvim_get_hl_by_name, group_name, go.termguicolors)

if not no_errors then group_definition = {} end

Expand Down Expand Up @@ -108,7 +108,7 @@ function highlite.highlight(highlight_group, attributes) -- {{{ †
highlight_cmd[5] = attributes
else -- The `highlight_group` is uniquely defined.
-- Take care of special instructions for certain background colors.
if attributes[vim.o.background] then
if attributes[go.background] then
attributes = use_background_with(attributes)
end

Expand All @@ -130,7 +130,7 @@ end

function highlite:highlight_terminal(terminal_ansi_colors)
for index, color in ipairs(terminal_ansi_colors) do
vim.g['terminal_color_'..index] = vim.o.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI)
vim.g['terminal_color_'..index] = go.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI)
end
end

Expand Down Expand Up @@ -167,7 +167,7 @@ return setmetatable(highlite, {
color_name = nil

-- If we aren't using hex nor 256 colorsets.
if not (_USE_HEX or _USE_256) then vim.go.t_Co = '16' end
if not (_USE_HEX or _USE_256) then go.t_Co = '16' end

-- Highlight the baseline.
self.highlight('Normal', normal)
Expand Down

0 comments on commit d6e62bc

Please sign in to comment.