chore: formated with stylua (#32)

Apply initial stylua format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2021-09-04 00:28:20 +06:00 committed by GitHub
parent 4042e837f8
commit db448f41e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 1481 additions and 1261 deletions

View File

@ -15,54 +15,48 @@ local colors = {
local bubbles_theme = {
normal = {
a = {fg = colors.black, bg = colors.violet},
b = {fg = colors.white, bg = colors.grey},
c = {fg = colors.black, bg = colors.black},
a = { fg = colors.black, bg = colors.violet },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.black, bg = colors.black },
},
insert = {a = {fg = colors.black, bg = colors.blue}},
visual = {a = {fg = colors.black, bg = colors.cyan}},
replace = {a = {fg = colors.black, bg = colors.red}},
insert = { a = { fg = colors.black, bg = colors.blue } },
visual = { a = { fg = colors.black, bg = colors.cyan } },
replace = { a = { fg = colors.black, bg = colors.red } },
inactive = {
a = {fg = colors.white, bg = colors.black},
b = {fg = colors.white, bg = colors.black},
c = {fg = colors.black, bg = colors.black},
}
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.black },
c = { fg = colors.black, bg = colors.black },
},
}
require'lualine'.setup {
require('lualine').setup {
options = {
theme = bubbles_theme,
component_separators = '|',
section_separators = {'', ''},
section_separators = { '', '' },
},
sections = {
lualine_a = {
{'mode',
separator = {'', ''},
right_padding = 2,
}
{ 'mode', separator = { '', '' }, right_padding = 2 },
},
lualine_b = {'filename', 'branch'},
lualine_c = {'fileformat'},
lualine_b = { 'filename', 'branch' },
lualine_c = { 'fileformat' },
lualine_x = {},
lualine_y = { 'filetype', 'progress' },
lualine_z = {
{'location',
separator = {'', ''},
left_padding = 2,
}
{ 'location', separator = { '', '' }, left_padding = 2 },
},
},
inactive_sections = {
lualine_a = {'filename'},
lualine_a = { 'filename' },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {'location'}
lualine_z = { 'location' },
},
tabline = {},
extensions = {}
extensions = {},
}

View File

@ -4,6 +4,7 @@
local lualine = require 'lualine'
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#202328',
fg = '#bbc2cf',
@ -15,32 +16,36 @@ local colors = {
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67'
red = '#ec5f67',
}
local conditions = {
buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end,
hide_in_width = function() return vim.fn.winwidth(0) > 80 end,
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand '%:t') ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local filepath = vim.fn.expand '%:p:h'
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = {c = {fg = colors.fg, bg = colors.bg}},
inactive = {c = {fg = colors.fg, bg = colors.bg}}
}
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
@ -50,7 +55,7 @@ local config = {
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {}
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
@ -59,8 +64,8 @@ local config = {
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {}
}
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
@ -74,9 +79,11 @@ local function ins_right(component)
end
ins_left {
function() return '' end,
color = {fg = colors.blue}, -- Sets highlighting of component
left_padding = 0 -- We don't need space before this
function()
return ''
end,
color = { fg = colors.blue }, -- Sets highlighting of component
left_padding = 0, -- We don't need space before this
}
ins_left {
@ -103,45 +110,47 @@ ins_left {
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red
t = colors.red,
}
vim.api.nvim_command(
'hi! LualineMode guifg=' .. mode_color[vim.fn.mode()] .. " guibg=" ..
colors.bg)
vim.api.nvim_command('hi! LualineMode guifg=' .. mode_color[vim.fn.mode()] .. ' guibg=' .. colors.bg)
return ''
end,
color = "LualineMode",
left_padding = 0
color = 'LualineMode',
left_padding = 0,
}
ins_left {
-- filesize component
'filesize',
condition = conditions.buffer_not_empty
condition = conditions.buffer_not_empty,
}
ins_left {
'filename',
condition = conditions.buffer_not_empty,
color = {fg = colors.magenta, gui = 'bold'}
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left {'location'}
ins_left { 'location' }
ins_left {'progress', color = {fg = colors.fg, gui = 'bold'}}
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = {'nvim_lsp'},
symbols = {error = '', warn = '', info = ''},
color_error = {fg = colors.red},
color_warn = {fg = colors.yellow},
color_info = {fg = colors.cyan}
sources = { 'nvim_lsp' },
symbols = { error = '', warn = '', info = '' },
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {function() return '%=' end}
ins_left {
function()
return '%='
end,
}
ins_left {
-- Lsp server name .
@ -149,7 +158,9 @@ ins_left {
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then return msg end
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
@ -159,7 +170,7 @@ ins_left {
return msg
end,
icon = ' LSP:',
color = {fg = '#ffffff', gui = 'bold'}
color = { fg = '#ffffff', gui = 'bold' },
}
-- Add components to right sections
@ -167,37 +178,39 @@ ins_right {
'o:encoding', -- option component same as &encoding in viml
upper = true, -- I'm not sure why it's upper case either ;)
condition = conditions.hide_in_width,
color = {fg = colors.green, gui = 'bold'}
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
upper = true,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = {fg = colors.green, gui = 'bold'}
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
condition = conditions.check_git_workspace,
color = {fg = colors.violet, gui = 'bold'}
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = {added = '', modified = '', removed = ''},
color_added = {fg = colors.green},
color_modified = {fg = colors.orange},
color_removed = {fg = colors.red},
condition = conditions.hide_in_width
symbols = { added = '', modified = '', removed = '' },
color_added = { fg = colors.green },
color_modified = { fg = colors.orange },
color_removed = { fg = colors.red },
condition = conditions.hide_in_width,
}
ins_right {
function() return '' end,
color = {fg = colors.blue},
right_padding = 0
function()
return ''
end,
color = { fg = colors.blue },
right_padding = 0,
}
-- Now don't forget to initialize lualine

View File

@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require'lualine_require'
local modules = lualine_require.lazy_require{
local lualine_require = require 'lualine_require'
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
loader = 'lualine.utils.loader',
utils_section = 'lualine.utils.section',
@ -17,11 +17,15 @@ local function find_next_hl(status, str_checked)
-- Gets the next valid hl group from str_checked
local hl_pos_start, hl_pos_end = status:find('%%#.-#', str_checked)
while true do
if not hl_pos_start then return nil end
if not hl_pos_start then
return nil
end
-- When there are more that one hl group next to one another like
-- %#HL1#%#HL2#%#HL3# we need to return HL3. This makes that happen.
local next_start, next_end = status:find('^%%#.-#', hl_pos_end + 1)
if next_start == nil then break end
if next_start == nil then
break
end
hl_pos_start, hl_pos_end = next_start, next_end
end
return status:sub(hl_pos_start + 2, hl_pos_end - 1)
@ -31,9 +35,15 @@ end
local function fill_section_separator(status, str_checked, last_hl, sep, reverse)
-- Inserts transitional separator along with transitional highlight
local next_hl = find_next_hl(status, str_checked)
if last_hl == nil then last_hl = 'Normal' end
if next_hl == nil then next_hl = 'Normal' end
if #next_hl == 0 or #last_hl == 0 then return end
if last_hl == nil then
last_hl = 'Normal'
end
if next_hl == nil then
next_hl = 'Normal'
end
if #next_hl == 0 or #last_hl == 0 then
return
end
local transitional_highlight = reverse -- lua ternary assignment x ? y : z
and modules.highlight.get_transitional_highlights(last_hl, next_hl)
or modules.highlight.get_transitional_highlights(next_hl, last_hl)
@ -48,16 +58,17 @@ local function apply_transitional_separators(status)
local copied_pos = 1 -- Tracks how much we've copied over to status_applied
local str_checked = 1 -- Tracks where the searcher head is at
-- Process entire status replace the %s{sep} & %S{sep} placeholders
-- with proper transitional separator.
while str_checked ~= nil do
str_checked = status:find('%%', str_checked)
if str_checked == nil then break end
if str_checked == nil then
break
end
table.insert(status_applied, status:sub(copied_pos, str_checked - 1))
-- -1 so we don't copy '%'
copied_pos = str_checked
local next_char = modules.utils.charAt(status, str_checked +1)
local next_char = modules.utils.charAt(status, str_checked + 1)
if next_char == '#' then
-- %#hl_name# highlights
last_hl = status:match('^%%#(.-)#', str_checked)
@ -67,7 +78,9 @@ local function apply_transitional_separators(status)
local sep = status:match('^%%s{(.-)}', str_checked)
str_checked = str_checked + #sep + 4 -- 4 = len(%{})
local trans_sep = fill_section_separator(status, str_checked, last_hl, sep, false)
if trans_sep then table.insert(status_applied, trans_sep) end
if trans_sep then
table.insert(status_applied, trans_sep)
end
copied_pos = str_checked
elseif next_char == 'S' then
-- %S{sep} is marker for right separator and
@ -79,12 +92,13 @@ local function apply_transitional_separators(status)
str_checked = status:find('}', str_checked) + 1
end
local trans_sep = fill_section_separator(status, str_checked, last_hl, sep, true)
if trans_sep then table.insert(status_applied, trans_sep) end
if trans_sep then
table.insert(status_applied, trans_sep)
end
copied_pos = str_checked
elseif next_char == '%' then
str_checked = str_checked + 2 -- Skip the following % too
elseif next_char == '=' and last_hl and
(last_hl:find('^lualine_a') or last_hl:find('^lualine_b')) then
elseif next_char == '=' and last_hl and (last_hl:find '^lualine_a' or last_hl:find '^lualine_b') then
-- TODO: Fix this properly
-- This check for lualine_a and lualine_b is dumb. It doesn't garantee
-- c or x section isn't present. Worst case sinario after this patch
@ -102,7 +116,7 @@ end
local function statusline(sections, is_focused)
-- The sequence sections should maintain [SECTION_SEQUENCE]
local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'}
local section_sequence = { 'a', 'b', 'c', 'x', 'y', 'z' }
local status = {}
local applied_midsection_devider = false
local applied_trunc = false
@ -111,15 +125,17 @@ local function statusline(sections, is_focused)
-- insert highlight+components of this section to status_builder
local section_data = modules.utils_section.draw_section(
sections['lualine_' .. section_name],
section_name, is_focused)
section_name,
is_focused
)
if #section_data > 0 then
if not applied_midsection_devider and section_name > 'c' then
applied_midsection_devider = true
section_data = '%='..section_data
section_data = '%=' .. section_data
end
if not applied_trunc and section_name > 'b' then
applied_trunc = true
section_data = '%<'..section_data
section_data = '%<' .. section_data
end
table.insert(status, section_data)
end
@ -143,13 +159,17 @@ local function get_extension_sections(current_ft, is_focused)
return nil
end
local function tabline() return statusline(config.tabline, true) end
local function tabline()
return statusline(config.tabline, true)
end
local function notify_theme_error(theme_name)
local message_template = theme_name ~= 'auto' and [[
local message_template = theme_name ~= 'auto'
and [[
### options.theme
Theme `%s` not found, falling back to `auto`. Check if spelling is right.
]] or [[
]]
or [[
### options.theme
Theme `%s` failed, falling back to `gruvbox`.
This shouldn't happen.
@ -164,7 +184,9 @@ local function setup_theme()
local theme_name = config.options.theme
if type(theme_name) == 'string' then
local ok, theme = pcall(modules.loader.load_theme, theme_name)
if ok and theme then return theme end
if ok and theme then
return theme
end
elseif type(theme_name) == 'table' then
-- use the provided theme as-is
return config.options.theme
@ -172,10 +194,12 @@ local function setup_theme()
if theme_name ~= 'auto' then
notify_theme_error(theme_name)
local ok, theme = pcall(modules.loader.load_theme, 'auto')
if ok and theme then return theme end
if ok and theme then
return theme
end
notify_theme_error('auto')
return modules.loader.load_theme('gruvbox')
end
notify_theme_error 'auto'
return modules.loader.load_theme 'gruvbox'
end
local theme = get_theme_from_config()
modules.highlight.create_highlight_groups(theme)
@ -192,7 +216,7 @@ end
local function set_statusline()
if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then
vim.cmd('autocmd lualine VimResized * redrawstatus')
vim.cmd 'autocmd lualine VimResized * redrawstatus'
else
vim.go.statusline = nil
end
@ -219,7 +243,9 @@ end
local function status_dispatch(focused)
-- disable on specific filetypes
if new_config then reset_lualine() end
if new_config then
reset_lualine()
end
local current_ft = vim.bo.filetype
local is_focused = focused ~= nil and focused or modules.utils.is_focused()
for _, ft in pairs(config.options.disabled_filetypes) do

View File

@ -11,7 +11,7 @@ local Component = {
local new_component = {}
new_component.options = options
new_component._parent = child or self
setmetatable(new_component, {__index = new_component._parent})
setmetatable(new_component, { __index = new_component._parent })
-- Operation that are required for creating new components but not for inheritence
if options ~= nil then
component_no = component_no + 1
@ -43,14 +43,17 @@ local Component = {
self.options.color_highlight = highlight.create_component_highlight_group(
self.options.color,
self.options.component_name,
self.options)
self.options
)
end
end,
-- set upper or lower case
apply_case = function(self)
-- Donn't work on components that emit vim statusline escaped chars
if self.status:find('%%') and not self.status:find('%%%%') then return end
if self.status:find '%%' and not self.status:find '%%%%' then
return
end
if self.options.upper == true then
self.status = self.status:upper()
elseif self.options.lower == true then
@ -63,27 +66,26 @@ local Component = {
local l_padding = (self.options.left_padding or self.options.padding or 1)
local r_padding = (self.options.right_padding or self.options.padding or 1)
if l_padding then
if self.status:find('%%#.*#') == 1 then
if self.status:find '%%#.*#' == 1 then
-- When component has changed the highlight at begining
-- we will add the padding after the highlight
local pre_highlight =
vim.fn.matchlist(self.status, [[\(%#.\{-\}#\)]])[2]
self.status = pre_highlight .. string.rep(' ', l_padding) ..
self.status:sub(#pre_highlight + 1, #self.status)
local pre_highlight = vim.fn.matchlist(self.status, [[\(%#.\{-\}#\)]])[2]
self.status = pre_highlight .. string.rep(' ', l_padding) .. self.status:sub(#pre_highlight + 1, #self.status)
else
self.status = string.rep(' ', l_padding) .. self.status
end
end
if r_padding then self.status = self.status .. string.rep(' ', r_padding) end
if r_padding then
self.status = self.status .. string.rep(' ', r_padding)
end
end,
-- Applies custom highlights for component
apply_highlights = function(self, default_highlight)
if self.options.color_highlight then
self.status = highlight.component_format_highlight(
self.options.color_highlight) .. self.status
self.status = highlight.component_format_highlight(self.options.color_highlight) .. self.status
end
if type(self.options.separator) ~= 'table' and self.status:find('%%#') then
if type(self.options.separator) ~= 'table' and self.status:find '%%#' then
-- Apply default highlight only when we aren't applying trans sep and
-- the component has changed it's hl. since we won't be applying
-- regular sep in those cases so ending with default hl isn't neccessay
@ -93,7 +95,9 @@ local Component = {
end
-- Prepend default hl when the component doesn't start with hl otherwise
-- color in previous component can cause side effect
if not self.status:find('^%%#') then self.status = default_highlight .. self.status end
if not self.status:find '^%%#' then
self.status = default_highlight .. self.status
end
end,
-- Apply icon in front of component
@ -125,22 +129,23 @@ local Component = {
end,
apply_section_separators = function(self)
if type(self.options.separator) ~= 'table' then return end
if type(self.options.separator) ~= 'table' then
return
end
if self.options.separator[1] ~= '' then
self.status = string.format('%%s{%s}%s', self.options.separator[1],
self.status)
self.status = string.format('%%s{%s}%s', self.options.separator[1], self.status)
self.strip_previous_separator = true
end
if self.options.separator[2] ~= '' then
self.status = string.format('%s%%S{%s}', self.status,
self.options.separator[2])
self.status = string.format('%s%%S{%s}', self.status, self.options.separator[2])
end
end,
strip_separator = function(self)
if not self.applied_separator then self.applied_separator = '' end
self.status = self.status:sub(1, (#self.status -
(#self.applied_separator)))
if not self.applied_separator then
self.applied_separator = ''
end
self.status = self.status:sub(1, (#self.status - #self.applied_separator))
self.applied_separator = nil
return self.status
end,
@ -161,7 +166,9 @@ local Component = {
return self.status
end
local status = self:update_status(is_focused)
if self.options.format then status = self.options.format(status or '') end
if self.options.format then
status = self.options.format(status or '')
end
if type(status) == 'string' and #status > 0 then
self.status = status
self:apply_icon()
@ -172,7 +179,7 @@ local Component = {
self:apply_separator()
end
return self.status
end
end,
}
return Component

View File

@ -9,7 +9,7 @@ Branch.sep = package.config:sub(1, 1)
-- event watcher to watch head file
-- Use file wstch for non windows and poll for windows.
-- windows doesn't like file watch for some reason.
Branch.file_changed = Branch.sep ~= "\\" and vim.loop.new_fs_event() or vim.loop.new_fs_poll()
Branch.file_changed = Branch.sep ~= '\\' and vim.loop.new_fs_event() or vim.loop.new_fs_poll()
Branch.active_bufnr = '0'
local branch_cache = {} -- stores last known branch for a buffer
-- Initilizer
@ -28,7 +28,9 @@ Branch.update_status = function(_, is_focused)
-- Sync buffer
Branch.find_git_dir()
end
if not is_focused then return branch_cache[vim.fn.bufnr()] or '' end
if not is_focused then
return branch_cache[vim.fn.bufnr()] or ''
end
return Branch.git_branch
end
@ -36,39 +38,41 @@ local git_dir_cache = {} -- Stores git paths that we already know of
-- returns full path to git directory for current directory
function Branch.find_git_dir()
-- get file dir so we can search from that dir
local file_dir = vim.fn.expand('%:p:h')
local file_dir = vim.fn.expand '%:p:h'
local root_dir = file_dir
local git_dir
-- Search upward for .git file or folder
while (root_dir) do
while root_dir do
if git_dir_cache[root_dir] then
git_dir = git_dir_cache[root_dir]
break
end
local git_path = root_dir..Branch.sep..'.git'
local git_path = root_dir .. Branch.sep .. '.git'
local git_file_stat = vim.loop.fs_stat(git_path)
if (git_file_stat) then
if git_file_stat then
if git_file_stat.type == 'directory' then
git_dir = git_path
elseif git_file_stat.type == 'file' then
-- separate git-dir or submodule is used
local file = io.open(git_path)
git_dir = file:read()
git_dir = git_dir:match('gitdir: (.+)$')
git_dir = git_dir:match 'gitdir: (.+)$'
file:close()
-- submodule / relative file path
if git_dir and git_dir:sub(1, 1) ~= Branch.sep and not git_dir:match('^%a:.*$') then
git_dir = git_path:match('(.*).git') .. git_dir
if git_dir and git_dir:sub(1, 1) ~= Branch.sep and not git_dir:match '^%a:.*$' then
git_dir = git_path:match '(.*).git' .. git_dir
end
end
if git_dir then
local head_file_stat = vim.loop.fs_stat(git_dir..Branch.sep..'HEAD')
local head_file_stat = vim.loop.fs_stat(git_dir .. Branch.sep .. 'HEAD')
if head_file_stat and head_file_stat.type == 'file' then
break
else git_dir = nil end
else
git_dir = nil
end
end
root_dir = root_dir:match('(.*)'..Branch.sep..'.-')
end
root_dir = root_dir:match('(.*)' .. Branch.sep .. '.-')
end
git_dir_cache[file_dir] = git_dir
@ -85,7 +89,7 @@ function Branch.get_git_head(head_file)
if f_head then
local HEAD = f_head:read()
f_head:close()
local branch = HEAD:match('ref: refs/heads/(.+)$')
local branch = HEAD:match 'ref: refs/heads/(.+)$'
if branch then
Branch.git_branch = branch
else
@ -103,12 +107,14 @@ function Branch.update_branch()
if git_dir and #git_dir > 0 then
local head_file = git_dir .. Branch.sep .. 'HEAD'
Branch.get_git_head(head_file)
Branch.file_changed:start(head_file,
Branch.sep ~= "\\" and {} or 1000,
vim.schedule_wrap( function()
Branch.file_changed:start(
head_file,
Branch.sep ~= '\\' and {} or 1000,
vim.schedule_wrap(function()
-- reset file-watch
Branch.update_branch()
end))
end)
)
else
-- set to '' when git dir was not found
Branch.git_branch = ''

View File

@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require'lualine_require'
local modules = lualine_require.lazy_require{
local lualine_require = require 'lualine_require'
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
utils_notices = 'lualine.utils.notices',
@ -14,16 +14,16 @@ local default_symbols = {
error = '', -- xf659
warn = '', -- xf529
info = '', -- xf7fc
hint = '' -- xf838
hint = '', -- xf838
},
no_icons = {error = 'E:', warn = 'W:', info = 'I:', hint = 'H:'},
no_icons = { error = 'E:', warn = 'W:', info = 'I:', hint = 'H:' },
}
local default_options = {
colored = true,
update_in_insert = false,
sources = nil,
sections = {'error', 'warn', 'info', 'hint'},
sections = { 'error', 'warn', 'info', 'hint' },
color_error = {
fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultError', 'fg')
or modules.utils.extract_highlight_colors('DiffDelete', 'fg')
@ -50,34 +50,42 @@ Diagnostics.new = function(self, options, child)
-- Run super()
local new_diagnostics = self._parent:new(options, child or Diagnostics)
-- Apply default options
new_diagnostics.options =
vim.tbl_deep_extend('keep', new_diagnostics.options or {}, default_options)
new_diagnostics.options = vim.tbl_deep_extend('keep', new_diagnostics.options or {}, default_options)
-- Apply default symbols
new_diagnostics.symbols =
vim.tbl_extend('keep', new_diagnostics.options.symbols or {},
new_diagnostics.options.icons_enabled ~= false
and default_symbols.icons or default_symbols.no_icons)
new_diagnostics.symbols = vim.tbl_extend(
'keep',
new_diagnostics.options.symbols or {},
new_diagnostics.options.icons_enabled ~= false and default_symbols.icons or default_symbols.no_icons
)
-- Initialize highlight groups
if new_diagnostics.options.colored then
new_diagnostics.highlight_groups = {
error = modules.highlight.create_component_highlight_group(
new_diagnostics.options.color_error, 'diagnostics_error',
new_diagnostics.options),
new_diagnostics.options.color_error,
'diagnostics_error',
new_diagnostics.options
),
warn = modules.highlight.create_component_highlight_group(
new_diagnostics.options.color_warn, 'diagnostics_warn',
new_diagnostics.options),
new_diagnostics.options.color_warn,
'diagnostics_warn',
new_diagnostics.options
),
info = modules.highlight.create_component_highlight_group(
new_diagnostics.options.color_info, 'diagnostics_info',
new_diagnostics.options),
new_diagnostics.options.color_info,
'diagnostics_info',
new_diagnostics.options
),
hint = modules.highlight.create_component_highlight_group(
new_diagnostics.options.color_hint, 'diagnostics_hint',
new_diagnostics.options)
new_diagnostics.options.color_hint,
'diagnostics_hint',
new_diagnostics.options
),
}
end
-- Error out no source
if new_diagnostics.options.sources == nil then
print('no sources for diagnostics configured')
print 'no sources for diagnostics configured'
return ''
end
-- Initialize variable to store last update so we can use it in insert
@ -87,8 +95,7 @@ Diagnostics.new = function(self, options, child)
end
Diagnostics.update_status = function(self)
if not self.options.update_in_insert
and vim.api.nvim_get_mode().mode:sub(1,1) == 'i' then
if not self.options.update_in_insert and vim.api.nvim_get_mode().mode:sub(1, 1) == 'i' then
return self.last_update
end
local error_count, warning_count, info_count, hint_count = 0, 0, 0, 0
@ -104,7 +111,7 @@ Diagnostics.update_status = function(self)
error = error_count,
warn = warning_count,
info = info_count,
hint = hint_count
hint = hint_count,
}
if self.options.colored then
local colors = {}
@ -113,8 +120,7 @@ Diagnostics.update_status = function(self)
end
for _, section in ipairs(self.options.sections) do
if data[section] ~= nil and data[section] > 0 then
table.insert(result,
colors[section] .. self.symbols[section] .. data[section])
table.insert(result, colors[section] .. self.symbols[section] .. data[section])
end
end
else
@ -154,20 +160,19 @@ Diagnostics.diagnostic_sources = {
else
return 0, 0, 0, 0
end
end
end,
}
Diagnostics.get_diagnostics = function(sources)
local result = {}
for index, source in ipairs(sources) do
if type(source) == 'string' then
local error_count, warning_count, info_count, hint_count =
Diagnostics.diagnostic_sources[source]()
local error_count, warning_count, info_count, hint_count = Diagnostics.diagnostic_sources[source]()
result[index] = {
error = error_count,
warn = warning_count,
info = info_count,
hint = hint_count
hint = hint_count,
}
elseif type(source) == 'function' then
local source_result = source()
@ -176,7 +181,7 @@ Diagnostics.get_diagnostics = function(sources)
error = source_result.error or 0,
warn = source_result.warning or 0,
info = source_result.info or 0,
hint = source_result.hin or 0
hint = source_result.hin or 0,
}
end
end

View File

@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local lualine_require = require'lualine_require'
local modules = lualine_require.lazy_require{
local lualine_require = require 'lualine_require'
local modules = lualine_require.lazy_require {
utils = 'lualine.utils.utils',
utils_notices = 'lualine.utils.notices',
highlight = 'lualine.highlight',
@ -22,39 +22,40 @@ local diff_cache = {} -- Stores last known value of diff of a buffer
local default_options = {
colored = true,
symbols = {added = '+', modified = '~', removed = '-'},
symbols = { added = '+', modified = '~', removed = '-' },
color_added = {
fg = modules.utils.extract_highlight_colors('DiffAdd', 'fg')
or '#f0e130',
fg = modules.utils.extract_highlight_colors('DiffAdd', 'fg') or '#f0e130',
},
color_modified = {
fg = modules.utils.extract_highlight_colors('DiffChange', 'fg')
or '#ff0038',
fg = modules.utils.extract_highlight_colors('DiffChange', 'fg') or '#ff0038',
},
color_removed = {
fg = modules.utils.extract_highlight_colors('DiffDelete', 'fg')
or '#ff0038',
fg = modules.utils.extract_highlight_colors('DiffDelete', 'fg') or '#ff0038',
},
}
-- Initializer
Diff.new = function(self, options, child)
local new_instance = self._parent:new(options, child or Diff)
new_instance.options = vim.tbl_deep_extend('keep',
new_instance.options or {},
default_options)
new_instance.options = vim.tbl_deep_extend('keep', new_instance.options or {}, default_options)
-- create highlights and save highlight_name in highlights table
if new_instance.options.colored then
new_instance.highlights = {
added = modules.highlight.create_component_highlight_group(
new_instance.options.color_added, 'diff_added',
new_instance.options),
new_instance.options.color_added,
'diff_added',
new_instance.options
),
modified = modules.highlight.create_component_highlight_group(
new_instance.options.color_modified, 'diff_modified',
new_instance.options),
new_instance.options.color_modified,
'diff_modified',
new_instance.options
),
removed = modules.highlight.create_component_highlight_group(
new_instance.options.color_removed, 'diff_removed',
new_instance.options)
new_instance.options.color_removed,
'diff_removed',
new_instance.options
),
}
end
@ -82,8 +83,12 @@ Diff.update_status = function(self, is_focused)
git_diff = self.options.source()
end
if not is_focused then git_diff = diff_cache[vim.fn.bufnr()] or {} end
if git_diff == nil then return '' end
if not is_focused then
git_diff = diff_cache[vim.fn.bufnr()] or {}
end
if git_diff == nil then
return ''
end
local colors = {}
if self.options.colored then
@ -95,11 +100,10 @@ Diff.update_status = function(self, is_focused)
local result = {}
-- loop though data and load available sections in result table
for _, name in ipairs {'added', 'modified', 'removed'} do
for _, name in ipairs { 'added', 'modified', 'removed' } do
if git_diff[name] and git_diff[name] > 0 then
if self.options.colored then
table.insert(result, colors[name] .. self.options.symbols[name] ..
git_diff[name])
table.insert(result, colors[name] .. self.options.symbols[name] .. git_diff[name])
else
table.insert(result, self.options.symbols[name] .. git_diff[name])
end
@ -121,8 +125,10 @@ end
-- }
-- error_code = { added = -1, modified = -1, removed = -1 }
function Diff.get_sign_count()
if Diff.diff_checker_enabled then Diff.update_diff_args() end
return Diff.git_diff or {added = -1, modified = -1, removed = -1}
if Diff.diff_checker_enabled then
Diff.update_diff_args()
end
return Diff.git_diff or { added = -1, modified = -1, removed = -1 }
end
-- process diff data and update git_diff{ added, removed, modified }
@ -131,11 +137,10 @@ function Diff.process_diff(data)
local added, removed, modified = 0, 0, 0
for _, line in ipairs(data) do
if string.find(line, [[^@@ ]]) then
local tokens = vim.fn.matchlist(line,
[[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]])
local tokens = vim.fn.matchlist(line, [[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]])
local line_stats = {
mod_count = tokens[3] == '' and 1 or tonumber(tokens[3]),
new_count = tokens[5] == '' and 1 or tonumber(tokens[5])
new_count = tokens[5] == '' and 1 or tonumber(tokens[5]),
}
if line_stats.mod_count == 0 and line_stats.new_count > 0 then
@ -150,22 +155,24 @@ function Diff.process_diff(data)
end
end
end
Diff.git_diff = {added = added, modified = modified, removed = removed}
Diff.git_diff = { added = added, modified = modified, removed = removed }
end
-- Updates the job args
function Diff.update_diff_args()
-- Donn't show git diff when current buffer doesn't have a filename
Diff.active_bufnr = tostring(vim.fn.bufnr())
if #vim.fn.expand('%') == 0 then
Diff.diff_args = nil;
Diff.git_diff = nil;
if #vim.fn.expand '%' == 0 then
Diff.diff_args = nil
Diff.git_diff = nil
return
end
Diff.diff_args = {
cmd = string.format(
[[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]],
vim.fn.expand('%:h'), vim.fn.expand('%:t')),
vim.fn.expand '%:h',
vim.fn.expand '%:t'
),
on_stdout = function(_, data)
if next(data) then
Diff.diff_output_cache = vim.list_extend(Diff.diff_output_cache, data)
@ -182,10 +189,10 @@ function Diff.update_diff_args()
if #Diff.diff_output_cache > 0 then
Diff.process_diff(Diff.diff_output_cache)
else
Diff.git_diff = {added = 0, modified = 0, removed = 0}
Diff.git_diff = { added = 0, modified = 0, removed = 0 }
end
diff_cache[vim.fn.bufnr()] = Diff.git_diff
end
end,
}
Diff.update_git_diff()
end
@ -194,9 +201,13 @@ end
function Diff.update_git_diff()
if Diff.diff_args then
Diff.diff_output_cache = {}
if Diff.diff_job then Diff.diff_job:stop() end
if Diff.diff_job then
Diff.diff_job:stop()
end
Diff.diff_job = modules.Job(Diff.diff_args)
if Diff.diff_job then Diff.diff_job:start() end
if Diff.diff_job then
Diff.diff_job:start()
end
end
end

View File

@ -2,6 +2,8 @@
-- MIT license, see LICENSE for more details.
local Encoding = require('lualine.component'):new()
Encoding.update_status = function() return [[%{strlen(&fenc)?&fenc:&enc}]] end
Encoding.update_status = function()
return [[%{strlen(&fenc)?&fenc:&enc}]]
end
return Encoding

View File

@ -3,7 +3,7 @@
local FileName = require('lualine.component'):new()
local default_options = {
symbols = {modified = '[+]', readonly = '[-]'},
symbols = { modified = '[+]', readonly = '[-]' },
file_status = true,
path = 0,
shorting_target = 40,
@ -15,15 +15,12 @@ end
local function shorten_path(path, sep)
-- ('([^/])[^/]+%/', '%1/', 1)
return path:gsub(
string.format('([^%s])[^%s]+%%%s', sep, sep, sep), '%1' .. sep, 1)
return path:gsub(string.format('([^%s])[^%s]+%%%s', sep, sep, sep), '%1' .. sep, 1)
end
FileName.new = function(self, options, child)
local new_instance = self._parent:new(options, child or FileName)
new_instance.options = vim.tbl_deep_extend('keep',
new_instance.options or {},
default_options)
new_instance.options = vim.tbl_deep_extend('keep', new_instance.options or {}, default_options)
return new_instance
end
@ -31,16 +28,18 @@ FileName.update_status = function(self)
local data
if self.options.path == 1 then
-- relative path
data = vim.fn.expand('%:~:.')
data = vim.fn.expand '%:~:.'
elseif self.options.path == 2 then
-- absolute path
data = vim.fn.expand('%:p')
data = vim.fn.expand '%:p'
else
-- just filename
data = vim.fn.expand('%:t')
data = vim.fn.expand '%:t'
end
if data == '' then data = '[No Name]' end
if data == '' then
data = '[No Name]'
end
if self.options.shorting_target ~= 0 then
local windwidth = vim.fn.winwidth(0)

View File

@ -3,13 +3,17 @@
local M = require('lualine.component'):new()
M.update_status = function()
local file = vim.fn.expand('%:p')
if file == nil or #file == 0 then return '' end
local file = vim.fn.expand '%:p'
if file == nil or #file == 0 then
return ''
end
local size = vim.fn.getfsize(file)
if size <= 0 then return '' end
if size <= 0 then
return ''
end
local sufixes = {'b', 'k', 'm', 'g'}
local sufixes = { 'b', 'k', 'm', 'g' }
local i = 1
while size > 1024 and i < #sufixes do

View File

@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require'lualine_require'
local modules = lualine_require.lazy_require{
local lualine_require = require 'lualine_require'
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
}
@ -14,47 +14,50 @@ local default_options = {
function FileType:new(options, child)
local new_instance = self._parent:new(options, child or FileType)
new_instance.options = vim.tbl_deep_extend('keep',
new_instance.options or {},
default_options)
new_instance.options = vim.tbl_deep_extend('keep', new_instance.options or {}, default_options)
return new_instance
end
function FileType.update_status() return vim.bo.filetype or '' end
function FileType.update_status()
return vim.bo.filetype or ''
end
function FileType:apply_icon()
if not self.options.icons_enabled then return end
if not self.options.icons_enabled then
return
end
local icon, icon_highlight_group
local ok, devicons = pcall(require, 'nvim-web-devicons')
if ok then
local f_name, f_extension = vim.fn.expand('%:t'), vim.fn.expand('%:e')
local f_name, f_extension = vim.fn.expand '%:t', vim.fn.expand '%:e'
icon, icon_highlight_group = devicons.get_icon(f_name, f_extension)
if icon and self.options.colored then
local highlight_color = modules.utils.extract_highlight_colors(
icon_highlight_group, 'fg')
local highlight_color = modules.utils.extract_highlight_colors(icon_highlight_group, 'fg')
local is_focused = modules.utils.is_focused()
local default_highlight = modules.highlight.format_highlight(is_focused,
self.options.self
.section)
local icon_highlight = self.options.self.section .. '_' ..
icon_highlight_group
local default_highlight = modules.highlight.format_highlight(is_focused, self.options.self.section)
local icon_highlight = self.options.self.section .. '_' .. icon_highlight_group
if not modules.highlight.highlight_exists(icon_highlight .. '_normal') then
icon_highlight = modules.highlight.create_component_highlight_group(
{fg = highlight_color}, icon_highlight_group,
self.options)
{ fg = highlight_color },
icon_highlight_group,
self.options
)
end
icon = modules.highlight.component_format_highlight(icon_highlight) .. icon ..
default_highlight
icon = modules.highlight.component_format_highlight(icon_highlight) .. icon .. default_highlight
end
else
ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol')
if ok ~= 0 then icon = vim.fn.WebDevIconsGetFileTypeSymbol() end
ok = vim.fn.exists '*WebDevIconsGetFileTypeSymbol'
if ok ~= 0 then
icon = vim.fn.WebDevIconsGetFileTypeSymbol()
end
end
if not icon then return end
if not icon then
return
end
if self.options.disable_text then
self.status = icon

View File

@ -2,6 +2,8 @@
-- MIT license, see LICENSE for more details.
local Location = require('lualine.component'):new()
Location.update_status = function() return [[%3l:%-2c]] end
Location.update_status = function()
return [[%3l:%-2c]]
end
return Location

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local require = require'lualine_require'.require
local require = require('lualine_require').require
local Mode = require('lualine.component'):new()
local get_mode = require('lualine.utils.mode').get_mode

View File

@ -2,6 +2,8 @@
-- MIT license, see LICENSE for more details.
local Progress = require('lualine.component'):new()
Progress.update_status = function() return [[%3P]] end
Progress.update_status = function()
return [[%3P]]
end
return Progress

View File

@ -5,11 +5,15 @@ EvalFuncComponent.update_status = function(self)
local ok, status
if self.options.type == nil then
ok, status = pcall(EvalFuncComponent.lua_eval, component)
if not ok then status = EvalFuncComponent.vim_function(component) end
if not ok then
status = EvalFuncComponent.vim_function(component)
end
else
if self.options.type == 'luae' then
ok, status = pcall(EvalFuncComponent.lua_eval, component)
if not ok then status = nil end
if not ok then
status = nil
end
elseif self.options.type == 'vimf' then
status = EvalFuncComponent.vim_function(component)
end
@ -26,7 +30,9 @@ end
EvalFuncComponent.vim_function = function(name)
-- vim function component
local ok, return_val = pcall(vim.api.nvim_call_function, name, {})
if not ok then return '' end -- function call failed
if not ok then
return ''
end -- function call failed
ok, return_val = pcall(tostring, return_val)
return ok and return_val or ''
end

View File

@ -4,10 +4,14 @@ FunctionComponent.update_status = function(self, is_focused)
-- 1st element in options table is the function provided by config
local ok, retval
ok, retval = pcall(self.options[1], self, is_focused)
if not ok then return '' end
if not ok then
return ''
end
if type(retval) ~= 'string' then
ok, retval = pcall(tostring, retval)
if not ok then return '' end
if not ok then
return ''
end
end
return retval
end

View File

@ -4,20 +4,26 @@ VarComponent.update_status = function(self)
-- vim veriable component
-- accepts g:, v:, t:, w:, b:, o, go:, vo:, to:, wo:, bo:
-- filters g portion from g:var
local scope = component:match('[gvtwb]?o?')
local scope = component:match '[gvtwb]?o?'
-- filters var portion from g:var
local var_name = component:sub(#scope + 2, #component)
-- Displays nothing when veriable aren't present
if not (scope and var_name) then return '' end
if not (scope and var_name) then
return ''
end
-- Support accessing keys within dictionary
-- https://github.com/shadmansaleh/lualine.nvim/issues/25#issuecomment-907374548
local name_chunks = vim.split(var_name, '%.')
local return_val = vim[scope][name_chunks[1]]
for i=2,#name_chunks do
if return_val == nil then break end
for i = 2, #name_chunks do
if return_val == nil then
break
end
return_val = return_val[name_chunks[i]]
end
if return_val == nil then return '' end
if return_val == nil then
return ''
end
local ok
ok, return_val = pcall(tostring, return_val)
return ok and return_val or ''

View File

@ -4,62 +4,63 @@ local config = {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = {'', ''},
section_separators = {'', ''},
disabled_filetypes = {}
component_separators = { '', '' },
section_separators = { '', '' },
disabled_filetypes = {},
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff',
{'diagnostics', sources={'nvim_lsp', 'coc'}}},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', { 'diagnostics', sources = { 'nvim_lsp', 'coc' } } },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
lualine_z = {},
},
tabline = {},
extensions = {}
extensions = {},
}
-- change separator format 'x' or {'x'} to {'x', 'x'}
local function fix_separators(separators)
if separators ~= nil then
if type(separators) == 'string' then
return {separators, separators}
return { separators, separators }
elseif type(separators) == 'table' and #separators == 1 then
return {separators[1], separators[1]}
return { separators[1], separators[1] }
end
end
return separators
end
local function apply_configuration(config_table)
if not config_table then return vim.deepcopy(config) end
if not config_table then
return vim.deepcopy(config)
end
local function parse_sections(section_group_name)
if not config_table[section_group_name] then return end
if not config_table[section_group_name] then
return
end
for section_name, section in pairs(config_table[section_group_name]) do
config[section_group_name][section_name] = vim.deepcopy(section)
end
end
parse_sections('options')
parse_sections('sections')
parse_sections('inactive_sections')
parse_sections('tabline')
parse_sections 'options'
parse_sections 'sections'
parse_sections 'inactive_sections'
parse_sections 'tabline'
if config_table.extensions then
config.extensions = vim.deepcopy(config_table.extensions)
end
config.options.section_separators = fix_separators(
config.options.section_separators)
config.options.component_separators = fix_separators(
config.options.component_separators)
config.options.section_separators = fix_separators(config.options.section_separators)
config.options.component_separators = fix_separators(config.options.component_separators)
return vim.deepcopy(config)
end
@ -69,5 +70,5 @@ end
return {
get_config = get_current_config,
apply_configuration = apply_configuration
apply_configuration = apply_configuration,
}

View File

@ -1,11 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local nerdtree = require('lualine.extensions.nerdtree')
local nerdtree = require 'lualine.extensions.nerdtree'
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = {'CHADTree'}
M.filetypes = { 'CHADTree' }
return M

View File

@ -6,15 +6,20 @@ local function fugitive_branch()
local icon = '' -- e0a0
return icon .. ' ' .. vim.fn.FugitiveHead()
end
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
M.sections = {
lualine_a = {fugitive_branch},
lualine_c = {empty},
lualine_z = {'location'}
local empty = {
function()
return ' '
end,
left_padding = 0,
right_padding = 0,
}
M.filetypes = {'fugitive'}
M.sections = {
lualine_a = { fugitive_branch },
lualine_c = { empty },
lualine_z = { 'location' },
}
M.filetypes = { 'fugitive' }
return M

View File

@ -1,15 +1,23 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function fzf_statusline() return 'FZF' end
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
local function fzf_statusline()
return 'FZF'
end
local empty = {
function()
return ' '
end,
left_padding = 0,
right_padding = 0,
}
local M = {}
M.sections = {
lualine_a = {fzf_statusline},
lualine_c = {empty}
lualine_a = { fzf_statusline },
lualine_c = { empty },
}
M.filetypes = {'fzf'}
M.filetypes = { 'fzf' }
return M

View File

@ -1,15 +1,23 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function get_short_cwd() return vim.fn.fnamemodify(vim.fn.getcwd(), ':~') end
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
local function get_short_cwd()
return vim.fn.fnamemodify(vim.fn.getcwd(), ':~')
end
local empty = {
function()
return ' '
end,
left_padding = 0,
right_padding = 0,
}
local M = {}
M.sections = {
lualine_a = {get_short_cwd},
lualine_c = {empty}
lualine_a = { get_short_cwd },
lualine_c = { empty },
}
M.filetypes = {'nerdtree'}
M.filetypes = { 'nerdtree' }
return M

View File

@ -1,11 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local nerdtree = require('lualine.extensions.nerdtree')
local nerdtree = require 'lualine.extensions.nerdtree'
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = {'NvimTree'}
M.filetypes = { 'NvimTree' }
return M

View File

@ -2,7 +2,7 @@
-- MIT license, see LICENSE for more details.
--
local function is_loclist()
return vim.fn.getloclist(0, {filewinid = 1}).filewinid ~= 0
return vim.fn.getloclist(0, { filewinid = 1 }).filewinid ~= 0
end
local function label()
@ -11,11 +11,17 @@ end
local function title()
if is_loclist() then
return vim.fn.getloclist(0, {title = 0}).title
return vim.fn.getloclist(0, { title = 0 }).title
end
return vim.fn.getqflist({title = 0}).title
return vim.fn.getqflist({ title = 0 }).title
end
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
local empty = {
function()
return ' '
end,
left_padding = 0,
right_padding = 0,
}
local M = {}
@ -25,12 +31,12 @@ function M.init()
end
M.sections = {
lualine_a = {label},
lualine_b = {title},
lualine_c = {empty},
lualine_z = {'location'}
lualine_a = { label },
lualine_b = { title },
lualine_c = { empty },
lualine_z = { 'location' },
}
M.filetypes = {'qf'}
M.filetypes = { 'qf' }
return M

View File

@ -1,16 +1,24 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function toggleterm_statusline() return 'ToggleTerm #' .. vim.b.toggle_number end
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
local function toggleterm_statusline()
return 'ToggleTerm #' .. vim.b.toggle_number
end
local empty = {
function()
return ' '
end,
left_padding = 0,
right_padding = 0,
}
local M = {}
M.sections = {
lualine_a = {toggleterm_statusline},
lualine_c = {empty}
lualine_a = { toggleterm_statusline },
lualine_c = { empty },
}
M.filetypes = {'toggleterm'}
M.filetypes = { 'toggleterm' }
return M

View File

@ -1,14 +1,14 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
local lualine_require = require'lualine_require'
local lualine_require = require 'lualine_require'
local require = lualine_require.require
local modules = lualine_require.lazy_require{
local modules = lualine_require.lazy_require {
utils = 'lualine.utils.utils',
color_utils = 'lualine.utils.color_utils',
}
local section_highlight_map = {x = 'c', y = 'b', z = 'a'}
local section_highlight_map = { x = 'c', y = 'b', z = 'a' }
local active_theme = nil
local create_cterm_colors = false
@ -30,20 +30,22 @@ end
local function sanitize_color(color)
if type(color) == 'string' then
if color:sub(1,1) == '#' then return color end -- RGB value
if color:sub(1, 1) == '#' then
return color
end -- RGB value
return modules.color_utils.color_name2rgb(color)
elseif type(color) == 'number' then
if color > 255 then
error("What's this it can't be higher then 255 and you've given "..color)
error("What's this it can't be higher then 255 and you've given " .. color)
end
return modules.color_utils.cterm2rgb(color)
end
end
function M.highlight(name, foreground, background, gui, link)
local command = {'highlight!'}
local command = { 'highlight!' }
if link and #link > 0 then
vim.list_extend(command, {'link', name, link})
vim.list_extend(command, { 'link', name, link })
else
foreground = sanitize_color(foreground)
background = sanitize_color(background)
@ -51,15 +53,13 @@ function M.highlight(name, foreground, background, gui, link)
if foreground and foreground ~= 'none' then
table.insert(command, 'guifg=' .. foreground)
if create_cterm_colors then
table.insert(command,
'ctermfg=' .. modules.color_utils.rgb2cterm(foreground))
table.insert(command, 'ctermfg=' .. modules.color_utils.rgb2cterm(foreground))
end
end
if background and background ~= 'none' then
table.insert(command, 'guibg=' .. background)
if create_cterm_colors then
table.insert(command,
'ctermbg=' .. modules.color_utils.rgb2cterm(background))
table.insert(command, 'ctermbg=' .. modules.color_utils.rgb2cterm(background))
end
end
if gui then
@ -77,13 +77,11 @@ function M.create_highlight_groups(theme)
create_cterm_colors = not vim.go.termguicolors
for mode, sections in pairs(theme) do
for section, color in pairs(sections) do
local highlight_group_name = {'lualine', section, mode}
local highlight_group_name = { 'lualine', section, mode }
if type(color) == 'string' then -- link to a highlight group
M.highlight(table.concat(highlight_group_name, '_'), nil,
nil, nil, color)
M.highlight(table.concat(highlight_group_name, '_'), nil, nil, nil, color)
else -- Define a new highlight
M.highlight(table.concat(highlight_group_name, '_'), color.fg,
color.bg, color.gui, nil)
M.highlight(table.concat(highlight_group_name, '_'), color.fg, color.bg, color.gui, nil)
end
end
end
@ -94,15 +92,20 @@ end
-- @return: (string) highlight group name with mode
local function append_mode(highlight_group)
local mode = require('lualine.utils.mode').get_mode()
if mode == 'VISUAL' or mode == 'V-BLOCK' or mode == 'V-LINE' or mode ==
'SELECT' or mode == 'S-LINE' or mode == 'S-BLOCK' then
if
mode == 'VISUAL'
or mode == 'V-BLOCK'
or mode == 'V-LINE'
or mode == 'SELECT'
or mode == 'S-LINE'
or mode == 'S-BLOCK'
then
highlight_group = highlight_group .. '_visual'
elseif mode == 'REPLACE' or mode == 'V-REPLACE' then
highlight_group = highlight_group .. '_replace'
elseif mode == 'INSERT' then
highlight_group = highlight_group .. '_insert'
elseif mode == 'COMMAND' or mode == 'EX' or mode == 'MORE' or mode ==
'CONFIRM' then
elseif mode == 'COMMAND' or mode == 'EX' or mode == 'MORE' or mode == 'CONFIRM' then
highlight_group = highlight_group .. '_command'
elseif mode == 'TERMINAL' then
highlight_group = highlight_group .. '_terminal'
@ -120,7 +123,9 @@ end
-- @param default_color Colors et in theme this is 2nd fall back
-- @param kind (fg/bg))
local function get_default_component_color(color, options_color, default_color, kind)
if color[kind] then return color[kind] end
if color[kind] then
return color[kind]
end
if options_color then
if type(options_color) == 'table' and options_color[kind] then
return options_color[kind]
@ -146,54 +151,57 @@ end
-- to retrive highlight group
function M.create_component_highlight_group(color, highlight_tag, options)
local tag_id = 0
while (M.highlight_exists(table.concat(
{'lualine', highlight_tag, 'no_mode'}, '_'))
or (options.self.section and M.highlight_exists(table.concat(
{options.self.section, highlight_tag, 'normal'}, '_')))
) do
while
M.highlight_exists(table.concat({ 'lualine', highlight_tag, 'no_mode' }, '_'))
or (
options.self.section
and M.highlight_exists(table.concat({ options.self.section, highlight_tag, 'normal' }, '_'))
)
do
highlight_tag = highlight_tag .. '_' .. tostring(tag_id)
tag_id = tag_id + 1
end
if type(color) == 'string' then
local highlight_group_name = table.concat(
{'lualine', highlight_tag, 'no_mode'}, '_')
local highlight_group_name = table.concat({ 'lualine', highlight_tag, 'no_mode' }, '_')
M.highlight(highlight_group_name, nil, nil, nil, color) -- l8nk to group
return highlight_group_name
end
if color.bg and color.fg then
-- When bg and fg are both present we donn't need to set highlighs for
-- each mode as they will surely look the same. So we can work without options
local highlight_group_name = table.concat(
{'lualine', highlight_tag, 'no_mode'}, '_')
local highlight_group_name = table.concat({ 'lualine', highlight_tag, 'no_mode' }, '_')
M.highlight(highlight_group_name, color.fg, color.bg, color.gui, nil)
return highlight_group_name
end
local modes = {
'normal', 'insert', 'visual', 'replace', 'command', 'terminal', 'inactive'
'normal',
'insert',
'visual',
'replace',
'command',
'terminal',
'inactive',
}
local normal_hl
-- convert lualine_a -> a before setting section
local section = options.self.section:match('lualine_(.*)')
local section = options.self.section:match 'lualine_(.*)'
if section > 'c' and not active_theme.normal[section] then
section = section_highlight_map[section] end
section = section_highlight_map[section]
end
for _, mode in ipairs(modes) do
local highlight_group_name = {options.self.section, highlight_tag, mode}
local default_color_table = active_theme[mode] and
active_theme[mode][section] or
active_theme.normal[section]
local highlight_group_name = { options.self.section, highlight_tag, mode }
local default_color_table = active_theme[mode] and active_theme[mode][section] or active_theme.normal[section]
local bg = get_default_component_color(color, options.color, default_color_table, 'bg')
local fg = get_default_component_color(color, options.color, default_color_table, 'fg')
-- Check if it's same as normal mode if it is no need to create aditional highlight
if mode ~= 'normal' then
if bg ~= normal_hl.bg or fg ~= normal_hl.fg then
M.highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui,
nil)
M.highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui, nil)
end
else
normal_hl = {bg = bg, fg = fg}
M.highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui,
nil)
normal_hl = { bg = bg, fg = fg }
M.highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui, nil)
end
end
return options.self.section .. '_' .. highlight_tag
@ -206,7 +214,7 @@ end
-- @return: (string) formated highlight group name
function M.component_format_highlight(highlight_name)
local highlight_group = highlight_name
if highlight_name:find('no_mode') == #highlight_name - #'no_mode' + 1 then
if highlight_name:find 'no_mode' == #highlight_name - #'no_mode' + 1 then
return '%#' .. highlight_group .. '#'
end
if modules.utils.is_focused() then
@ -222,11 +230,8 @@ function M.component_format_highlight(highlight_name)
end
function M.format_highlight(is_focused, highlight_group)
if highlight_group > 'lualine_c'
and not M.highlight_exists(highlight_group .. '_normal') then
highlight_group = 'lualine_' ..
section_highlight_map[highlight_group:match(
'lualine_(.)')]
if highlight_group > 'lualine_c' and not M.highlight_exists(highlight_group .. '_normal') then
highlight_group = 'lualine_' .. section_highlight_map[highlight_group:match 'lualine_(.)']
end
local highlight_name
if not is_focused then
@ -248,17 +253,23 @@ end
function M.get_transitional_highlights(left_hl, right_hl)
-- When both left and right highlights are same or one is absent
-- nothing to transition to.
if left_hl == nil or right_hl == nil or left_hl == right_hl then return nil end
if left_hl == nil or right_hl == nil or left_hl == right_hl then
return nil
end
-- construct the name of hightlight group
local highlight_name = table.concat({'lualine_transitional',left_hl,'to',right_hl}, '_')
local highlight_name = table.concat({ 'lualine_transitional', left_hl, 'to', right_hl }, '_')
if not M.highlight_exists(highlight_name) then
-- Create the highlight_group if needed
-- Get colors from highlights
local fg = modules.utils.extract_highlight_colors(left_hl, 'bg')
local bg = modules.utils.extract_highlight_colors(right_hl, 'bg')
if not fg or not bg then return nil end -- Color retrieval failed
if bg == fg then return nil end -- Separator won't be visible anyway
if not fg or not bg then
return nil
end -- Color retrieval failed
if bg == fg then
return nil
end -- Separator won't be visible anyway
M.highlight(highlight_name, fg, bg, nil)
end
return '%#' .. highlight_name .. '#'

View File

@ -23,16 +23,16 @@ local colors = {
return {
normal = {
a = {fg = colors.white, bg = colors.blue, gui = 'bold'},
b = {fg = colors.white, bg = colors.gray},
c = {fg = colors.silver, bg = colors.black}
a = { fg = colors.white, bg = colors.blue, gui = 'bold' },
b = { fg = colors.white, bg = colors.gray },
c = { fg = colors.silver, bg = colors.black },
},
insert = {a = {fg = colors.white, bg = colors.green, gui = 'bold'}},
visual = {a = {fg = colors.white, bg = colors.purple, gui = 'bold'}},
replace = {a = {fg = colors.white, bg = colors.red, gui = 'bold'}},
insert = { a = { fg = colors.white, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.white, bg = colors.purple, gui = 'bold' } },
replace = { a = { fg = colors.white, bg = colors.red, gui = 'bold' } },
inactive = {
a = {fg = colors.silver, bg = colors.gray, gui = 'bold'},
b = {fg = colors.gray, bg = colors.black},
c = {fg = colors.silver, bg = colors.black}
}
a = { fg = colors.silver, bg = colors.gray, gui = 'bold' },
b = { fg = colors.gray, bg = colors.black },
c = { fg = colors.silver, bg = colors.black },
},
}

View File

@ -16,28 +16,28 @@ local colors = {
return {
insert = {
a = {fg = colors.color0, bg = colors.color1, gui = 'bold'},
b = {fg = colors.color0, bg = colors.color2},
c = {fg = colors.color0, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
normal = {
a = {fg = colors.color0, bg = colors.color4, gui = 'bold'},
b = {fg = colors.color0, bg = colors.color2},
c = {fg = colors.color0, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color4, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
inactive = {
a = {fg = colors.color5, bg = colors.color2, gui = 'bold'},
b = {fg = colors.color5, bg = colors.color3},
c = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color5, bg = colors.color2, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color3 },
c = { fg = colors.color2, bg = colors.color3 },
},
visual = {
a = {fg = colors.color0, bg = colors.color6, gui = 'bold'},
b = {fg = colors.color0, bg = colors.color2},
c = {fg = colors.color0, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color6, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
replace = {
a = {fg = colors.color0, bg = colors.color7, gui = 'bold'},
b = {fg = colors.color0, bg = colors.color2},
c = {fg = colors.color0, bg = colors.color3}
}
a = { fg = colors.color0, bg = colors.color7, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
}

View File

@ -19,25 +19,25 @@ local colors = {
return {
inactive = {
a = {fg = colors.color0, bg = colors.color1, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3},
c = {fg = colors.color0, bg = colors.color1}
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color0, bg = colors.color1 },
},
normal = {
a = {fg = colors.color1, bg = colors.color4, gui = 'bold'},
b = {fg = colors.color5, bg = colors.color6},
c = {fg = colors.color7, bg = colors.color1}
a = { fg = colors.color1, bg = colors.color4, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
c = { fg = colors.color7, bg = colors.color1 },
},
visual = {
a = {fg = colors.color1, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color5, bg = colors.color6}
a = { fg = colors.color1, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
replace = {
a = {fg = colors.color1, bg = colors.color11, gui = 'bold'},
b = {fg = colors.color5, bg = colors.color6}
a = { fg = colors.color1, bg = colors.color11, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
insert = {
a = {fg = colors.color1, bg = colors.color14, gui = 'bold'},
b = {fg = colors.color5, bg = colors.color6}
}
a = { fg = colors.color1, bg = colors.color14, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
}

View File

@ -6,7 +6,9 @@ if color_name then
-- Check if there's a theme for current colorscheme
-- If there is load that instead of genarating a new one
local ok, theme = pcall(loader.load_theme, color_name)
if ok and theme then return theme end
if ok and theme then
return theme
end
end
---------------
@ -30,7 +32,9 @@ local function getHi(scope, syntaxlist)
scope = 'bg'
end
end
if color[scope] then return color[scope] end
if color[scope] then
return color[scope]
end
end
end
return '#000000'
@ -38,19 +42,18 @@ end
-- truns #rrggbb -> { red, green, blue }
local function rgb_str2num(rgb_color_str)
if rgb_color_str:find('#') == 1 then
if rgb_color_str:find '#' == 1 then
rgb_color_str = rgb_color_str:sub(2, #rgb_color_str)
end
local red = tonumber(rgb_color_str:sub(1, 2), 16)
local green = tonumber(rgb_color_str:sub(3, 4), 16)
local blue = tonumber(rgb_color_str:sub(5, 6), 16)
return {red = red, green = green, blue = blue}
return { red = red, green = green, blue = blue }
end
-- turns { red, green, blue } -> #rrggbb
local function rgb_num2str(rgb_color_num)
local rgb_color_str = string.format('#%02x%02x%02x', rgb_color_num.red,
rgb_color_num.green, rgb_color_num.blue)
local rgb_color_str = string.format('#%02x%02x%02x', rgb_color_num.red, rgb_color_num.green, rgb_color_num.blue)
return rgb_color_str
end
@ -71,8 +74,12 @@ end
-- clamps the val between left and right
local function clamp(val, left, right)
if val > right then return right end
if val < left then return left end
if val > right then
return right
end
if val < left then
return left
end
return val
end
@ -100,27 +107,31 @@ local function apply_contrast(highlight)
local hightlight_bg_avg = get_color_avg(highlight.bg)
local contrast_threshold_config = clamp(contrast_threshold, 0, 0.5)
local contranst_change_step = 5
if hightlight_bg_avg > .5 then contranst_change_step = -contranst_change_step end
if hightlight_bg_avg > 0.5 then
contranst_change_step = -contranst_change_step
end
-- donn't waste too much time here max 25 interation should be more than enough
local iteration_count = 1
while (math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) <
contrast_threshold_config and iteration_count < 25) do
while
math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25
do
highlight.fg = contrast_modifier(highlight.fg, contranst_change_step)
iteration_count = iteration_count + 1
end
end
-- Get the colors to create theme
-- stylua: ignore
local colors = {
normal = getHi('bg', {'PmenuSel', 'PmenuThumb', 'TabLineSel'}),
insert = getHi('fg', {'String', 'MoreMsg'}),
replace = getHi('fg', {'Number', 'Type'}),
visual = getHi('fg', {'Special', 'Boolean', 'Constant'}),
command = getHi('fg', {'Identifier'}),
back1 = getHi('bg', {'Normal', 'StatusLineNC'}),
fore = getHi('fg', {'Normal', 'StatusLine'}),
back2 = getHi('bg', {'StatusLine'})
normal = getHi('bg', { 'PmenuSel', 'PmenuThumb', 'TabLineSel' }),
insert = getHi('fg', { 'String', 'MoreMsg' }),
replace = getHi('fg', { 'Number', 'Type' }),
visual = getHi('fg', { 'Special', 'Boolean', 'Constant' }),
command = getHi('fg', { 'Identifier' }),
back1 = getHi('bg', { 'Normal', 'StatusLineNC' }),
fore = getHi('fg', { 'Normal', 'StatusLine' }),
back2 = getHi('bg', { 'StatusLine' }),
}
-- Change brightness of colors
@ -139,30 +150,30 @@ end
-- basic theme defination
local M = {
normal = {
a = {bg = colors.normal, fg = colors.back1, gui = 'bold'},
b = {bg = colors.back1, fg = colors.normal},
c = {bg = colors.back2, fg = colors.fore}
a = { bg = colors.normal, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.normal },
c = { bg = colors.back2, fg = colors.fore },
},
insert = {
a = {bg = colors.insert, fg = colors.back1, gui = 'bold'},
b = {bg = colors.back1, fg = colors.insert},
c = {bg = colors.back2, fg = colors.fore}
a = { bg = colors.insert, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.insert },
c = { bg = colors.back2, fg = colors.fore },
},
replace = {
a = {bg = colors.replace, fg = colors.back1, gui = 'bold'},
b = {bg = colors.back1, fg = colors.replace},
c = {bg = colors.back2, fg = colors.fore}
a = { bg = colors.replace, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.replace },
c = { bg = colors.back2, fg = colors.fore },
},
visual = {
a = {bg = colors.visual, fg = colors.back1, gui = 'bold'},
b = {bg = colors.back1, fg = colors.visual},
c = {bg = colors.back2, fg = colors.fore}
a = { bg = colors.visual, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.visual },
c = { bg = colors.back2, fg = colors.fore },
},
command = {
a = {bg = colors.command, fg = colors.back1, gui = 'bold'},
b = {bg = colors.back1, fg = colors.command},
c = {bg = colors.back2, fg = colors.fore}
}
a = { bg = colors.command, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.command },
c = { bg = colors.back2, fg = colors.fore },
},
}
M.terminal = M.command
@ -170,7 +181,9 @@ M.inactive = M.normal
-- Apply prpper contrast so text is readable
for _, section in pairs(M) do
for _, highlight in pairs(section) do apply_contrast(highlight) end
for _, highlight in pairs(section) do
apply_contrast(highlight)
end
end
return M

View File

@ -16,25 +16,25 @@ local colors = {
return {
visual = {
a = {fg = colors.color2, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = {fg = colors.color2, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = {fg = colors.color4, bg = colors.color2},
a = {fg = colors.color4, bg = colors.color5, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = {fg = colors.color9, bg = colors.color2},
a = {fg = colors.color2, bg = colors.color10, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = {fg = colors.color2, bg = colors.color13, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
}
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

View File

@ -16,25 +16,25 @@ local colors = {
return {
visual = {
a = {fg = colors.color2, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = {fg = colors.color2, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = {fg = colors.color4, bg = colors.color2},
a = {fg = colors.color4, bg = colors.color5, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = {fg = colors.color9, bg = colors.color2},
a = {fg = colors.color2, bg = colors.color10, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = {fg = colors.color2, bg = colors.color13, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
}
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

View File

@ -16,25 +16,25 @@ local colors = {
return {
visual = {
a = {fg = colors.color2, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = {fg = colors.color2, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = {fg = colors.color4, bg = colors.color2},
a = {fg = colors.color4, bg = colors.color5, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = {fg = colors.color9, bg = colors.color2},
a = {fg = colors.color2, bg = colors.color10, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = {fg = colors.color2, bg = colors.color13, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
}
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

View File

@ -13,26 +13,26 @@ local colors = {
return {
normal = {
b = {fg = colors.green, bg = colors.black},
a = {fg = colors.black, bg = colors.green, gui = 'bold'},
c = {fg = colors.white, bg = colors.black}
b = { fg = colors.green, bg = colors.black },
a = { fg = colors.black, bg = colors.green, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
visual = {
b = {fg = colors.pink, bg = colors.black},
a = {fg = colors.black, bg = colors.pink, gui = 'bold'}
b = { fg = colors.pink, bg = colors.black },
a = { fg = colors.black, bg = colors.pink, gui = 'bold' },
},
inactive = {
b = {fg = colors.black, bg = colors.blue},
a = {fg = colors.white, bg = colors.gray, gui = 'bold'}
b = { fg = colors.black, bg = colors.blue },
a = { fg = colors.white, bg = colors.gray, gui = 'bold' },
},
replace = {
b = {fg = colors.lightred, bg = colors.black},
a = {fg = colors.black, bg = colors.lightred, gui = 'bold'},
c = {fg = colors.white, bg = colors.black}
b = { fg = colors.lightred, bg = colors.black },
a = { fg = colors.black, bg = colors.lightred, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
insert = {
b = {fg = colors.blue, bg = colors.black},
a = {fg = colors.black, bg = colors.blue, gui = 'bold'},
c = {fg = colors.white, bg = colors.black}
}
b = { fg = colors.blue, bg = colors.black },
a = { fg = colors.black, bg = colors.blue, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
}

View File

@ -16,33 +16,33 @@ local colors = {
return {
normal = {
a = {bg = colors.purple, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.purple, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
insert = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
visual = {
a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
replace = {
a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
command = {
a = {bg = colors.orange, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.orange, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
inactive = {
a = {bg = colors.gray, fg = colors.white, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.gray, fg = colors.white}
}
a = { bg = colors.gray, fg = colors.white, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
}

View File

@ -16,38 +16,38 @@ local colors = {
return {
normal = {
a = {bg = colors.green, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.green, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
insert = {
a = {bg = colors.fg, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.fg, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
visual = {
a = {bg = colors.red, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.red, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
replace = {
a = {bg = colors.orange, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.orange, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
command = {
a = {bg = colors.aqua, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.aqua, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
terminal = {
a = {bg = colors.purple, fg = colors.bg0, gui = 'bold'},
b = {bg = colors.bg3, fg = colors.fg},
c = {bg = colors.bg1, fg = colors.fg}
a = { bg = colors.purple, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
inactive = {
a = {bg = colors.bg1, fg = colors.grey1, gui = 'bold'},
b = {bg = colors.bg1, fg = colors.grey1},
c = {bg = colors.bg1, fg = colors.grey1}
}
a = { bg = colors.bg1, fg = colors.grey1, gui = 'bold' },
b = { bg = colors.bg1, fg = colors.grey1 },
c = { bg = colors.bg1, fg = colors.grey1 },
},
}

View File

@ -16,14 +16,14 @@ local colors = {
return {
normal = {
a = {fg = colors.fg1, bg = colors.color4, gui = 'bold'},
b = {fg = colors.fg2, bg = colors.color2},
c = {fg = colors.fg2, bg = colors.color3}
a = { fg = colors.fg1, bg = colors.color4, gui = 'bold' },
b = { fg = colors.fg2, bg = colors.color2 },
c = { fg = colors.fg2, bg = colors.color3 },
},
command = {a = {fg = colors.fg1, bg = colors.color5, gui = 'bold'}},
inactive = {a = {fg = colors.fg2, bg = colors.color2}},
insert = {a = {fg = colors.fg1, bg = colors.color6, gui = 'bold'}},
replace = {a = {fg = colors.fg1, bg = colors.color7, gui = 'bold'}},
terminal = {a = {fg = colors.fg1, bg = colors.color8, gui = 'bold'}},
visual = {a = {fg = colors.fg1, bg = colors.color9, gui = 'bold'}}
command = { a = { fg = colors.fg1, bg = colors.color5, gui = 'bold' } },
inactive = { a = { fg = colors.fg2, bg = colors.color2 } },
insert = { a = { fg = colors.fg1, bg = colors.color6, gui = 'bold' } },
replace = { a = { fg = colors.fg1, bg = colors.color7, gui = 'bold' } },
terminal = { a = { fg = colors.fg1, bg = colors.color8, gui = 'bold' } },
visual = { a = { fg = colors.fg1, bg = colors.color9, gui = 'bold' } },
}

View File

@ -16,33 +16,33 @@ local colors = {
return {
normal = {
a = {bg = colors.gray, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.gray}
a = { bg = colors.gray, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.gray },
},
insert = {
a = {bg = colors.blue, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.lightgray, fg = colors.white}
a = { bg = colors.blue, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.lightgray, fg = colors.white },
},
visual = {
a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.black}
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.inactivegray, fg = colors.black },
},
replace = {
a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.black, fg = colors.white}
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.black, fg = colors.white },
},
command = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.black}
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.inactivegray, fg = colors.black },
},
inactive = {
a = {bg = colors.darkgray, fg = colors.gray, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.gray},
c = {bg = colors.darkgray, fg = colors.gray}
}
a = { bg = colors.darkgray, fg = colors.gray, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.gray },
c = { bg = colors.darkgray, fg = colors.gray },
},
}

View File

@ -13,33 +13,33 @@ local colors = {
return {
normal = {
a = {bg = colors.darkgray, fg = colors.white, gui = 'bold'},
b = {bg = colors.gray, fg = colors.darkgray},
c = {bg = colors.lightgray, fg = colors.darkgray},
a = { bg = colors.darkgray, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.lightgray, fg = colors.darkgray },
},
insert = {
a = {bg = colors.blue, fg = colors.white, gui = 'bold'},
b = {bg = colors.gray, fg = colors.darkgray},
c = {bg = colors.gray, fg = colors.black},
a = { bg = colors.blue, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.gray, fg = colors.black },
},
visual = {
a = {bg = colors.orange, fg = colors.white, gui = 'bold'},
b = {bg = colors.gray, fg = colors.darkgray},
c = {bg = colors.darkgray, fg = colors.white},
a = { bg = colors.orange, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.darkgray, fg = colors.white },
},
replace = {
a = {bg = colors.green, fg = colors.white, gui = 'bold'},
b = {bg = colors.gray, fg = colors.darkgray},
c = {bg = colors.gray, fg = colors.black},
a = { bg = colors.green, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.gray, fg = colors.black },
},
command = {
a = {bg = colors.darkgray, fg = colors.white, gui = 'bold'},
b = {bg = colors.gray, fg = colors.darkgray},
c = {bg = colors.lightgray, fg = colors.darkgray},
a = { bg = colors.darkgray, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.lightgray, fg = colors.darkgray },
},
inactive = {
a = {bg = colors.lightgray, fg = colors.inactivegray},
b = {bg = colors.lightgray, fg = colors.inactivegray},
c = {bg = colors.lightgray, fg = colors.inactivegray},
}
a = { bg = colors.lightgray, fg = colors.inactivegray },
b = { bg = colors.lightgray, fg = colors.inactivegray },
c = { bg = colors.lightgray, fg = colors.inactivegray },
},
}

View File

@ -16,33 +16,33 @@ local colors = {
return {
normal = {
a = {bg = colors.gray, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.white},
a = { bg = colors.gray, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
insert = {
a = {bg = colors.blue, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.white}
a = { bg = colors.blue, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
visual = {
a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.white}
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
replace = {
a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.white}
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
command = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.white}
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
inactive = {
a = {bg = colors.inactivegray, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.inactivegray, fg = colors.lightgray},
c = {bg = colors.inactivegray, fg = colors.lightgray}
}
a = { bg = colors.inactivegray, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.inactivegray, fg = colors.lightgray },
c = { bg = colors.inactivegray, fg = colors.lightgray },
},
}

View File

@ -18,25 +18,25 @@ local colors = {
return {
visual = {
a = {fg = colors.color2, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = {fg = colors.color2, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = {fg = colors.color9, bg = colors.color10},
a = {fg = colors.color9, bg = colors.color10, gui = 'bold'},
b = {fg = colors.color9, bg = colors.color10}
c = { fg = colors.color9, bg = colors.color10 },
a = { fg = colors.color9, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color9, bg = colors.color10 },
},
normal = {
c = {fg = colors.color9, bg = colors.color10},
a = {fg = colors.color11, bg = colors.color12, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color9, bg = colors.color10 },
a = { fg = colors.color11, bg = colors.color12, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = {fg = colors.color2, bg = colors.color15, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
}
a = { fg = colors.color2, bg = colors.color15, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

View File

@ -16,25 +16,25 @@ local colors = {
return {
replace = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color0, bg = colors.color2, gui = 'bold'}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color0, bg = colors.color2, gui = 'bold' },
},
visual = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color0, bg = colors.color5, gui = 'bold'}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color0, bg = colors.color5, gui = 'bold' },
},
normal = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color0, bg = colors.color8, gui = 'bold'},
c = {fg = colors.color9, bg = colors.color10}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color0, bg = colors.color8, gui = 'bold' },
c = { fg = colors.color9, bg = colors.color10 },
},
inactive = {
b = {fg = colors.color9, bg = colors.color10},
a = {fg = colors.color9, bg = colors.color10, gui = 'bold'},
c = {fg = colors.color9, bg = colors.color10}
b = { fg = colors.color9, bg = colors.color10 },
a = { fg = colors.color9, bg = colors.color10, gui = 'bold' },
c = { fg = colors.color9, bg = colors.color10 },
},
insert = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color0, bg = colors.color11, gui = 'bold'}
}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color0, bg = colors.color11, gui = 'bold' },
},
}

View File

@ -17,25 +17,25 @@ local colors = {
return {
visual = {
a = {fg = colors.color2, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = {fg = colors.color2, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = {fg = colors.color9, bg = colors.color2},
a = {fg = colors.color10, bg = colors.color2, gui = 'bold'},
b = {fg = colors.color9, bg = colors.color2}
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color10, bg = colors.color2, gui = 'bold' },
b = { fg = colors.color9, bg = colors.color2 },
},
normal = {
c = {fg = colors.color10, bg = colors.color2},
a = {fg = colors.color2, bg = colors.color11, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
c = { fg = colors.color10, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color11, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = {fg = colors.color2, bg = colors.color14, gui = 'bold'},
b = {fg = colors.color4, bg = colors.color5}
}
a = { fg = colors.color2, bg = colors.color14, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

View File

@ -18,25 +18,25 @@ local colors = {
return {
normal = {
a = {fg = colors.bg, bg = colors.blue, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3},
c = {fg = colors.fg, bg = colors.gray2}
a = { fg = colors.bg, bg = colors.blue, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
c = { fg = colors.fg, bg = colors.gray2 },
},
insert = {
a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3}
a = { fg = colors.bg, bg = colors.green, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
},
visual = {
a = {fg = colors.bg, bg = colors.purple, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3}
a = { fg = colors.bg, bg = colors.purple, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
},
replace = {
a = {fg = colors.bg, bg = colors.red1, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3}
a = { fg = colors.bg, bg = colors.red1, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
},
inactive = {
a = {fg = colors.fg, bg = colors.bg, gui = 'bold'},
b = {fg = colors.fg, bg = colors.bg},
c = {fg = colors.fg, bg = colors.gray2}
}
a = { fg = colors.fg, bg = colors.bg, gui = 'bold' },
b = { fg = colors.fg, bg = colors.bg },
c = { fg = colors.fg, bg = colors.gray2 },
},
}

View File

@ -16,33 +16,33 @@ local colors = {
return {
normal = {
a = {bg = colors.blue, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.blue},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.blue, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.blue },
c = { bg = colors.gray, fg = colors.white },
},
insert = {
a = {bg = colors.cyan, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.cyan},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.cyan, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.cyan },
c = { bg = colors.gray, fg = colors.white },
},
visual = {
a = {bg = colors.magenta, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.magenta},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.magenta, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.magenta },
c = { bg = colors.gray, fg = colors.white },
},
replace = {
a = {bg = colors.red, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.red},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.red, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.red },
c = { bg = colors.gray, fg = colors.white },
},
command = {
a = {bg = colors.green, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.green},
c = {bg = colors.gray, fg = colors.white}
a = { bg = colors.green, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.green },
c = { bg = colors.gray, fg = colors.white },
},
inactive = {
a = {bg = colors.darkgray, fg = colors.lightgray, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.lightgray},
c = {bg = colors.darkgray, fg = colors.lightgray}
}
a = { bg = colors.darkgray, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.lightgray },
c = { bg = colors.darkgray, fg = colors.lightgray },
},
}

View File

@ -16,16 +16,16 @@ local colors = {
return {
normal = {
a = {fg = colors.black, bg = colors.cyan, gui = 'bold'},
b = {fg = colors.black, bg = colors.pink},
c = {fg = colors.orange, bg = colors.black}
a = { fg = colors.black, bg = colors.cyan, gui = 'bold' },
b = { fg = colors.black, bg = colors.pink },
c = { fg = colors.orange, bg = colors.black },
},
insert = {a = {fg = colors.black, bg = colors.green, gui = 'bold'}},
visual = {a = {fg = colors.black, bg = colors.yellow, gui = 'bold'}},
replace = {a = {fg = colors.black, bg = colors.red, gui = 'bold'}},
insert = { a = { fg = colors.black, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.black, bg = colors.yellow, gui = 'bold' } },
replace = { a = { fg = colors.black, bg = colors.red, gui = 'bold' } },
inactive = {
a = {fg = colors.pink, bg = colors.black, gui = 'bold'},
b = {fg = colors.white, bg = colors.pink},
c = {fg = colors.gray, bg = colors.black}
}
a = { fg = colors.pink, bg = colors.black, gui = 'bold' },
b = { fg = colors.white, bg = colors.pink },
c = { fg = colors.gray, bg = colors.black },
},
}

View File

@ -16,25 +16,25 @@ local colors = {
return {
replace = {
a = {fg = colors.color0, bg = colors.color1, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
inactive = {
a = {fg = colors.color6, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color6, bg = colors.color3},
c = {fg = colors.color6, bg = colors.color3}
a = { fg = colors.color6, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color6, bg = colors.color3 },
c = { fg = colors.color6, bg = colors.color3 },
},
normal = {
a = {fg = colors.color0, bg = colors.color7, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3},
c = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color7, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color2, bg = colors.color3 },
},
visual = {
a = {fg = colors.color0, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
insert = {
a = {fg = colors.color0, bg = colors.color2, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
}
a = { fg = colors.color0, bg = colors.color2, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
}

View File

@ -13,25 +13,25 @@ local colors = {
return {
replace = {
a = {fg = colors.color0, bg = colors.color1, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
inactive = {
a = {fg = colors.color6, bg = colors.color3, gui = 'bold'},
b = {fg = colors.color6, bg = colors.color3},
c = {fg = colors.color6, bg = colors.color3}
a = { fg = colors.color6, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color6, bg = colors.color3 },
c = { fg = colors.color6, bg = colors.color3 },
},
normal = {
a = {fg = colors.color0, bg = colors.color7, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3},
c = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color7, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color2, bg = colors.color3 },
},
visual = {
a = {fg = colors.color0, bg = colors.color8, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
a = { fg = colors.color0, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
insert = {
a = {fg = colors.color0, bg = colors.color2, gui = 'bold'},
b = {fg = colors.color2, bg = colors.color3}
}
a = { fg = colors.color0, bg = colors.color2, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
},
}

View File

@ -13,17 +13,16 @@ local colors = {
return {
normal = {
a = {fg = colors.nord1, bg = colors.nord8, gui = 'bold'},
b = {fg = colors.nord5, bg = colors.nord1},
c = {fg = colors.nord5, bg = colors.nord3}
a = { fg = colors.nord1, bg = colors.nord8, gui = 'bold' },
b = { fg = colors.nord5, bg = colors.nord1 },
c = { fg = colors.nord5, bg = colors.nord3 },
},
insert = {a = {fg = colors.nord1, bg = colors.nord6, gui = 'bold'}},
visual = {a = {fg = colors.nord1, bg = colors.nord7, gui = 'bold'}},
replace = {a = {fg = colors.nord1, bg = colors.nord13, gui = 'bold'}},
insert = { a = { fg = colors.nord1, bg = colors.nord6, gui = 'bold' } },
visual = { a = { fg = colors.nord1, bg = colors.nord7, gui = 'bold' } },
replace = { a = { fg = colors.nord1, bg = colors.nord13, gui = 'bold' } },
inactive = {
a = {fg = colors.nord1, bg = colors.nord8, gui = 'bold'},
b = {fg = colors.nord5, bg = colors.nord1},
c = {fg = colors.nord5, bg = colors.nord1}
}
a = { fg = colors.nord1, bg = colors.nord8, gui = 'bold' },
b = { fg = colors.nord5, bg = colors.nord1 },
c = { fg = colors.nord5, bg = colors.nord1 },
},
}

View File

@ -18,16 +18,16 @@ local colors = {
return {
normal = {
a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3},
c = {fg = colors.fg, bg = colors.gray2}
a = { fg = colors.bg, bg = colors.green, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
c = { fg = colors.fg, bg = colors.gray2 },
},
insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}},
visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}},
replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}},
insert = { a = { fg = colors.bg, bg = colors.blue, gui = 'bold' } },
visual = { a = { fg = colors.bg, bg = colors.purple, gui = 'bold' } },
replace = { a = { fg = colors.bg, bg = colors.red1, gui = 'bold' } },
inactive = {
a = {fg = colors.gray1, bg = colors.bg, gui = 'bold'},
b = {fg = colors.gray1, bg = colors.bg},
c = {fg = colors.gray1, bg = colors.gray2}
}
a = { fg = colors.gray1, bg = colors.bg, gui = 'bold' },
b = { fg = colors.gray1, bg = colors.bg },
c = { fg = colors.gray1, bg = colors.gray2 },
},
}

View File

@ -18,17 +18,16 @@ local colors = {
return {
normal = {
a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = {fg = colors.fg, bg = colors.gray3},
c = {fg = colors.fg, bg = colors.gray2}
a = { fg = colors.bg, bg = colors.green, gui = 'bold' },
b = { fg = colors.fg, bg = colors.gray3 },
c = { fg = colors.fg, bg = colors.gray2 },
},
insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}},
visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}},
replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}},
insert = { a = { fg = colors.bg, bg = colors.blue, gui = 'bold' } },
visual = { a = { fg = colors.bg, bg = colors.purple, gui = 'bold' } },
replace = { a = { fg = colors.bg, bg = colors.red1, gui = 'bold' } },
inactive = {
a = {fg = colors.bg, bg = colors.gray3, gui = 'bold'},
b = {fg = colors.bg, bg = colors.gray3},
c = {fg = colors.gray3, bg = colors.gray2}
}
a = { fg = colors.bg, bg = colors.gray3, gui = 'bold' },
b = { fg = colors.bg, bg = colors.gray3 },
c = { fg = colors.gray3, bg = colors.gray2 },
},
}

View File

@ -23,25 +23,25 @@ local colors = {
return {
normal = {
a = {fg = colors.black, bg = colors.purple, gui = 'bold'},
b = {fg = colors.purple, bg = colors.menu_grey},
c = {fg = colors.comment_grey, bg = colors.black}
a = { fg = colors.black, bg = colors.purple, gui = 'bold' },
b = { fg = colors.purple, bg = colors.menu_grey },
c = { fg = colors.comment_grey, bg = colors.black },
},
insert = {
a = {fg = colors.black, bg = colors.blue, gui = 'bold'},
b = {fg = colors.blue, bg = colors.menu_grey}
a = { fg = colors.black, bg = colors.blue, gui = 'bold' },
b = { fg = colors.blue, bg = colors.menu_grey },
},
visual = {
a = {fg = colors.black, bg = colors.cyan, gui = 'bold'},
b = {fg = colors.cyan, bg = colors.menu_grey}
a = { fg = colors.black, bg = colors.cyan, gui = 'bold' },
b = { fg = colors.cyan, bg = colors.menu_grey },
},
replace = {
a = {fg = colors.black, bg = colors.green, gui = 'bold'},
b = {fg = colors.green, bg = colors.menu_grey}
a = { fg = colors.black, bg = colors.green, gui = 'bold' },
b = { fg = colors.green, bg = colors.menu_grey },
},
inactive = {
a = {fg = colors.black, bg = colors.menu_grey, gui = 'bold'},
b = {fg = colors.black, bg = colors.menu_grey},
c = {fg = colors.black, bg = colors.menu_grey}
}
a = { fg = colors.black, bg = colors.menu_grey, gui = 'bold' },
b = { fg = colors.black, bg = colors.menu_grey },
c = { fg = colors.black, bg = colors.menu_grey },
},
}

View File

@ -27,17 +27,16 @@ local colors = {
return {
normal = {
a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = {fg = colors.statusline_active_fg, bg = colors.status},
c = {fg = colors.statusline_active_fg, bg = colors.statusline_active_bg}
a = { fg = colors.foreground, bg = colors.background, gui = 'bold' },
b = { fg = colors.statusline_active_fg, bg = colors.status },
c = { fg = colors.statusline_active_fg, bg = colors.statusline_active_bg },
},
insert = {a = {fg = colors.background, bg = colors.blue, gui = 'bold'}},
visual = {a = {fg = colors.visual_fg, bg = colors.visual_bg, gui = 'bold'}},
replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}},
insert = { a = { fg = colors.background, bg = colors.blue, gui = 'bold' } },
visual = { a = { fg = colors.visual_fg, bg = colors.visual_bg, gui = 'bold' } },
replace = { a = { fg = colors.background, bg = colors.pink, gui = 'bold' } },
inactive = {
a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = {fg = colors.foreground, bg = colors.background},
c = {fg = colors.foreground, bg = colors.background}
}
a = { fg = colors.foreground, bg = colors.background, gui = 'bold' },
b = { fg = colors.foreground, bg = colors.background },
c = { fg = colors.foreground, bg = colors.background },
},
}

View File

@ -25,17 +25,16 @@ local colors = {
return {
normal = {
a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = {fg = colors.statusline_active_fg, bg = colors.status},
c = {fg = colors.statusline_active_fg, bg = colors.statusline_active_bg}
a = { fg = colors.foreground, bg = colors.background, gui = 'bold' },
b = { fg = colors.statusline_active_fg, bg = colors.status },
c = { fg = colors.statusline_active_fg, bg = colors.statusline_active_bg },
},
insert = {a = {fg = colors.blue, bg = colors.background, gui = 'bold'}},
visual = {a = {fg = colors.background, bg = colors.orange, gui = 'bold'}},
replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}},
insert = { a = { fg = colors.blue, bg = colors.background, gui = 'bold' } },
visual = { a = { fg = colors.background, bg = colors.orange, gui = 'bold' } },
replace = { a = { fg = colors.background, bg = colors.pink, gui = 'bold' } },
inactive = {
a = {fg = colors.foreground, bg = colors.background, gui = 'bold'},
b = {fg = colors.foreground, bg = colors.background},
c = {fg = colors.foreground, bg = colors.background}
}
a = { fg = colors.foreground, bg = colors.background, gui = 'bold' },
b = { fg = colors.foreground, bg = colors.background },
c = { fg = colors.foreground, bg = colors.background },
},
}

View File

@ -21,20 +21,20 @@ local Colors = {
return {
normal = {
a = {fg = Colors.darkestgreen, bg = Colors.brightgreen, gui = 'bold'},
b = {fg = Colors.gray10, bg = Colors.gray5},
c = {fg = Colors.gray7, bg = Colors.gray2}
a = { fg = Colors.darkestgreen, bg = Colors.brightgreen, gui = 'bold' },
b = { fg = Colors.gray10, bg = Colors.gray5 },
c = { fg = Colors.gray7, bg = Colors.gray2 },
},
insert = {
a = {fg = Colors.darkestcyan, bg = Colors.white, gui = 'bold'},
b = {fg = Colors.darkestcyan, bg = Colors.mediumcyan},
c = {fg = Colors.mediumcyan, bg = Colors.darkestblue}
a = { fg = Colors.darkestcyan, bg = Colors.white, gui = 'bold' },
b = { fg = Colors.darkestcyan, bg = Colors.mediumcyan },
c = { fg = Colors.mediumcyan, bg = Colors.darkestblue },
},
visual = {a = {fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold'}},
replace = {a = {fg = Colors.white, bg = Colors.brightred, gui = 'bold'}},
visual = { a = { fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold' } },
replace = { a = { fg = Colors.white, bg = Colors.brightred, gui = 'bold' } },
inactive = {
a = {fg = Colors.gray1, bg = Colors.gray5, gui = 'bold'},
b = {fg = Colors.gray1, bg = Colors.gray5},
c = {bg = Colors.gray1, fg = Colors.gray5}
}
a = { fg = Colors.gray1, bg = Colors.gray5, gui = 'bold' },
b = { fg = Colors.gray1, bg = Colors.gray5 },
c = { bg = Colors.gray1, fg = Colors.gray5 },
},
}

View File

@ -24,33 +24,33 @@ local colors = {
return {
normal = {
a = {bg = colors.neon, fg = colors.black, gui = 'bold'},
b = {bg = colors.gray, fg = colors.white},
c = {bg = colors.black, fg = colors.brightgreen}
a = { bg = colors.neon, fg = colors.black, gui = 'bold' },
b = { bg = colors.gray, fg = colors.white },
c = { bg = colors.black, fg = colors.brightgreen },
},
insert = {
a = {bg = colors.blue, fg = colors.darkblue, gui = 'bold'},
b = {bg = colors.navyblue, fg = colors.white},
c = {bg = colors.purple, fg = colors.white}
a = { bg = colors.blue, fg = colors.darkblue, gui = 'bold' },
b = { bg = colors.navyblue, fg = colors.white },
c = { bg = colors.purple, fg = colors.white },
},
visual = {
a = {bg = colors.orange, fg = colors.black, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.white},
c = {bg = colors.red, fg = colors.white}
a = { bg = colors.orange, fg = colors.black, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.white },
c = { bg = colors.red, fg = colors.white },
},
replace = {
a = {bg = colors.brightred, fg = colors.white, gui = 'bold'},
b = {bg = colors.cyan, fg = colors.darkblue},
c = {bg = colors.navyblue, fg = colors.white}
a = { bg = colors.brightred, fg = colors.white, gui = 'bold' },
b = { bg = colors.cyan, fg = colors.darkblue },
c = { bg = colors.navyblue, fg = colors.white },
},
command = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.white},
c = {bg = colors.black, fg = colors.brightgreen}
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.white },
c = { bg = colors.black, fg = colors.brightgreen },
},
inactive = {
a = {bg = colors.darkgray, fg = colors.gray, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.gray},
c = {bg = colors.darkgray, fg = colors.gray}
}
a = { bg = colors.darkgray, fg = colors.gray, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.gray },
c = { bg = colors.darkgray, fg = colors.gray },
},
}

View File

@ -17,25 +17,25 @@ local colors = {
return {
visual = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color4, bg = colors.color5, gui = 'bold'}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
},
inactive = {
b = {fg = colors.color6, bg = colors.color4},
c = {fg = colors.color6, bg = colors.color4},
a = {fg = colors.color7, bg = colors.color4, gui = 'bold'}
b = { fg = colors.color6, bg = colors.color4 },
c = { fg = colors.color6, bg = colors.color4 },
a = { fg = colors.color7, bg = colors.color4, gui = 'bold' },
},
insert = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color4, bg = colors.color10, gui = 'bold'}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color4, bg = colors.color10, gui = 'bold' },
},
replace = {
b = {fg = colors.color0, bg = colors.color1},
a = {fg = colors.color4, bg = colors.color13, gui = 'bold'}
b = { fg = colors.color0, bg = colors.color1 },
a = { fg = colors.color4, bg = colors.color13, gui = 'bold' },
},
normal = {
b = {fg = colors.color0, bg = colors.color1},
c = {fg = colors.color7, bg = colors.color4},
a = {fg = colors.color4, bg = colors.color14, gui = 'bold'}
}
b = { fg = colors.color0, bg = colors.color1 },
c = { fg = colors.color7, bg = colors.color4 },
a = { fg = colors.color4, bg = colors.color14, gui = 'bold' },
},
}

View File

@ -23,16 +23,16 @@ local colors = {
return {
normal = {
a = {fg = colors.base03, bg = colors.blue, gui = 'bold'},
b = {fg = colors.base03, bg = colors.base1},
c = {fg = colors.base1, bg = colors.base02}
a = { fg = colors.base03, bg = colors.blue, gui = 'bold' },
b = { fg = colors.base03, bg = colors.base1 },
c = { fg = colors.base1, bg = colors.base02 },
},
insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}},
visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}},
replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}},
insert = { a = { fg = colors.base03, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.base03, bg = colors.magenta, gui = 'bold' } },
replace = { a = { fg = colors.base03, bg = colors.red, gui = 'bold' } },
inactive = {
a = {fg = colors.base0, bg = colors.base02, gui = 'bold'},
b = {fg = colors.base03, bg = colors.base00},
c = {fg = colors.base01, bg = colors.base02}
}
a = { fg = colors.base0, bg = colors.base02, gui = 'bold' },
b = { fg = colors.base03, bg = colors.base00 },
c = { fg = colors.base01, bg = colors.base02 },
},
}

View File

@ -23,16 +23,16 @@ local colors = {
return {
normal = {
a = {fg = colors.base03, bg = colors.blue, gui = 'bold'},
b = {fg = colors.base03, bg = colors.base1},
c = {fg = colors.base1, bg = colors.base02}
a = { fg = colors.base03, bg = colors.blue, gui = 'bold' },
b = { fg = colors.base03, bg = colors.base1 },
c = { fg = colors.base1, bg = colors.base02 },
},
insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}},
visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}},
replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}},
insert = { a = { fg = colors.base03, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.base03, bg = colors.magenta, gui = 'bold' } },
replace = { a = { fg = colors.base03, bg = colors.red, gui = 'bold' } },
inactive = {
a = {fg = colors.base0, bg = colors.base02, gui = 'bold'},
b = {fg = colors.base03, bg = colors.base00},
c = {fg = colors.base01, bg = colors.base02}
}
a = { fg = colors.base0, bg = colors.base02, gui = 'bold' },
b = { fg = colors.base03, bg = colors.base00 },
c = { fg = colors.base01, bg = colors.base02 },
},
}

View File

@ -23,16 +23,16 @@ local colors = {
return {
normal = {
a = {fg = colors.base02, bg = colors.blue, gui = 'bold'},
b = {fg = colors.base02, bg = colors.base0},
c = {fg = colors.base2, bg = colors.base02}
a = { fg = colors.base02, bg = colors.blue, gui = 'bold' },
b = { fg = colors.base02, bg = colors.base0 },
c = { fg = colors.base2, bg = colors.base02 },
},
insert = {a = {fg = colors.base02, bg = colors.green, gui = 'bold'}},
visual = {a = {fg = colors.base02, bg = colors.magenta, gui = 'bold'}},
replace = {a = {fg = colors.base023, bg = colors.red, gui = 'bold'}},
insert = { a = { fg = colors.base02, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.base02, bg = colors.magenta, gui = 'bold' } },
replace = { a = { fg = colors.base023, bg = colors.red, gui = 'bold' } },
inactive = {
a = {fg = colors.base1, bg = colors.base02, gui = 'bold'},
b = {fg = colors.base023, bg = colors.base01},
c = {fg = colors.base1, bg = colors.base023}
}
a = { fg = colors.base1, bg = colors.base02, gui = 'bold' },
b = { fg = colors.base023, bg = colors.base01 },
c = { fg = colors.base1, bg = colors.base023 },
},
}

View File

@ -291,7 +291,7 @@ function M.rgb2cterm(hex_color)
local closest_cterm_color = 0
local min_distance = 10000
for _, color in ipairs(color_table) do
local current_distance = get_color_distance(color[2], {r, g, b})
local current_distance = get_color_distance(color[2], { r, g, b })
if current_distance < min_distance then
min_distance = current_distance
closest_cterm_color = color[1]
@ -303,7 +303,7 @@ end
function M.color_name2rgb(name)
local color_val = vim.api.nvim_get_color_by_name(name)
if color_val == -1 then
return '#'..name -- Assuming it's 'rrggbb' without # not rad instead of red
return '#' .. name -- Assuming it's 'rrggbb' without # not rad instead of red
end
return string.format('#%06x', color_val)
end
@ -312,7 +312,7 @@ function M.cterm2rgb(color)
local color_data = color_table[color + 1]
if color_data ~= nil then
color_data = color_data[2]
return string.format("#%02x%02x%02x", color_data[1], color_data[2], color_data[3])
return string.format('#%02x%02x%02x', color_data[1], color_data[2], color_data[3])
end
end

View File

@ -5,8 +5,12 @@ local Job = setmetatable({
return self.job_id > 0
end,
stop = function(self)
if self.killed then return end
if self.job_id and self.job_id > 0 then vim.fn.jobstop(self.job_id) end
if self.killed then
return
end
if self.job_id and self.job_id > 0 then
vim.fn.jobstop(self.job_id)
end
self.job_id = 0
self.killed = true
end,
@ -16,19 +20,23 @@ local Job = setmetatable({
local original_cb = self.args[name]
if original_cb then
self.args[name] = function(...)
if not self.killed then return original_cb(...) end
if not self.killed then
return original_cb(...)
end
end
end
}, {
end,
}, {
__call = function(self, args)
args = vim.deepcopy(args or {})
if type(args.cmd) == 'string' then args.cmd = vim.split(args.cmd, ' ') end
if type(args.cmd) == 'string' then
args.cmd = vim.split(args.cmd, ' ')
end
self.__index = self
local job = setmetatable({args = args}, self)
job:wrap_cb_alive('on_stdout')
job:wrap_cb_alive('on_stderr')
job:wrap_cb_alive('on_stdin')
local job = setmetatable({ args = args }, self)
job:wrap_cb_alive 'on_stdout'
job:wrap_cb_alive 'on_stderr'
job:wrap_cb_alive 'on_stdin'
return job
end,
})

View File

@ -1,9 +1,9 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require'lualine_require'
local lualine_require = require 'lualine_require'
local require = lualine_require.require
local modules = lualine_require.lazy_require{
local modules = lualine_require.lazy_require {
notice = 'lualine.utils.notices',
}
local is_valid_filename = lualine_require.is_valid_filename
@ -12,11 +12,10 @@ local sep = lualine_require.sep
local component_types = {
luaf = function(component)
return
require('lualine.components.special.function_component'):new(component)
return require('lualine.components.special.function_component'):new(component)
end,
mod = function(component)
local ok, loaded_component = pcall(require,'lualine.components.'..component[1])
local ok, loaded_component = pcall(require, 'lualine.components.' .. component[1])
if ok then
component.component_name = component[1]
loaded_component = loaded_component:new(component)
@ -25,18 +24,17 @@ local component_types = {
end,
stl = function(component)
local stl_expr = component[1] -- Vim's %p %l statusline elements
component[1] = function() return stl_expr end
return
require('lualine.components.special.function_component'):new(component)
component[1] = function()
return stl_expr
end
return require('lualine.components.special.function_component'):new(component)
end,
var = function(component)
return
require('lualine.components.special.vim_var_component'):new(component)
return require('lualine.components.special.vim_var_component'):new(component)
end,
['_'] = function(component)
return
require('lualine.components.special.eval_func_component'):new(component)
end
return require('lualine.components.special.eval_func_component'):new(component)
end,
}
local function component_loader(component)
@ -51,10 +49,13 @@ local function component_loader(component)
elseif component.type == 'vimf' or component.type == 'luae' then
return component_types['_'](component)
else
modules.notice.add_notice(string.format([[
modules.notice.add_notice(string.format(
[[
### component.type
component type '%s' isn't recognised. Check if spelling is correct.]], component.type))
component type '%s' isn't recognised. Check if spelling is correct.]],
component.type
))
end
end
local loaded_component = component_types.mod(component)
@ -62,7 +63,7 @@ component type '%s' isn't recognised. Check if spelling is correct.]], component
return loaded_component
elseif string.char(component[1]:byte(1)) == '%' then
return component_types.stl(component)
elseif component[1]:find('[gvtwb]?o?:') == 1 then
elseif component[1]:find '[gvtwb]?o?:' == 1 then
return component_types.var(component)
else
return component_types['_'](component)
@ -74,7 +75,7 @@ local function load_sections(sections, options)
for section_name, section in pairs(sections) do
for index, component in pairs(section) do
if type(component) == 'string' or type(component) == 'function' then
component = {component}
component = { component }
end
component.self = {}
component.self.section = section_name
@ -95,7 +96,7 @@ local function load_extensions(config)
local loaded_extensions = {}
for _, extension in pairs(config.extensions) do
if type(extension) == 'string' then
local ok, local_extension = pcall(require, 'lualine.extensions.' ..extension)
local ok, local_extension = pcall(require, 'lualine.extensions.' .. extension)
if ok then
local_extension = vim.deepcopy(local_extension)
load_sections(local_extension.sections, config.options)
@ -107,10 +108,13 @@ local function load_extensions(config)
end
table.insert(loaded_extensions, local_extension)
else
modules.notice.add_notice(string.format([[
modules.notice.add_notice(string.format(
[[
### Extensions
Extension named `%s` was not found . Check if spelling is correct.
]], extension))
]],
extension
))
end
elseif type(extension) == 'table' then
local local_extension = vim.deepcopy(extension)
@ -133,20 +137,20 @@ local function load_all(config)
end
local function load_theme(theme_name)
assert(is_valid_filename(theme_name), "Invalid filename")
assert(is_valid_filename(theme_name), 'Invalid filename')
local retval
local path = table.concat({'lua', 'lualine', 'themes', theme_name}, sep)..'.lua'
local path = table.concat({ 'lua', 'lualine', 'themes', theme_name }, sep) .. '.lua'
local files = lualine_require.rtp_searcher(path)
local n_files = #files
if n_files == 0 then
-- No match found
error(path .. " Not found")
error(path .. ' Not found')
elseif n_files == 1 then
-- when only one is found run that and return it's return value
retval = dofile(files[1])
else
-- More then 1 found . Use the first one that isn't in lualines repo
local lualine_repo_pattern = table.concat({'lualine.nvim', 'lua', 'lualine'}, sep)
local lualine_repo_pattern = table.concat({ 'lualine.nvim', 'lua', 'lualine' }, sep)
local file_found = false
for _, file in ipairs(files) do
if not file:find(lualine_repo_pattern) then
@ -166,5 +170,5 @@ end
return {
load_all = load_all,
load_theme = load_theme
load_theme = load_theme,
}

View File

@ -36,7 +36,9 @@ Mode.map = {
function Mode.get_mode()
local mode_code = vim.api.nvim_get_mode().mode
if Mode.map[mode_code] == nil then return mode_code end
if Mode.map[mode_code] == nil then
return mode_code
end
return Mode.map[mode_code]
end

View File

@ -3,17 +3,21 @@ local M = {}
local notices = {}
function M.add_notice(notice)
if type(notice) == 'string' then notice = vim.split(notice, "\n") end
if type(notice) == 'string' then
notice = vim.split(notice, '\n')
end
table.insert(notices, notice)
end
function M.notice_message_startup()
if #notices > 0 then
vim.cmd('command! -nargs=0 LualineNotices lua require"lualine.utils.notices".show_notices()')
vim.cmd 'command! -nargs=0 LualineNotices lua require"lualine.utils.notices".show_notices()'
vim.schedule(function()
vim.notify(
"lualine: There are some issues with your config. Run :LualineNotices for details",
vim.log.levels.WARN, {})
'lualine: There are some issues with your config. Run :LualineNotices for details',
vim.log.levels.WARN,
{}
)
end)
end
end
@ -25,16 +29,15 @@ function M.show_notices()
:silent! nnoremap <silent><buffer> q <cmd>bd<cr>
:silent! normal ggdG
]]
local ok, _ = pcall(vim.api.nvim_buf_set_name, 0, "Lualine Notices")
local ok, _ = pcall(vim.api.nvim_buf_set_name, 0, 'Lualine Notices')
if not ok then
vim.notify("Lualine Notices is already open in another window",
vim.log.levels.ERROR, {})
vim.cmd('normal q')
vim.notify('Lualine Notices is already open in another window', vim.log.levels.ERROR, {})
vim.cmd 'normal q'
return
end
local notice = vim.tbl_flatten(notices)
vim.fn.append(0, notice)
vim.api.nvim_win_set_cursor(0, {1, 0})
vim.api.nvim_win_set_cursor(0, { 1, 0 })
end
function M.clear_notices()

View File

@ -1,19 +1,17 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
local require = require'lualine_require'.require
local utils = require('lualine.utils.utils')
local highlight = require('lualine.highlight')
local require = require('lualine_require').require
local utils = require 'lualine.utils.utils'
local highlight = require 'lualine.highlight'
-- Returns formated string for a section
function M.draw_section(section, section_name, is_focused)
local highlight_name = highlight.format_highlight(is_focused,
'lualine_' .. section_name)
local highlight_name = highlight.format_highlight(is_focused, 'lualine_' .. section_name)
local status = {}
for _, component in pairs(section) do
-- load components into status table
if type(component) ~= 'table' or
(type(component) == 'table' and not component.component_no) then
if type(component) ~= 'table' or (type(component) == 'table' and not component.component_no) then
return '' -- unknown element in section. section posibly not yet loaded
end
table.insert(status, component:draw(highlight_name, is_focused))
@ -26,17 +24,23 @@ function M.draw_section(section, section_name, is_focused)
-- Check through components to see when component separator need to be removed
for component_no = #section, 1, -1 do
if #status[component_no] > 0 then first_component_no = component_no end
if #status[component_no] > 0 then
first_component_no = component_no
end
-- Remove component separator with highlight for last component
if not last_component_found and #status[component_no] > 0 then
last_component_found = true
status[component_no] = section[component_no]:strip_separator()
if section_name < 'c' then
if type(section[first_component_no].options.separator) ~= 'table' and
section[1].options.section_separators[1] ~= '' then
status[component_no] = string.format('%s%%S{%s}',
status[component_no], section[1]
.options.section_separators[1])
if
type(section[first_component_no].options.separator) ~= 'table'
and section[1].options.section_separators[1] ~= ''
then
status[component_no] = string.format(
'%s%%S{%s}',
status[component_no],
section[1].options.section_separators[1]
)
end
end
end
@ -46,41 +50,50 @@ function M.draw_section(section, section_name, is_focused)
status[component_no] = section[component_no]:strip_separator()
end
-- Remove component separator when color option is used to color background
if (type(section[component_no].options.color) == 'table' and
section[component_no].options.color.bg) or
type(section[component_no].options.color) == 'string' then
if
(type(section[component_no].options.color) == 'table' and section[component_no].options.color.bg)
or type(section[component_no].options.color) == 'string'
then
strip_next_component = true
status[component_no] = section[component_no]:strip_separator()
end
if (section[component_no].strip_previous_separator == true) then
if section[component_no].strip_previous_separator == true then
strip_next_component = true
end
end
local left_sparator_string = ''
if section_name > 'x' and section[first_component_no] and
type(section[first_component_no].options.separator) ~= 'table' and
section[1].options.section_separators[2] ~= '' then
left_sparator_string = string.format('%%s{%s}',
section[first_component_no].options.ls_separator or
section[1].options.section_separators[2])
if
section_name > 'x'
and section[first_component_no]
and type(section[first_component_no].options.separator) ~= 'table'
and section[1].options.section_separators[2] ~= ''
then
left_sparator_string = string.format(
'%%s{%s}',
section[first_component_no].options.ls_separator or section[1].options.section_separators[2]
)
end
-- Remove empty strings from status
status = utils.list_shrink(status)
local status_str = table.concat(status)
if #status_str == 0 then return '' end
if #status_str == 0 then
return ''
end
local needs_hl
local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find('^%%s{.-}')
local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find '^%%s{.-}'
if find_start_trans_sep_start then
-- the section doesn't need to be prepended with default hl when sections
-- first component has trasitionals sep
needs_hl = status_str:find('^%%#', find_start_trans_sep_end + 1)
else needs_hl = status_str:find('^%%#') end
else
needs_hl = status_str:find '^%%#'
end
if needs_hl then
-- Don't prepend with old highlight when the component changes it imidiately

View File

@ -5,7 +5,9 @@ local M = {}
-- Note for now only works for termguicolors scope can be bg or fg or any other
-- attr parameter like bold/italic/reverse
function M.extract_highlight_colors(color_group, scope)
if vim.fn.hlexists(color_group) == 0 then return nil end
if vim.fn.hlexists(color_group) == 0 then
return nil
end
local color = vim.api.nvim_get_hl_by_name(color_group, true)
if color.background ~= nil then
color.bg = string.format('#%06x', color.background)
@ -15,7 +17,9 @@ function M.extract_highlight_colors(color_group, scope)
color.fg = string.format('#%06x', color.foreground)
color.foreground = nil
end
if scope then return color[scope] end
if scope then
return color[scope]
end
return color
end
@ -23,22 +27,26 @@ end
function M.list_shrink(list)
local new_list = {}
for i = 1, #list do
if list[i] and #list[i] > 0 then table.insert(new_list, list[i]) end
if list[i] and #list[i] > 0 then
table.insert(new_list, list[i])
end
end
return new_list
end
-- Check if a auto command is already defined
local function autocmd_is_defined(event, patern, command_str)
return vim.api.nvim_exec(string.format("au lualine %s %s",
event, patern), true):find(command_str) ~= nil
return vim.api.nvim_exec(string.format('au lualine %s %s', event, patern), true):find(command_str) ~= nil
end
-- Define a auto command if it's not already defined
function M.define_autocmd(event, patern, cmd)
if not cmd then cmd = patern; patern = '*' end
if not cmd then
cmd = patern
patern = '*'
end
if not autocmd_is_defined(event, patern, cmd) then
vim.cmd(string.format("autocmd lualine %s %s %s", event, patern, cmd))
vim.cmd(string.format('autocmd lualine %s %s %s', event, patern, cmd))
end
end

View File

@ -1,27 +1,31 @@
local M = {}
M.sep = package.config:sub(1,1)
M.sep = package.config:sub(1, 1)
local source = debug.getinfo(1, "S").source
if source:sub(1,1) == '@' then
local base_start = source:find(table.concat({'lualine.nvim', 'lua', 'lualine_require.lua'}, M.sep))
local source = debug.getinfo(1, 'S').source
if source:sub(1, 1) == '@' then
local base_start = source:find(table.concat({ 'lualine.nvim', 'lua', 'lualine_require.lua' }, M.sep))
if base_start then
source = source:sub(2, base_start + 12 + 1 + 3) -- #lualine.nvim = 12 , #lua = 3.
if source then M.plugin_dir = source end
if source then
M.plugin_dir = source
end
end
end
function M.is_valid_filename(name)
local invalid_chars="[^a-zA-Z0-9_. -]"
local invalid_chars = '[^a-zA-Z0-9_. -]'
return name:find(invalid_chars) == nil
end
function M.require(module)
if package.loaded[module] then return package.loaded[module] end
if package.loaded[module] then
return package.loaded[module]
end
local pattern = module:gsub('%.', M.sep) .. '.lua'
if M.plugin_dir then
local path = M.plugin_dir .. pattern
assert(M.is_valid_filename(module), "Invalid filename")
assert(M.is_valid_filename(module), 'Invalid filename')
if vim.loop.fs_stat(path) then
local mod_result = dofile(path)
package.loaded[module] = mod_result
@ -29,7 +33,7 @@ function M.require(module)
end
end
local paths = M.rtp_searcher('lua'..M.sep..pattern, true)
local paths = M.rtp_searcher('lua' .. M.sep .. pattern, true)
if #paths > 0 then
local mod_result = dofile(paths[1])
package.loaded[module] = mod_result
@ -41,11 +45,13 @@ end
function M.rtp_searcher(file, once)
local ret = {}
for dir in vim.gsplit(vim.api.nvim_get_option('rtp'), ',') do
for dir in vim.gsplit(vim.api.nvim_get_option 'rtp', ',') do
local path = dir .. M.sep .. file
if vim.loop.fs_stat(path) then
ret[#ret+1] = path
if once then break end
ret[#ret + 1] = path
if once then
break
end
end
end
return ret
@ -55,13 +61,17 @@ function M.lazy_require(modules)
return setmetatable({}, {
__index = function(self, key)
local loaded = rawget(self, key)
if loaded ~= nil then return loaded end
if loaded ~= nil then
return loaded
end
local module_location = modules[key]
if module_location == nil then return nil end
if module_location == nil then
return nil
end
local module = M.require(module_location)
rawset(self, key, module)
return module
end
end,
})
end

View File

@ -3,32 +3,54 @@ local eq = assert.are.same
local M = {}
M.meths = setmetatable({}, {
__index = function(_, key) return vim.api['nvim_' .. key] end
__index = function(_, key)
return vim.api['nvim_' .. key]
end,
})
-- Checks ouput of a component
M.assert_component = function(component, opts, result)
-- for testing global options
if component == nil then component = 'special.function_component' end
if component == nil then
component = 'special.function_component'
end
local comp = require('lualine.components.' .. component):new(opts)
eq(result, comp:draw(opts.hl))
end
-- sets defaults for component options
M.build_component_opts = function(opts)
if not opts then opts = {} end
if opts[1] == nil then opts[1] = function() return 'test' end end
if not opts.self then opts.self = {section = 'lualine_c'} end
if not opts.theme then opts.theme = 'gruvbox' end
if not opts.hl then opts.hl = '' end
if opts.icons_enabled == nil then opts.icons_enabled = true end
if not opts.component_separators then
opts.component_separators = {'', ''}
if not opts then
opts = {}
end
if opts[1] == nil then
opts[1] = function()
return 'test'
end
end
if not opts.self then
opts.self = { section = 'lualine_c' }
end
if not opts.theme then
opts.theme = 'gruvbox'
end
if not opts.hl then
opts.hl = ''
end
if opts.icons_enabled == nil then
opts.icons_enabled = true
end
if not opts.component_separators then
opts.component_separators = { '', '' }
end
if not opts.section_separators then
opts.section_separators = { '', '' }
end
if not opts.section_separators then opts.section_separators = {'', ''} end
return opts
end
M.P = function(t) print(vim.inspect(t)) end
M.P = function(t)
print(vim.inspect(t))
end
return M

View File

@ -1,5 +1,8 @@
-- load lualine and plenary
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
set rtp+=.
set rtp+=../plenary.nvim
]], false)
]],
false
)

View File

@ -9,217 +9,216 @@ local stub = require 'luassert.stub'
describe('Component:', function()
it('can select separators', function()
local opts = build_component_opts()
local comp = require('lualine.components.special.function_component'):new(
opts)
local comp = require('lualine.components.special.function_component'):new(opts)
-- correct for lualine_c
eq('', comp.options.separator)
local opts2 = build_component_opts({self = {section = 'lualine_y'}})
local comp2 = require('lualine.components.special.function_component'):new(
opts2)
local opts2 = build_component_opts { self = { section = 'lualine_y' } }
local comp2 = require('lualine.components.special.function_component'):new(opts2)
-- correct for lualine_u
eq('', comp2.options.separator)
end)
it('can provide unique identifier', function()
local opts1 = build_component_opts()
local comp1 = require('lualine.components.special.function_component'):new(
opts1)
local comp1 = require('lualine.components.special.function_component'):new(opts1)
local opts2 = build_component_opts()
local comp2 = require('lualine.components.special.function_component'):new(
opts2)
local comp2 = require('lualine.components.special.function_component'):new(opts2)
neq(comp1.component_no, comp2.component_no)
end)
it('create option highlights', function()
local color = {fg = '#224532', bg = '#892345'}
local opts1 = build_component_opts({color = color})
local color = { fg = '#224532', bg = '#892345' }
local opts1 = build_component_opts { color = color }
local hl = require 'lualine.highlight'
stub(hl, 'create_component_highlight_group')
hl.create_component_highlight_group.returns('MyCompHl')
local comp1 = require('lualine.components.special.function_component'):new(
opts1)
hl.create_component_highlight_group.returns 'MyCompHl'
local comp1 = require('lualine.components.special.function_component'):new(opts1)
eq('MyCompHl', comp1.options.color_highlight)
-- color highlight wan't in options when create_comp_hl was
-- called so remove it before assert
comp1.options.color_highlight = nil
assert.stub(hl.create_component_highlight_group).was_called_with(color,
comp1.options
.component_name,
comp1.options)
assert.stub(hl.create_component_highlight_group).was_called_with(color, comp1.options.component_name, comp1.options)
hl.create_component_highlight_group:revert()
color = 'MyHl'
local opts2 = build_component_opts({color = color})
local opts2 = build_component_opts { color = color }
stub(hl, 'create_component_highlight_group')
hl.create_component_highlight_group.returns('MyCompLinkedHl')
local comp2 = require('lualine.components.special.function_component'):new(
opts2)
hl.create_component_highlight_group.returns 'MyCompLinkedHl'
local comp2 = require('lualine.components.special.function_component'):new(opts2)
eq('MyCompLinkedHl', comp2.options.color_highlight)
-- color highlight wan't in options when create_comp_hl was
-- called so remove it before assert
comp2.options.color_highlight = nil
assert.stub(hl.create_component_highlight_group).was_called_with(color,
comp2.options
.component_name,
comp2.options)
assert.stub(hl.create_component_highlight_group).was_called_with(color, comp2.options.component_name, comp2.options)
hl.create_component_highlight_group:revert()
end)
it('can draw', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component(nil, opts, 'test')
end)
it('can apply separators', function()
local opts = build_component_opts({padding = 0})
local opts = build_component_opts { padding = 0 }
assert_component(nil, opts, 'test')
end)
it('can apply default highlight', function()
local opts = build_component_opts({padding = 0, hl = '%#My_highlight#'})
local opts = build_component_opts { padding = 0, hl = '%#My_highlight#' }
assert_component(nil, opts, '%#My_highlight#test')
opts = build_component_opts({function() return "%#Custom_hl#test" end,
padding = 0, hl = '%#My_highlight#'})
opts = build_component_opts {
function()
return '%#Custom_hl#test'
end,
padding = 0,
hl = '%#My_highlight#',
}
assert_component(nil, opts, '%#Custom_hl#test%#My_highlight#')
opts = build_component_opts({function() return "in middle%#Custom_hl#test" end,
padding = 0, hl = '%#My_highlight#'})
opts = build_component_opts {
function()
return 'in middle%#Custom_hl#test'
end,
padding = 0,
hl = '%#My_highlight#',
}
assert_component(nil, opts, '%#My_highlight#in middle%#Custom_hl#test%#My_highlight#')
end)
describe('Global options:', function()
it('upper', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
upper = true
})
upper = true,
}
assert_component(nil, opts, 'TEST')
end)
it('lower', function()
local opts = build_component_opts({
function() return 'TeSt' end,
component_separators = {'', ''},
local opts = build_component_opts {
function()
return 'TeSt'
end,
component_separators = { '', '' },
padding = 0,
lower = true
})
lower = true,
}
assert_component(nil, opts, 'test')
end)
it('left_padding', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
left_padding = 5
})
left_padding = 5,
}
assert_component(nil, opts, ' test')
end)
it('right_padding', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
right_padding = 5
})
right_padding = 5,
}
assert_component(nil, opts, 'test ')
end)
it('padding', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 5
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 5,
}
assert_component(nil, opts, ' test ')
end)
it('icon', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
icon = '0'
})
icon = '0',
}
assert_component(nil, opts, '0 test')
end)
it('icons_enabled', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
icons_enabled = true,
icon = '0'
})
icon = '0',
}
assert_component(nil, opts, '0 test')
local opts2 = build_component_opts(
{
component_separators = {'', ''},
local opts2 = build_component_opts {
component_separators = { '', '' },
padding = 0,
icons_enabled = false,
icon = '0'
})
icon = '0',
}
assert_component(nil, opts2, 'test')
end)
it('separator', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
separator = '|'
})
separator = '|',
}
assert_component(nil, opts, 'test|')
end)
it('format', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
format = function(data)
return data:sub(1, 1):upper() .. data:sub(2, #data)
end
})
end,
}
assert_component(nil, opts, 'Test')
end)
it('condition', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
condition = function() return true end
})
condition = function()
return true
end,
}
assert_component(nil, opts, 'test')
local opts2 = build_component_opts(
{
component_separators = {'', ''},
local opts2 = build_component_opts {
component_separators = { '', '' },
padding = 0,
condition = function() return false end
})
condition = function()
return false
end,
}
assert_component(nil, opts2, '')
end)
it('color', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
color = 'MyHl'
})
color = 'MyHl',
}
local comp = require('lualine.components.special.function_component'):new(opts)
local custom_link_hl_name = 'lualine_'..comp.options.component_name..'_no_mode'
eq('%#'..custom_link_hl_name..'#test', comp:draw(opts.hl))
local opts2 = build_component_opts(
{
component_separators = {'', ''},
local custom_link_hl_name = 'lualine_' .. comp.options.component_name .. '_no_mode'
eq('%#' .. custom_link_hl_name .. '#test', comp:draw(opts.hl))
local opts2 = build_component_opts {
component_separators = { '', '' },
padding = 0,
color = {bg = '#230055', fg = '#223344'}
})
color = { bg = '#230055', fg = '#223344' },
}
local hl = require 'lualine.highlight'
stub(hl, 'component_format_highlight')
hl.component_format_highlight.returns('%#MyCompHl#')
local comp2 =
require('lualine.components.special.function_component'):new(opts2)
hl.component_format_highlight.returns '%#MyCompHl#'
local comp2 = require('lualine.components.special.function_component'):new(opts2)
assert_component(nil, opts2, '%#MyCompHl#test')
assert.stub(hl.component_format_highlight).was_called_with(
comp2.options.color_highlight)
assert.stub(hl.component_format_highlight).was_called_with(comp2.options.color_highlight)
hl.component_format_highlight:revert()
end)
end)
@ -227,20 +226,20 @@ end)
describe('Encoding component', function()
it('works', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('encoding', opts, '%{strlen(&fenc)?&fenc:&enc}')
end)
end)
describe('Fileformat component', function()
it('works with icons', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
local fmt = vim.bo.fileformat
vim.bo.fileformat = 'unix'
assert_component('fileformat', opts, '')
@ -251,11 +250,11 @@ describe('Fileformat component', function()
vim.bo.fileformat = fmt
end)
it('works without icons', function()
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
icons_enabled = false
})
icons_enabled = false,
}
assert_component('fileformat', opts, vim.bo.fileformat)
end)
end)
@ -273,10 +272,10 @@ describe('Filetype component', function()
end)
it('does not add icon when library unavailable', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('filetype', opts, 'lua')
end)
@ -284,49 +283,47 @@ describe('Filetype component', function()
package.loaded['nvim-web-devicons'] = {
get_icon = function()
return '*', 'test_highlight_group'
end
end,
}
local hl = require 'lualine.highlight'
local utils = require 'lualine.utils.utils'
stub(hl, 'create_component_highlight_group')
stub(utils, 'extract_highlight_colors')
hl.create_component_highlight_group.returns('MyCompHl')
utils.extract_highlight_colors.returns('#000')
hl.create_component_highlight_group.returns 'MyCompHl'
utils.extract_highlight_colors.returns '#000'
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
colored=true,
colored = true,
disable_text = false,
})
}
assert_component('filetype', opts, '%#MyCompHl_normal#*%#lualine_c_normal# lua')
assert.stub(utils.extract_highlight_colors).was_called_with('test_highlight_group', 'fg')
assert.stub(hl.create_component_highlight_group).was_called_with(
{fg = '#000'}, 'test_highlight_group', opts
)
assert.stub(hl.create_component_highlight_group).was_called_with({ fg = '#000' }, 'test_highlight_group', opts)
hl.create_component_highlight_group:revert()
utils.extract_highlight_colors:revert()
package.loaded['nvim-web-devicons'] = nil
end)
it('Doesn\'t color when colored is false', function()
it("Doesn't color when colored is false", function()
package.loaded['nvim-web-devicons'] = {
get_icon = function()
return '*', 'test_highlight_group'
end
end,
}
local hl = require 'lualine.highlight'
local utils = require 'lualine.utils.utils'
stub(hl, 'create_component_highlight_group')
stub(utils, 'extract_highlight_colors')
hl.create_component_highlight_group.returns('MyCompHl')
utils.extract_highlight_colors.returns('#000')
local opts = build_component_opts({
component_separators = {'', ''},
hl.create_component_highlight_group.returns 'MyCompHl'
utils.extract_highlight_colors.returns '#000'
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
colored = false,
})
}
assert_component('filetype', opts, '* lua')
hl.create_component_highlight_group:revert()
utils.extract_highlight_colors:revert()
@ -337,15 +334,15 @@ describe('Filetype component', function()
package.loaded['nvim-web-devicons'] = {
get_icon = function()
return '*', 'test_highlight_group'
end
end,
}
local opts = build_component_opts({
component_separators = {'', ''},
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
colored = false,
disable_text = true,
})
}
assert_component('filetype', opts, '*')
package.loaded['nvim-web-devicons'] = nil
end)
@ -354,11 +351,11 @@ end)
describe('Hostname component', function()
it('works', function()
stub(vim.loop, 'os_gethostname')
vim.loop.os_gethostname.returns('localhost')
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
vim.loop.os_gethostname.returns 'localhost'
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('hostname', opts, 'localhost')
vim.loop.os_gethostname:revert()
end)
@ -366,20 +363,20 @@ end)
describe('Location component', function()
it('works', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('location', opts, '%3l:%-2c')
end)
end)
describe('Progress component', function()
it('works', function()
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('progress', opts, '%3P')
end)
end)
@ -387,11 +384,11 @@ end)
describe('Mode component', function()
it('works', function()
stub(vim.api, 'nvim_get_mode')
vim.api.nvim_get_mode.returns({mode = 'n', blocking = false})
local opts = build_component_opts({
component_separators = {'', ''},
padding = 0
})
vim.api.nvim_get_mode.returns { mode = 'n', blocking = false }
local opts = build_component_opts {
component_separators = { '', '' },
padding = 0,
}
assert_component('mode', opts, 'NORMAL')
vim.api.nvim_get_mode:revert()
end)

View File

@ -6,11 +6,11 @@ describe('config parsing', function()
describe('options', function()
describe('icons_enabled', function()
it('default', function()
local config = config_module.apply_configuration({})
local config = config_module.apply_configuration {}
eq(config.options.icons_enabled, true)
end)
it('custom', function()
local config = {options = {icons_enabled = false}}
local config = { options = { icons_enabled = false } }
config = config_module.apply_configuration(config)
eq(config.options.icons_enabled, false)
end)
@ -18,14 +18,14 @@ describe('config parsing', function()
describe('theme', function()
it('default', function()
local config = config_module.apply_configuration({})
local config = config_module.apply_configuration {}
eq(config.options.theme, 'auto')
end)
it('custom', function()
local config = {options = {theme = 'nord'}}
local config = { options = { theme = 'nord' } }
config = config_module.apply_configuration(config)
eq(config.options.theme, 'nord')
config = {options = {theme = {}}}
config = { options = { theme = {} } }
config = config_module.apply_configuration(config)
eq(config.options.theme, {})
end)
@ -33,43 +33,43 @@ describe('config parsing', function()
describe('separators', function()
it('default', function()
local config = config_module.apply_configuration({})
eq(config.options.component_separators, {'', ''})
eq(config.options.section_separators, {'', ''})
local config = config_module.apply_configuration {}
eq(config.options.component_separators, { '', '' })
eq(config.options.section_separators, { '', '' })
end)
it('double separators', function()
local config = {
options = {
component_separators = {'a', 'b'},
section_separators = {'c', 'd'}
}
component_separators = { 'a', 'b' },
section_separators = { 'c', 'd' },
},
}
config = config_module.apply_configuration(config)
eq(config.options.component_separators, {'a', 'b'})
eq(config.options.section_separators, {'c', 'd'})
eq(config.options.component_separators, { 'a', 'b' })
eq(config.options.section_separators, { 'c', 'd' })
end)
describe('single separator', function()
it('string', function()
local config = {
options = {component_separators = 'a', section_separators = 'b'}
options = { component_separators = 'a', section_separators = 'b' },
}
config = config_module.apply_configuration(config)
eq(config.options.component_separators, {'a', 'a'})
eq(config.options.section_separators, {'b', 'b'})
eq(config.options.component_separators, { 'a', 'a' })
eq(config.options.section_separators, { 'b', 'b' })
end)
it('table', function()
local config = {
options = {component_separators = {'a'}, section_separators = {'b'}}
options = { component_separators = { 'a' }, section_separators = { 'b' } },
}
config = config_module.apply_configuration(config)
eq(config.options.component_separators, {'a', 'a'})
eq(config.options.section_separators, {'b', 'b'})
eq(config.options.component_separators, { 'a', 'a' })
eq(config.options.section_separators, { 'b', 'b' })
end)
end)
it('no seprarators', function()
local config = {
options = {component_separators = {}, section_separators = {}}
options = { component_separators = {}, section_separators = {} },
}
config = config_module.apply_configuration(config)
eq(config.options.component_separators, {})
@ -79,24 +79,24 @@ describe('config parsing', function()
describe('disabled filetypes', function()
it('default', function()
local config = config_module.apply_configuration({})
local config = config_module.apply_configuration {}
eq(config.options.disabled_filetypes, {})
end)
it('custom', function()
local config = {options = {disabled_filetypes = {'lua'}}}
local config = { options = { disabled_filetypes = { 'lua' } } }
config = config_module.apply_configuration(config)
eq(config.options.disabled_filetypes, {'lua'})
eq(config.options.disabled_filetypes, { 'lua' })
end)
end)
describe('non default global option', function()
it('default', function()
local config = {options = {}}
local config = { options = {} }
config = config_module.apply_configuration(config)
eq(config.options.non_default_global_option, nil)
end)
it('custom', function()
local config = {options = {non_default_global_option = 1}}
local config = { options = { non_default_global_option = 1 } }
config = config_module.apply_configuration(config)
eq(config.options.non_default_global_option, 1)
end)
@ -108,32 +108,31 @@ describe('config parsing', function()
local config = {}
config = config_module.apply_configuration(config)
local lualine_default_sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff',
{'diagnostics', sources={'nvim_lsp', 'coc'}}},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', { 'diagnostics', sources = { 'nvim_lsp', 'coc' } } },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
eq(config.sections, lualine_default_sections)
end)
it('custom', function()
local custom_sections = {
lualine_a = {{'mode', lower = true}},
lualine_b = {'branch', {'branch', lower = true}},
lualine_a = { { 'mode', lower = true } },
lualine_b = { 'branch', { 'branch', lower = true } },
lualine_c = nil,
lualine_x = {}
lualine_x = {},
}
local expected_sections = {
lualine_a = {{'mode', lower = true}},
lualine_b = {'branch', {'branch', lower = true}},
lualine_c = {'filename'},
lualine_a = { { 'mode', lower = true } },
lualine_b = { 'branch', { 'branch', lower = true } },
lualine_c = { 'filename' },
lualine_x = {},
lualine_y = {'progress'},
lualine_z = {'location'}
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
local config = {sections = custom_sections}
local config = { sections = custom_sections }
config = config_module.apply_configuration(config)
eq(config.sections, expected_sections)
end)
@ -149,17 +148,17 @@ describe('config parsing', function()
end)
it('custom', function()
local custom_sections = {
lualine_a = {{'mode', lower = true}},
lualine_b = {'branch', {'branch', lower = true}},
lualine_a = { { 'mode', lower = true } },
lualine_b = { 'branch', { 'branch', lower = true } },
lualine_c = nil,
lualine_x = {}
lualine_x = {},
}
local expected_sections = {
lualine_a = {{'mode', lower = true}},
lualine_b = {'branch', {'branch', lower = true}},
lualine_x = {}
lualine_a = { { 'mode', lower = true } },
lualine_b = { 'branch', { 'branch', lower = true } },
lualine_x = {},
}
local config = {tabline = custom_sections}
local config = { tabline = custom_sections }
config = config_module.apply_configuration(config)
eq(config.tabline, expected_sections)
end)
@ -167,14 +166,14 @@ describe('config parsing', function()
describe('extensions', function()
it('default', function()
local config = {options = {}}
local config = { options = {} }
config = config_module.apply_configuration(config)
eq(config.extensions, {})
end)
it('custom', function()
local config = {extensions = {'fugitive'}}
local config = { extensions = { 'fugitive' } }
config = config_module.apply_configuration(config)
eq(config.extensions, {'fugitive'})
eq(config.extensions, { 'fugitive' })
end)
end)
end)

View File

@ -4,17 +4,16 @@ local eq = assert.are.same
local build_component_opts = helpers.build_component_opts
describe('Utils', function()
local utils = require('lualine.utils.utils')
local utils = require 'lualine.utils.utils'
it('can retrive highlight groups', function()
local hl2 = {fg = '#aabbcc', bg = '#889977', reverse = true}
local hl2 = { fg = '#aabbcc', bg = '#889977', reverse = true }
-- handles non existing hl groups
eq(utils.extract_highlight_colors('hl2'), nil)
eq(utils.extract_highlight_colors 'hl2', nil)
-- create highlight
vim.cmd(
string.format('hi hl2 guifg=%s guibg=%s gui=reverse', hl2.fg, hl2.bg))
vim.cmd(string.format('hi hl2 guifg=%s guibg=%s gui=reverse', hl2.fg, hl2.bg))
-- Can retrive entire highlight table
eq(utils.extract_highlight_colors('hl2'), hl2)
eq(utils.extract_highlight_colors 'hl2', hl2)
-- Can retrive specific parts of highlight
eq(utils.extract_highlight_colors('hl2', 'fg'), hl2.fg)
-- clear hl2
@ -23,9 +22,20 @@ describe('Utils', function()
it('can shrink list with holes', function()
local list_with_holes = {
'2', '4', '6', nil, '43', nil, '2', '', 'a', '', 'b', ' '
'2',
'4',
'6',
nil,
'43',
nil,
'2',
'',
'a',
'',
'b',
' ',
}
local list_without_holes = {'2', '4', '6', '43', '2', 'a', 'b', ' '}
local list_without_holes = { '2', '4', '6', '43', '2', 'a', 'b', ' ' }
eq(utils.list_shrink(list_with_holes), list_without_holes)
end)
end)
@ -34,7 +44,7 @@ describe('Cterm genarator', function()
local cterm = require 'lualine.utils.color_utils'
it('can convert rgb to cterm', function()
local colors = {['#112233'] = 235, ['#7928ae'] = 97, ['#017bdc'] = 68}
local colors = { ['#112233'] = 235, ['#7928ae'] = 97, ['#017bdc'] = 68 }
for rgb, ct in pairs(colors) do
eq(cterm.rgb2cterm(rgb), tostring(ct))
end
@ -44,57 +54,52 @@ end)
describe('Section genarator', function()
local sec = require 'lualine.utils.section'
it('can draw', function()
local opts = build_component_opts({section_separators = {'', ''}})
local opts = build_component_opts { section_separators = { '', '' } }
local section = {
require('lualine.components.special.function_component'):new(opts),
require('lualine.components.special.function_component'):new(opts)
require('lualine.components.special.function_component'):new(opts),
}
eq( '%#lualine_MySection_normal# test %#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection'))
eq('%#lualine_MySection_normal# test %#lualine_MySection_normal# test ', sec.draw_section(section, 'MySection'))
end)
it('can remove separators from component with custom colors', function()
local opts = build_component_opts({section_separators = {'', ''}})
local opts_colored = build_component_opts({color = 'MyColor'})
local opts_colored2 = build_component_opts(
{
color = {bg = '#223344'},
section_separators = {'', ''}
})
local opts_colored3 = build_component_opts(
{
color = {fg = '#223344'},
section_separators = {'', ''}
})
require'lualine.highlight'.create_highlight_groups(
require 'lualine.themes.gruvbox')
local opts = build_component_opts { section_separators = { '', '' } }
local opts_colored = build_component_opts { color = 'MyColor' }
local opts_colored2 = build_component_opts {
color = { bg = '#223344' },
section_separators = { '', '' },
}
local opts_colored3 = build_component_opts {
color = { fg = '#223344' },
section_separators = { '', '' },
}
require('lualine.highlight').create_highlight_groups(require 'lualine.themes.gruvbox')
local section = {
require('lualine.components.special.function_component'):new(opts),
require('lualine.components.special.function_component'):new(opts_colored),
require('lualine.components.special.function_component'):new(opts)
require('lualine.components.special.function_component'):new(opts),
}
local highlight_name2 = 'lualine_'..section[2].options.component_name..'_no_mode'
local highlight_name2 = 'lualine_' .. section[2].options.component_name .. '_no_mode'
-- Removes separator on string color
eq( '%#lualine_MySection_normal# test %#' ..highlight_name2..'#'
.. ' test %#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection'))
section[2] =
require('lua.lualine.components.special.function_component'):new(
opts_colored2)
local highlight_name =
'%#lualine_c_' .. section[2].options.component_name .. '_normal#'
eq(
'%#lualine_MySection_normal# test %#' .. highlight_name2 .. '#' .. ' test %#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection')
)
section[2] = require('lua.lualine.components.special.function_component'):new(opts_colored2)
local highlight_name = '%#lualine_c_' .. section[2].options.component_name .. '_normal#'
-- Removes separator on color with bg
eq('%#lualine_MySection_normal# test ' .. highlight_name ..
' test %#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection'))
section[2] =
require('lua.lualine.components.special.function_component'):new(
opts_colored3)
highlight_name2 =
'%#lualine_c_' .. section[2].options.component_name .. '_normal#'
eq(
'%#lualine_MySection_normal# test ' .. highlight_name .. ' test %#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection')
)
section[2] = require('lua.lualine.components.special.function_component'):new(opts_colored3)
highlight_name2 = '%#lualine_c_' .. section[2].options.component_name .. '_normal#'
-- Doesn't remove separator on color without bg
eq('%#lualine_MySection_normal# test ' .. highlight_name2 ..
' test %#lualine_MySection_normal#%#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection'))
eq(
'%#lualine_MySection_normal# test '
.. highlight_name2
.. ' test %#lualine_MySection_normal#%#lualine_MySection_normal# test ',
sec.draw_section(section, 'MySection')
)
end)
end)