From b31b66fa79344d8db2ceca12102d971b5056401d Mon Sep 17 00:00:00 2001 From: hoob3rt Date: Tue, 16 Mar 2021 00:37:46 +0100 Subject: [PATCH] refactor: applied lua-format to all files --- lua/lualine/async.lua | 48 +++------ lua/lualine/components/branch.lua | 31 +++--- lua/lualine/components/diagnostics.lua | 65 ++++++----- lua/lualine/components/diff.lua | 81 +++++++------- lua/lualine/components/encoding.lua | 1 - lua/lualine/components/fileformat.lua | 19 ++-- lua/lualine/components/filename.lua | 10 +- lua/lualine/components/filetype.lua | 11 +- lua/lualine/components/location.lua | 1 - lua/lualine/components/mode.lua | 3 +- lua/lualine/components/progress.lua | 1 - lua/lualine/extensions/fugitive.lua | 8 +- lua/lualine/extensions/fzf.lua | 11 +- lua/lualine/extensions/nerdtree.lua | 7 +- lua/lualine/highlight.lua | 72 +++++++------ lua/lualine/init.lua | 137 +++++++++++++----------- lua/lualine/themes/16color.lua | 28 ++--- lua/lualine/themes/auto.lua | 86 +++++++-------- lua/lualine/themes/ayu_dark.lua | 45 ++++---- lua/lualine/themes/ayu_light.lua | 45 ++++---- lua/lualine/themes/ayu_mirage.lua | 45 ++++---- lua/lualine/themes/codedark.lua | 45 ++++---- lua/lualine/themes/dracula.lua | 59 +++++----- lua/lualine/themes/forest_night.lua | 66 ++++++------ lua/lualine/themes/gruvbox.lua | 43 ++++---- lua/lualine/themes/gruvbox_material.lua | 53 ++++----- lua/lualine/themes/iceberg_dark.lua | 49 ++++----- lua/lualine/themes/iceberg_light.lua | 45 ++++---- lua/lualine/themes/jellybeans.lua | 47 ++++---- lua/lualine/themes/material.lua | 28 ++--- lua/lualine/themes/molokai.lua | 28 ++--- lua/lualine/themes/nightfly.lua | 43 ++++---- lua/lualine/themes/nord.lua | 42 ++++---- lua/lualine/themes/oceanicnext.lua | 51 ++++----- lua/lualine/themes/onedark.lua | 28 ++--- lua/lualine/themes/onelight.lua | 28 ++--- lua/lualine/themes/palenight.lua | 64 +++++------ lua/lualine/themes/papercolor.lua | 3 +- lua/lualine/themes/papercolor_dark.lua | 28 ++--- lua/lualine/themes/papercolor_light.lua | 28 ++--- lua/lualine/themes/powerline.lua | 29 +++-- lua/lualine/themes/seoul256.lua | 47 ++++---- lua/lualine/themes/solarized.lua | 3 +- lua/lualine/themes/solarized_dark.lua | 28 ++--- lua/lualine/themes/solarized_light.lua | 28 ++--- lua/lualine/themes/tomorrow.lua | 51 ++++----- lua/lualine/themes/wombat.lua | 28 ++--- lua/lualine/utils/component.lua | 53 ++++----- lua/lualine/utils/cterm_colors.lua | 18 ++-- lua/lualine/utils/utils.lua | 5 +- 50 files changed, 887 insertions(+), 936 deletions(-) diff --git a/lua/lualine/async.lua b/lua/lualine/async.lua index dc18002..9c89db8 100644 --- a/lua/lualine/async.lua +++ b/lua/lualine/async.lua @@ -2,18 +2,14 @@ local M = {} function M:new(args) args = args or {} - for index, arg in pairs(args) do - self[index] = arg - end + for index, arg in pairs(args) do self[index] = arg end setmetatable(args, self) self.__index = self return args end local function close_pipe(pipe) - if pipe ~= nil and not pipe:is_closing() then - pipe:close() - end + if pipe ~= nil and not pipe:is_closing() then pipe:close() end end function M.close_all() @@ -25,50 +21,30 @@ end function M.init_options() local options = {} - local args = vim.fn.split(M.cmd, ' ') + local args = vim.fn.split(M.cmd, ' ') M.stdin = vim.loop.new_pipe(false) M.stdout = vim.loop.new_pipe(false) M.stderr = vim.loop.new_pipe(false) options.command = table.remove(args, 1) options.args = args - options.stdio = { - M.stdin, - M.stdout, - M.stderr - } - if M.cwd then - options.cwd = M.cwd - end - if M.env then - options.env = M.env - end - if M.detach then - options.detach = M.detach - end + options.stdio = {M.stdin, M.stdout, M.stderr} + if M.cwd then options.cwd = M.cwd end + if M.env then options.env = M.env end + if M.detach then options.detach = M.detach end return options end function M.start() local options = M.init_options() M.handle = vim.loop.spawn(options.command, options, vim.schedule_wrap(M.stop)) - if M.on_stdout then - M.stdout:read_start(vim.schedule_wrap(M.on_stdout)) - end - if M.on_stderr then - M.stderr:read_start(vim.schedule_wrap(M.on_stderr)) - end + if M.on_stdout then M.stdout:read_start(vim.schedule_wrap(M.on_stdout)) end + if M.on_stderr then M.stderr:read_start(vim.schedule_wrap(M.on_stderr)) end end function M.stop(code, signal) - if M.on_exit then - M.on_exit(code, signal) - end - if M.on_stdout and M.stdout then - M.stdout:read_stop() - end - if M.on_stderr and M.stderr then - M.stderr:read_stop() - end + if M.on_exit then M.on_exit(code, signal) end + if M.on_stdout and M.stdout then M.stdout:read_stop() end + if M.on_stderr and M.stderr then M.stderr:read_stop() end M.close_all() end diff --git a/lua/lualine/components/branch.lua b/lua/lualine/components/branch.lua index 65377d0..23fcc82 100644 --- a/lua/lualine/components/branch.lua +++ b/lua/lualine/components/branch.lua @@ -1,10 +1,9 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local git_branch -- os specific path separator -local sep = package.config:sub(1,1) +local sep = package.config:sub(1, 1) -- returns full path to git directory for current directory local function find_git_dir() @@ -21,11 +20,11 @@ local function find_git_dir() -- separate git-dir or submodule is used local file = io.open(git_file) 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:sub(1,1) ~= sep and not git_dir:match('^%a:.*$') then - git_dir = git_file:match('(.*).git')..git_dir + if git_dir:sub(1, 1) ~= sep and not git_dir:match('^%a:.*$') then + git_dir = git_file:match('(.*).git') .. git_dir end end return git_dir @@ -38,8 +37,11 @@ local function get_git_head(head_file) local HEAD = f_head:read() f_head:close() local branch = HEAD:match('ref: refs/heads/(.+)$') - if branch then git_branch = branch - else git_branch = HEAD:sub(1,6) end + if branch then + git_branch = branch + else + git_branch = HEAD:sub(1, 6) + end end return nil end @@ -50,12 +52,13 @@ local function watch_head() file_changed:stop() local git_dir = find_git_dir() if #git_dir > 0 then - local head_file = git_dir..sep..'HEAD' + local head_file = git_dir .. sep .. 'HEAD' get_git_head(head_file) - file_changed:start(head_file, {}, vim.schedule_wrap(function() - -- reset file-watch - watch_head() - end)) + file_changed:start(head_file, {}, vim.schedule_wrap( + function() + -- reset file-watch + watch_head() + end)) else -- set to nil when git dir was not found git_branch = nil @@ -77,9 +80,9 @@ end watch_head() -- update branch state of BufEnter as different Buffer may be on different repos -vim.cmd[[autocmd BufEnter * lua require'lualine.components.branch'.lualine_branch_update()]] +vim.cmd [[autocmd BufEnter * lua require'lualine.components.branch'.lualine_branch_update()]] return { init = function(options) return branch(options) end, lualine_branch_update = watch_head - } +} diff --git a/lua/lualine/components/diagnostics.lua b/lua/lualine/components/diagnostics.lua index 4ba188f..5159d04 100644 --- a/lua/lualine/components/diagnostics.lua +++ b/lua/lualine/components/diagnostics.lua @@ -3,16 +3,18 @@ local highlight = require('lualine.highlight') local utils = require('lualine.utils.utils') +-- LuaFormatter off local default_color_error = '#e32636' local default_color_warn = '#ffdf00' local default_color_info = '#ffffff' +-- LuaFormatter on local diagnostic_sources = { nvim_lsp = function() local error_count = vim.lsp.diagnostic.get_count(0, 'Error') local warning_count = vim.lsp.diagnostic.get_count(0, 'Warning') local info_count = vim.lsp.diagnostic.get_count(0, 'Information') + - vim.lsp.diagnostic.get_count(0, 'Hint') + vim.lsp.diagnostic.get_count(0, 'Hint') return error_count, warning_count, info_count end, coc = function() @@ -30,14 +32,18 @@ local diagnostic_sources = { else return 0, 0, 0 end - end, + end } local function get_diagnostics(sources) local result = {} for index, source in ipairs(sources) do local error_count, warning_count, info_count = diagnostic_sources[source]() - result[index] = {error = error_count, warn = warning_count, info = info_count} + result[index] = { + error = error_count, + warn = warning_count, + info = info_count + } end return result end @@ -45,14 +51,11 @@ end local function diagnostics(options) local default_symbols = options.icons_enabled and { error = ' ', -- xf659 - warn = ' ', -- xf529 - info = ' ', -- xf7fc - } or { - error = 'E:', - warn = 'W:', - info = 'I:' - } - options.symbols = vim.tbl_extend('force', default_symbols, options.symbols or {}) + warn = ' ', -- xf529 + info = ' ' -- xf7fc + } or {error = 'E:', warn = 'W:', info = 'I:'} + options.symbols = vim.tbl_extend('force', default_symbols, + options.symbols or {}) if options.sources == nil then print('no sources for diagnostics configured') return '' @@ -61,21 +64,30 @@ local function diagnostics(options) if options.colored == nil then options.colored = true end -- apply colors if not options.color_error then - options.color_error = utils.extract_highlight_colors('DiffDelete', 'foreground') or default_color_error + options.color_error = utils.extract_highlight_colors('DiffDelete', + 'foreground') or + default_color_error end if not options.color_warn then - options.color_warn = utils.extract_highlight_colors('DiffText', 'foreground') or default_color_warn + options.color_warn = + utils.extract_highlight_colors('DiffText', 'foreground') or + default_color_warn end if not options.color_info then - options.color_info = utils.extract_highlight_colors('Normal', 'foreground') or default_color_info + options.color_info = + utils.extract_highlight_colors('Normal', 'foreground') or + default_color_info end local highlight_groups = {} local function add_highlights() highlight_groups = { - error = highlight.create_component_highlight_group({ fg = options.color_error }, 'diagnostics_error', options), - warn = highlight.create_component_highlight_group({ fg = options.color_warn }, 'diagnostics_warn', options), - info = highlight.create_component_highlight_group({ fg = options.color_info }, 'diagnostics_info', options), + error = highlight.create_component_highlight_group( + {fg = options.color_error}, 'diagnostics_error', options), + warn = highlight.create_component_highlight_group( + {fg = options.color_warn}, 'diagnostics_warn', options), + info = highlight.create_component_highlight_group( + {fg = options.color_info}, 'diagnostics_info', options) } end @@ -85,19 +97,15 @@ local function diagnostics(options) end return function() - local error_count, warning_count, info_count = 0,0,0 + local error_count, warning_count, info_count = 0, 0, 0 local diagnostic_data = get_diagnostics(options.sources) for _, data in pairs(diagnostic_data) do - error_count = error_count + data.error + error_count = error_count + data.error warning_count = warning_count + data.warn - info_count = info_count + data.info + info_count = info_count + data.info end local result = {} - local data = { - error = error_count, - warn = warning_count, - info = info_count, - } + local data = {error = error_count, warn = warning_count, info = info_count} if options.colored then local colors = {} for name, hl in pairs(highlight_groups) do @@ -105,13 +113,14 @@ local function diagnostics(options) end for _, section in ipairs(options.sections) do if data[section] ~= nil and data[section] > 0 then - table.insert(result, colors[section]..options.symbols[section]..data[section]) + table.insert(result, colors[section] .. options.symbols[section] .. + data[section]) end end else for _, section in ipairs(options.sections) do if data[section] ~= nil and data[section] > 0 then - table.insert(result,options.symbols[section]..data[section]) + table.insert(result, options.symbols[section] .. data[section]) end end end @@ -125,5 +134,5 @@ end return { init = function(options) return diagnostics(options) end, - get_diagnostics = get_diagnostics, + get_diagnostics = get_diagnostics } diff --git a/lua/lualine/components/diff.lua b/lua/lualine/components/diff.lua index 71bd230..76dc7df 100644 --- a/lua/lualine/components/diff.lua +++ b/lua/lualine/components/diff.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - -local async = require'lualine.async' -local utils = require'lualine.utils.utils' -local highlight = require"lualine.highlight" +local async = require 'lualine.async' +local utils = require 'lualine.utils.utils' +local highlight = require 'lualine.highlight' -- variable to store git diff stats local git_diff = nil @@ -16,7 +15,8 @@ local function process_diff(data) local added, removed, modified = 0, 0, 0 for line in vim.gsplit(data, '\n') 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]) @@ -29,12 +29,12 @@ local function process_diff(data) else local min = math.min(line_stats.mod_count, line_stats.new_count) modified = modified + min - added = added + line_stats.new_count - min + added = added + line_stats.new_count - min removed = removed + line_stats.mod_count - min end end end - git_diff = { added = added, modified = modified, removed = removed } + git_diff = {added = added, modified = modified, removed = removed} end -- variable to store git_diff getter async function @@ -45,26 +45,29 @@ local function update_git_diff_getter() -- stop older function properly before overwritting it if get_git_diff then get_git_diff:stop() end -- Donn't show git diff when current buffer doesn't have a filename - if #vim.fn.expand('%') == 0 then get_git_diff = nil; git_diff=nil; return end + if #vim.fn.expand('%') == 0 then + get_git_diff = nil; + git_diff = nil; + return + end get_git_diff = async:new({ - cmd = string.format([[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]] - ,vim.fn.expand('%:h'), vim.fn.expand('%:t')), + cmd = string.format( + [[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]], + vim.fn.expand('%:h'), vim.fn.expand('%:t')), on_stdout = function(_, data) - if data then - diff_data = diff_data .. data - end + if data then diff_data = diff_data .. data end end, - on_stderr = function (_, data) + on_stderr = function(_, data) if data then git_diff = nil diff_data = '' end end, on_exit = function() - if diff_data ~= '' then + if diff_data ~= '' then process_diff(diff_data) else - git_diff = { added = 0, modified = 0, removed = 0} + git_diff = {added = 0, modified = 0, removed = 0} end end }) @@ -80,21 +83,26 @@ local function update_git_diff() end)() end -local default_color_added = "#f0e130" -local default_color_removed = "#90ee90" -local default_color_modified = "#ff0038" +local default_color_added = '#f0e130' +local default_color_removed = '#90ee90' +local default_color_modified = '#ff0038' local function diff(options) if options.colored == nil then options.colored = true end -- apply colors if not options.color_added then - options.color_added = utils.extract_highlight_colors('DiffAdd', 'guifg') or default_color_added + options.color_added = utils.extract_highlight_colors('DiffAdd', 'guifg') or + default_color_added end if not options.color_modified then - options.color_modified = utils.extract_highlight_colors('DiffChange', 'guifg') or default_color_modified + options.color_modified = utils.extract_highlight_colors('DiffChange', + 'guifg') or + default_color_modified end if not options.color_removed then - options.color_removed = utils.extract_highlight_colors('DiffDelete', 'guifg') or default_color_removed + options.color_removed = + utils.extract_highlight_colors('DiffDelete', 'guifg') or + default_color_removed end local highlights = {} @@ -102,9 +110,12 @@ local function diff(options) -- create highlights and save highlight_name in highlights table local function create_highlights() highlights = { - added = highlight.create_component_highlight_group({fg = options.color_added}, 'diff_added', options), - modified = highlight.create_component_highlight_group({fg = options.color_modified}, 'diff_modified', options), - removed = highlight.create_component_highlight_group({fg = options.color_removed}, 'diff_removed', options), + added = highlight.create_component_highlight_group( + {fg = options.color_added}, 'diff_added', options), + modified = highlight.create_component_highlight_group( + {fg = options.color_modified}, 'diff_modified', options), + removed = highlight.create_component_highlight_group( + {fg = options.color_removed}, 'diff_removed', options) } end @@ -124,12 +135,9 @@ local function diff(options) return function() if git_diff == nil then return '' end - local default_symbols = { - added = '+', - modified = '~', - removed = '-', - } - options.symbols = vim.tbl_extend('force', default_symbols, options.symbols or {}) + local default_symbols = {added = '+', modified = '~', removed = '-'} + options.symbols = vim.tbl_extend('force', default_symbols, + options.symbols or {}) local colors = {} if options.colored then -- load the highlights and store them in colors table @@ -140,12 +148,13 @@ local function diff(options) 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 options.colored then - table.insert(result,colors[name]..options.symbols[name]..git_diff[name]) + table.insert(result, + colors[name] .. options.symbols[name] .. git_diff[name]) else - table.insert(result,options.symbols[name]..git_diff[name]) + table.insert(result, options.symbols[name] .. git_diff[name]) end end end @@ -168,12 +177,12 @@ end local function get_sign_count() update_git_diff_getter() update_git_diff() - return git_diff or { added = -1, modified = -1, removed = -1 } + return git_diff or {added = -1, modified = -1, removed = -1} end return { init = function(options) return diff(options) end, update_git_diff = update_git_diff, update_git_diff_getter = update_git_diff_getter, - get_sign_count = get_sign_count, + get_sign_count = get_sign_count } diff --git a/lua/lualine/components/encoding.lua b/lua/lualine/components/encoding.lua index 45745ca..9c4f45f 100644 --- a/lua/lualine/components/encoding.lua +++ b/lua/lualine/components/encoding.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local function encoding() local data = [[%{strlen(&fenc)?&fenc:&enc}]] return data diff --git a/lua/lualine/components/fileformat.lua b/lua/lualine/components/fileformat.lua index 095eb6d..98d7e41 100644 --- a/lua/lualine/components/fileformat.lua +++ b/lua/lualine/components/fileformat.lua @@ -1,19 +1,22 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local function fileformat(options) - local icon_linux = "" -- e712 - local icon_windos = "" -- e70f - local icon_mac = "" -- e711 + local icon_linux = '' -- e712 + local icon_windos = '' -- e70f + local icon_mac = '' -- e711 return function() if options.icons_enabled and not options.icon then local format = vim.bo.fileformat - if format == 'unix' then return icon_linux - elseif format == 'dos' then return icon_windos - elseif format == 'mac' then return icon_mac end + if format == 'unix' then + return icon_linux + elseif format == 'dos' then + return icon_windos + elseif format == 'mac' then + return icon_mac + end end return vim.bo.fileformat end end -return { init = function(options) return fileformat(options) end } +return {init = function(options) return fileformat(options) end} diff --git a/lua/lualine/components/filename.lua b/lua/lualine/components/filename.lua index d4e8ac2..6cf068a 100644 --- a/lua/lualine/components/filename.lua +++ b/lua/lualine/components/filename.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local function filename(options) -- setting defaults if options.file_status == nil then options.file_status = true end @@ -23,11 +22,14 @@ local function filename(options) end if options.file_status then - if vim.bo.modified then data = data .. "[+]" - elseif vim.bo.modifiable == false then data = data .. "[-]" end + if vim.bo.modified then + data = data .. '[+]' + elseif vim.bo.modifiable == false then + data = data .. '[-]' + end end return data end end -return { init = function(options) return filename(options) end } +return {init = function(options) return filename(options) end} diff --git a/lua/lualine/components/filetype.lua b/lua/lualine/components/filetype.lua index c8b17b3..a4d6455 100644 --- a/lua/lualine/components/filetype.lua +++ b/lua/lualine/components/filetype.lua @@ -1,16 +1,15 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local function filetype(options) return function() local data = vim.bo.filetype if #data > 0 then - local ok, devicons = pcall(require,'nvim-web-devicons') + local ok, devicons = pcall(require, 'nvim-web-devicons') if ok then - local f_name,f_extension = vim.fn.expand('%:t'),vim.fn.expand('%:e') - options.icon = devicons.get_icon(f_name,f_extension) + local f_name, f_extension = vim.fn.expand('%:t'), vim.fn.expand('%:e') + options.icon = devicons.get_icon(f_name, f_extension) else - ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol") + ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol') if ok ~= 0 then options.icon = vim.fn.WebDevIconsGetFileTypeSymbol() end @@ -21,4 +20,4 @@ local function filetype(options) end end -return { init = function(options) return filetype(options) end } +return {init = function(options) return filetype(options) end} diff --git a/lua/lualine/components/location.lua b/lua/lualine/components/location.lua index 9b65af1..12d8978 100644 --- a/lua/lualine/components/location.lua +++ b/lua/lualine/components/location.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local function location() local data = [[%3l:%-2c]] return data diff --git a/lua/lualine/components/mode.lua b/lua/lualine/components/mode.lua index 57daf6a..9baf8ad 100644 --- a/lua/lualine/components/mode.lua +++ b/lua/lualine/components/mode.lua @@ -1,6 +1,6 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - +-- LuaFormatter off local mode_map = { ['n'] = 'NORMAL', ['no'] = 'O-PENDING', @@ -32,6 +32,7 @@ local mode_map = { ['!'] = 'SHELL', ['t'] = 'TERMINAL', } +-- LuaFormatter on local function mode() local mode_code = vim.api.nvim_get_mode().mode if mode_map[mode_code] == nil then return mode_code end diff --git a/lua/lualine/components/progress.lua b/lua/lualine/components/progress.lua index c10d781..c504d7e 100644 --- a/lua/lualine/components/progress.lua +++ b/lua/lualine/components/progress.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local function progress() local data = [[%3P]] return data diff --git a/lua/lualine/extensions/fugitive.lua b/lua/lualine/extensions/fugitive.lua index 32a28ea..c2685f3 100644 --- a/lua/lualine/extensions/fugitive.lua +++ b/lua/lualine/extensions/fugitive.lua @@ -1,15 +1,11 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local M = {} -M.sections = { - lualine_a = { 'FugitiveHead' }, - lualine_z = { 'location' }, -} +M.sections = {lualine_a = {'FugitiveHead'}, lualine_z = {'location'}} M.inactive_sections = M.sections -M.filetypes = { 'fugitive' } +M.filetypes = {'fugitive'} return M diff --git a/lua/lualine/extensions/fzf.lua b/lua/lualine/extensions/fzf.lua index 19a176f..107b702 100644 --- a/lua/lualine/extensions/fzf.lua +++ b/lua/lualine/extensions/fzf.lua @@ -1,18 +1,13 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - -local function fzf_statusline() - return 'FZF' -end +local function fzf_statusline() return 'FZF' end local M = {} -M.sections = { - lualine_a = { fzf_statusline }, -} +M.sections = {lualine_a = {fzf_statusline}} M.inactive_sections = M.sections -M.filetypes = { 'fzf' } +M.filetypes = {'fzf'} return M diff --git a/lua/lualine/extensions/nerdtree.lua b/lua/lualine/extensions/nerdtree.lua index 2fd9f68..7a6516c 100644 --- a/lua/lualine/extensions/nerdtree.lua +++ b/lua/lualine/extensions/nerdtree.lua @@ -1,14 +1,11 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local M = {} -M.sections = { - lualine_a = { vim.fn.getcwd }, -} +M.sections = {lualine_a = {vim.fn.getcwd}} M.inactive_sections = M.sections -M.filetypes = { 'nerdtree' } +M.filetypes = {'nerdtree'} return M diff --git a/lua/lualine/highlight.lua b/lua/lualine/highlight.lua index e7cfb6c..158fa6d 100644 --- a/lua/lualine/highlight.lua +++ b/lua/lualine/highlight.lua @@ -1,13 +1,12 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - -local M = { } -local utils_colors = require "lualine.utils.cterm_colors" +local M = {} +local utils_colors = require 'lualine.utils.cterm_colors' local utils = require 'lualine.utils.utils' local section_highlight_map = {x = 'c', y = 'b', z = 'a'} -local function highlight (name, foreground, background, gui) - local command = { 'highlight', name, } +local function highlight(name, foreground, background, gui) + local command = {'highlight', name} if foreground and foreground ~= 'none' then table.insert(command, 'ctermfg=' .. utils_colors.get_cterm_color(foreground)) table.insert(command, 'guifg=' .. foreground) @@ -17,8 +16,8 @@ local function highlight (name, foreground, background, gui) table.insert(command, 'guibg=' .. background) end if gui then - table.insert(command, 'cterm=' .. gui ) - table.insert(command, 'gui=' .. gui ) + table.insert(command, 'cterm=' .. gui) + table.insert(command, 'gui=' .. gui) end vim.cmd(table.concat(command, ' ')) utils.save_highlight(name) @@ -27,8 +26,9 @@ end function M.create_highlight_groups(theme) for mode, sections in pairs(theme) do for section, colorscheme in pairs(sections) do - local highlight_group_name = { 'lualine', section, mode } - highlight(table.concat(highlight_group_name, '_'), colorscheme.fg, colorscheme.bg, colorscheme.gui) + local highlight_group_name = {'lualine', section, mode} + highlight(table.concat(highlight_group_name, '_'), colorscheme.fg, + colorscheme.bg, colorscheme.gui) end end end @@ -38,14 +38,15 @@ end -- @return: (string) highlight group name with mode local function append_mode(highlight_group) local mode = require('lualine.components.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' @@ -65,26 +66,28 @@ end -- @@options is parameter of component.init() function -- @return: (string) unique name that can be used by component_format_highlight -- to retrive highlight group -function M.create_component_highlight_group(color , highlight_tag, options) +function M.create_component_highlight_group(color, highlight_tag, options) 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'}, '_') highlight(highlight_group_name, color.fg, color.bg, color.gui) return highlight_group_name end - local modes = {'normal', 'insert', 'visual', 'replace', 'command', 'terminal', 'inactive'} + local modes = { + 'normal', 'insert', 'visual', 'replace', 'command', 'terminal', 'inactive' + } local normal_hl -- convert lualine_a -> a before setting section local section = options.self.section:match('lualine_(.*)') - if section > 'c' then - section = section_highlight_map[section] - end + if section > 'c' then section = section_highlight_map[section] end for _, mode in ipairs(modes) do - local highlight_group_name = { options.self.section, highlight_tag, mode } + local highlight_group_name = {options.self.section, highlight_tag, mode} local default_color_table = options.theme[mode] and - options.theme[mode][section] or options.theme.normal[section] + options.theme[mode][section] or + options.theme.normal[section] local bg = (color.bg or default_color_table.bg) local fg = (color.fg or default_color_table.fg) -- Check if it's same as normal mode if it is no need to create aditional highlight @@ -97,7 +100,7 @@ function M.create_component_highlight_group(color , highlight_tag, options) highlight(table.concat(highlight_group_name, '_'), fg, bg, color.gui) end end - return options.self.section..'_'..highlight_tag + return options.self.section .. '_' .. highlight_tag end -- @description: retrieve highlight_groups for components @@ -108,34 +111,36 @@ end function M.component_format_highlight(highlight_name) local highlight_group = highlight_name if highlight_name:find('no_mode') == #highlight_name - #'no_mode' + 1 then - return '%#'..highlight_group..'#' + return '%#' .. highlight_group .. '#' end if vim.g.statusline_winid == vim.fn.win_getid() then highlight_group = append_mode(highlight_group) else - highlight_group = highlight_group..'_inactive' + highlight_group = highlight_group .. '_inactive' end - if utils.highlight_exists(highlight_group)then - return '%#'..highlight_group..'#' + if utils.highlight_exists(highlight_group) then + return '%#' .. highlight_group .. '#' else - return '%#'..highlight_name..'_normal#' + return '%#' .. highlight_name .. '_normal#' end end function M.format_highlight(is_focused, highlight_group) if highlight_group > 'lualine_c' then - highlight_group = 'lualine_' .. section_highlight_map[highlight_group:match('lualine_(.)')] + highlight_group = 'lualine_' .. + section_highlight_map[highlight_group:match( + 'lualine_(.)')] end local highlight_name = highlight_group if not is_focused then - highlight_name = highlight_group .. [[_inactive]] + highlight_name = highlight_group .. [[_inactive]] else highlight_name = append_mode(highlight_group) end if utils.highlight_exists(highlight_name) then return '%#' .. highlight_name .. '#' end - return '%#' .. highlight_group ..'_normal#' + return '%#' .. highlight_group .. '_normal#' end -- @description : Provides transitional highlights for section separators. @@ -144,7 +149,8 @@ end -- @param reverse :(string) Whether it's a left separator or right separator -- '▶️' and '◀️' needs reverse colors so this parameter needs to be set true. -- @return: (string) formated highlight group name -function M.get_transitional_highlights(left_section_data, right_section_data, reverse ) +function M.get_transitional_highlights(left_section_data, right_section_data, + reverse) local left_highlight_name, right_highlight_name -- Grab the last highlighter of left section if left_section_data then @@ -160,7 +166,8 @@ function M.get_transitional_highlights(left_section_data, right_section_data, re if right_section_data then -- using vim-regex cause lua-paterns don't have non-greedy matching -- extract highlight_name from %#highlight_name#.... - right_highlight_name = vim.fn.matchlist(right_section_data, [[%#\(.\{-\}\)#]])[2] + right_highlight_name = vim.fn.matchlist(right_section_data, + [[%#\(.\{-\}\)#]])[2] else -- When right section us unavailable default to lualine_c right_highlight_name = append_mode('lualine_c') @@ -176,7 +183,8 @@ function M.get_transitional_highlights(left_section_data, right_section_data, re if left_highlight_name:find('lualine_') == 1 then highlight_name = left_highlight_name .. '_to_' .. right_highlight_name else - highlight_name = 'lualine_' .. left_highlight_name .. '_to_' .. right_highlight_name + highlight_name = 'lualine_' .. left_highlight_name .. '_to_' .. + right_highlight_name end if not utils.highlight_exists(highlight_name) then diff --git a/lua/lualine/init.lua b/lua/lualine/init.lua index 32597b3..d94fccd 100644 --- a/lua/lualine/init.lua +++ b/lua/lualine/init.lua @@ -1,35 +1,34 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local utils_component = require('lualine.utils.component') local utils = require('lualine.utils.utils') local highlight = require('lualine.highlight') -local M = { } +local M = {} M.options = { icons_enabled = true, theme = 'gruvbox', component_separators = {'', ''}, - section_separators = {'', ''}, + section_separators = {'', ''} } M.sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch' }, - lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, + lualine_a = {'mode'}, + lualine_b = {'branch'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} } M.inactive_sections = { - lualine_a = { }, - lualine_b = { }, - lualine_c = { 'filename' }, - lualine_x = { 'location' }, - lualine_y = { }, - lualine_z = { } + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} } M.tabline = {} @@ -41,15 +40,14 @@ local function apply_configuration(config_table) local function parse_sections(section_group_name) if not config_table[section_group_name] then return end for section_name, section in pairs(config_table[section_group_name]) do - M[section_group_name][section_name] = config_table[section_group_name][section_name] + M[section_group_name][section_name] = + config_table[section_group_name][section_name] if type(section) == 'table' then for _, component in pairs(section) do if type(component) == 'table' and type(component[2]) == 'table' then local options = component[2] component[2] = nil - for key, val in pairs(options) do - component[key] = val - end + for key, val in pairs(options) do component[key] = val end end end end @@ -65,18 +63,24 @@ end local function check_single_separator() local compoennt_separator = M.options.component_separators local section_separator = M.options.section_separators - if M.options.component_separators ~=nil then + if M.options.component_separators ~= nil then if type(M.options.component_separators) == 'string' then - M.options.component_separators = {compoennt_separator, compoennt_separator} + M.options.component_separators = { + compoennt_separator, compoennt_separator + } elseif #M.options.component_separators == 1 then - M.options.component_separators = {M.options.component_separators[1], M.options.component_separators[1]} + M.options.component_separators = { + M.options.component_separators[1], M.options.component_separators[1] + } end end - if M.options.section_separators ~=nil then + if M.options.section_separators ~= nil then if type(M.options.section_separators) == 'string' then M.options.section_separators = {section_separator, section_separator} elseif #M.options.section_separators == 1 then - M.options.section_separators = {M.options.section_separators[1], M.options.section_separators[1]} + M.options.section_separators = { + M.options.section_separators[1], M.options.section_separators[1] + } end end end @@ -97,11 +101,11 @@ local function load_special_components(component) local return_val = vim[scope][component] if return_val == nil then return '' end local ok - ok, return_val = pcall(tostring, return_val) + ok, return_val = pcall(tostring, return_val) if ok then return return_val end return '' elseif loadstring(string.format('return %s ~= nil', component)) and - loadstring(string.format([[return %s ~= nil]], component))() then + loadstring(string.format([[return %s ~= nil]], component))() then -- lua veriable component return loadstring(string.format([[ local ok, return_val = pcall(tostring, %s) @@ -111,8 +115,12 @@ local function load_special_components(component) -- vim function component local ok, return_val = pcall(vim.fn[component]) if not ok then return '' end -- function call failed - ok, return_val = pcall(tostring, return_val) - if ok then return return_val else return '' end + ok, return_val = pcall(tostring, return_val) + if ok then + return return_val + else + return '' + end end end end @@ -125,12 +133,11 @@ local function component_loader(component) component.component_name = component[1] -- apply default args for opt_name, opt_val in pairs(M.options) do - if component[opt_name] == nil then - component[opt_name] = opt_val - end + if component[opt_name] == nil then component[opt_name] = opt_val end end -- load the component - local ok, loaded_component = pcall(require, 'lualine.components.' .. component.component_name) + local ok, loaded_component = pcall(require, 'lualine.components.' .. + component.component_name) if not ok then loaded_component = load_special_components(component.component_name) end @@ -142,7 +149,8 @@ local function component_loader(component) if component.color then local function update_color() component.color_highlight = highlight.create_component_highlight_group( - component.color, component.component_name, component) + component.color, + component.component_name, component) end update_color() utils.expand_set_theme(update_color) @@ -170,7 +178,7 @@ local function load_components() load_sections(M.tabline) end -local function load_extensions() +local function load_extensions() for index, extension in pairs(M.extensions) do local local_extension = require('lualine.extensions.' .. extension) load_sections(local_extension.sections) @@ -181,11 +189,11 @@ end local function lualine_set_theme() if type(M.options.theme) == 'string' then - M.options.theme = require('lualine.themes.'.. M.options.theme) + M.options.theme = require('lualine.themes.' .. M.options.theme) -- change the theme table in component so their custom -- highlights can reflect theme change local function reset_component_theme(sections) - for _, section in pairs(sections)do + for _, section in pairs(sections) do for _, component in pairs(section) do if type(component) == 'table' then component.theme = M.options.theme @@ -200,20 +208,23 @@ local function lualine_set_theme() highlight.create_highlight_groups(M.options.theme) end - local function statusline(sections, is_focused) local function create_status_builder() -- The sequence sections should maintain local section_sequence = {'a', 'b', 'c', 'x', 'y', 'z'} local status_builder = {} for _, section_name in ipairs(section_sequence) do - if sections['lualine_'..section_name] then + if sections['lualine_' .. section_name] then -- insert highlight+components of this section to status_builder local section_highlight = highlight.format_highlight(is_focused, - 'lualine_'..section_name) - local section_data = utils_component.draw_section(sections['lualine_'..section_name], section_highlight) + 'lualine_' .. + section_name) + local section_data = utils_component.draw_section( + sections['lualine_' .. section_name], + section_highlight) if #section_data > 0 then - table.insert(status_builder, {name = section_name, data = section_data,}) + table.insert(status_builder, + {name = section_name, data = section_data}) end end end @@ -225,24 +236,29 @@ local function statusline(sections, is_focused) -- Actual statusline local status = {} local half_passed = false - for i=1,#status_builder do + for i = 1, #status_builder do -- midsection divider if not half_passed and status_builder[i].name > 'c' then - table.insert(status, highlight.format_highlight(is_focused, 'lualine_c') .. '%=') + table.insert(status, + highlight.format_highlight(is_focused, 'lualine_c') .. '%=') half_passed = true end -- provide section_separators when statusline is in focus if is_focused then -- component separator needs to have fg = current_section.bg -- and bg = adjacent_section.bg - local previous_section = status_builder[i-1] or {} + local previous_section = status_builder[i - 1] or {} local current_section = status_builder[i] - local next_section = status_builder[i+1] or {} + local next_section = status_builder[i + 1] or {} -- For 2nd half we need to show separator before section if current_section.name > 'x' then - local transitional_highlight = highlight.get_transitional_highlights(previous_section.data, current_section.data, true) - if transitional_highlight and M.options.section_separators and M.options.section_separators[2] then - table.insert(status, transitional_highlight .. M.options.section_separators[2]) + local transitional_highlight = highlight.get_transitional_highlights( + previous_section.data, + current_section.data, true) + if transitional_highlight and M.options.section_separators and + M.options.section_separators[2] then + table.insert(status, transitional_highlight .. + M.options.section_separators[2]) end end @@ -251,9 +267,13 @@ local function statusline(sections, is_focused) -- For 1st half we need to show separator after section if current_section.name < 'c' then - local transitional_highlight = highlight.get_transitional_highlights(current_section.data, next_section.data) - if transitional_highlight and M.options.section_separators and M.options.section_separators[1] then - table.insert(status, transitional_highlight .. M.options.section_separators[1]) + local transitional_highlight = highlight.get_transitional_highlights( + current_section.data, + next_section.data) + if transitional_highlight and M.options.section_separators and + M.options.section_separators[1] then + table.insert(status, transitional_highlight .. + M.options.section_separators[1]) end end else -- when not in focus @@ -262,7 +282,8 @@ local function statusline(sections, is_focused) end -- incase none of x,y,z was configured lets not fill whole statusline with a,b,c section if not half_passed then - table.insert(status, highlight.format_highlight(is_focused,'lualine_c').."%=") + table.insert(status, + highlight.format_highlight(is_focused, 'lualine_c') .. '%=') end return table.concat(status) end @@ -286,22 +307,16 @@ local function status_dispatch() local extension_sections = get_extension_sections() if vim.g.statusline_winid == vim.fn.win_getid() then local sections = extension_sections.sections - if sections == nil then - sections = M.sections - end + if sections == nil then sections = M.sections end return statusline(sections, true) else local inactive_sections = extension_sections.inactive_sections - if inactive_sections == nil then - inactive_sections = M.inactive_sections - end + if inactive_sections == nil then inactive_sections = M.inactive_sections end return statusline(inactive_sections, false) end end -local function tabline() - return statusline(M.tabline, true) -end +local function tabline() return statusline(M.tabline, true) end local function setup_theme() lualine_set_theme() diff --git a/lua/lualine/themes/16color.lua b/lua/lualine/themes/16color.lua index 42e5f9f..91819b3 100644 --- a/lua/lualine/themes/16color.lua +++ b/lua/lualine/themes/16color.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit itchyny, jackno (lightline) - local M = {} - +-- LuaFormatter off local colors = { black = '#000000', maroon = '#800000', @@ -22,29 +21,24 @@ local colors = { aqua = '#00ffff', white = '#ffffff', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.white, bg = colors.green , gui = 'bold', }, -} +M.insert = {a = {fg = colors.white, bg = colors.green, gui = 'bold'}} -M.visual = { - a = { fg = colors.white, bg = colors.purple , gui = 'bold', }, -} +M.visual = {a = {fg = colors.white, bg = colors.purple, gui = 'bold'}} -M.replace = { - a = { fg = colors.white, bg = colors.red , gui = 'bold', }, -} +M.replace = {a = {fg = colors.white, bg = colors.red, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/auto.lua b/lua/lualine/themes/auto.lua index 6cdff15..0d361ec 100644 --- a/lua/lualine/themes/auto.lua +++ b/lua/lualine/themes/auto.lua @@ -1,4 +1,4 @@ -local utils = require'lualine.utils.utils' +local utils = require 'lualine.utils.utils' --------------- -- Constents -- @@ -10,12 +10,16 @@ local brightness_modifier_parameter = 10 -- retrives color value from highlight group name in syntax_list -- first present highlight is returned -local function getHi( scope, syntaxlist ) - for _ , highlight_name in pairs( syntaxlist ) do +local function getHi(scope, syntaxlist) + for _, highlight_name in pairs(syntaxlist) do if vim.fn.hlexists(highlight_name) ~= 0 then local color = utils.extract_highlight_colors(highlight_name) if color.reverse then - if scope == 'guibg' then scope = 'guifg' else scope = 'guibg' end + if scope == 'guibg' then + scope = 'guifg' + else + scope = 'guibg' + end end if color[scope] then return color[scope] end end @@ -25,17 +29,19 @@ end -- truns #rrggbb -> { red, green, blue } local function rgb_str2num(rgb_color_str) - 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, } + 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} 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) + rgb_color_num.green, rgb_color_num.blue) return rgb_color_str end @@ -85,13 +91,12 @@ 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 > .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 @@ -99,17 +104,16 @@ end -- Get the colors to create theme local colors = { - normal = getHi( 'guibg', {'PmenuSel', 'PmenuThumb', 'TabLineSel' } ), - insert = getHi( 'guifg', {'String', 'MoreMsg' } ), - replace = getHi( 'guifg', {'Number', 'Type' } ), - visual = getHi( 'guifg', {'Special', 'Boolean', 'Constant' } ), - command = getHi( 'guifg', {'Identifier' } ), - back1 = getHi( 'guibg', {'Normal', 'StatusLineNC' } ), - fore = getHi( 'guifg', {'Normal', 'StatusLine' } ), - back2 = getHi( 'guibg', {'StatusLine' } ), + normal = getHi('guibg', {'PmenuSel', 'PmenuThumb', 'TabLineSel'}), + insert = getHi('guifg', {'String', 'MoreMsg'}), + replace = getHi('guifg', {'Number', 'Type'}), + visual = getHi('guifg', {'Special', 'Boolean', 'Constant'}), + command = getHi('guifg', {'Identifier'}), + back1 = getHi('guibg', {'Normal', 'StatusLineNC'}), + fore = getHi('guifg', {'Normal', 'StatusLine'}), + back2 = getHi('guibg', {'StatusLine'}) } - -- Change brightness of colors -- darken incase of light theme lighten incase of dark theme @@ -124,30 +128,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 @@ -155,9 +159,7 @@ 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 diff --git a/lua/lualine/themes/ayu_dark.lua b/lua/lualine/themes/ayu_dark.lua index 1716122..cc82731 100644 --- a/lua/lualine/themes/ayu_dark.lua +++ b/lua/lualine/themes/ayu_dark.lua @@ -2,41 +2,42 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color2 = "#0f1419", - color3 = "#ffee99", - color4 = "#e6e1cf", - color5 = "#14191f", - color13 = "#b8cc52", - color10 = "#36a3d9", - color8 = "#f07178", - color9 = "#3e4b59", + color2 = '#0f1419', + color3 = '#ffee99', + color4 = '#e6e1cf', + color5 = '#14191f', + color13 = '#b8cc52', + color10 = '#36a3d9', + color8 = '#f07178', + color9 = '#3e4b59', } +-- LuaFormatter on local ayu_dark = { visual = { - a = { fg = colors.color2, bg = colors.color3 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color3, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, replace = { - a = { fg = colors.color2, bg = colors.color8 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color8, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, inactive = { - c = { fg = colors.color4, bg = colors.color2 }, - a = { fg = colors.color4, bg = colors.color5 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color4, bg = colors.color2}, + a = {fg = colors.color4, bg = colors.color5, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, normal = { - c = { fg = colors.color9, bg = colors.color2 }, - a = { fg = colors.color2, bg = colors.color10 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color9, bg = colors.color2}, + a = {fg = colors.color2, bg = colors.color10, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, insert = { - a = { fg = colors.color2, bg = colors.color13 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, - }, + a = {fg = colors.color2, bg = colors.color13, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} + } } return ayu_dark diff --git a/lua/lualine/themes/ayu_light.lua b/lua/lualine/themes/ayu_light.lua index a3deac3..f7a058e 100644 --- a/lua/lualine/themes/ayu_light.lua +++ b/lua/lualine/themes/ayu_light.lua @@ -2,41 +2,42 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color2 = "#f3f3f3", - color3 = "#A37ACC", - color4 = "#5C6773", - color5 = "#d3d3d3", - color13 = "#86B300", - color10 = "#59c2ff", - color8 = "#f07178", - color9 = "#828C99", + color2 = '#f3f3f3', + color3 = '#A37ACC', + color4 = '#5C6773', + color5 = '#d3d3d3', + color13 = '#86B300', + color10 = '#59c2ff', + color8 = '#f07178', + color9 = '#828C99', } +-- LuaFormatter on local ayu_light = { visual = { - a = { fg = colors.color2, bg = colors.color3 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color3, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, replace = { - a = { fg = colors.color2, bg = colors.color8 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color8, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, inactive = { - c = { fg = colors.color4, bg = colors.color2 }, - a = { fg = colors.color4, bg = colors.color5 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color4, bg = colors.color2}, + a = {fg = colors.color4, bg = colors.color5, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, normal = { - c = { fg = colors.color9, bg = colors.color2 }, - a = { fg = colors.color2, bg = colors.color10 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color9, bg = colors.color2}, + a = {fg = colors.color2, bg = colors.color10, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, insert = { - a = { fg = colors.color2, bg = colors.color13 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, - }, + a = {fg = colors.color2, bg = colors.color13, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} + } } return ayu_light diff --git a/lua/lualine/themes/ayu_mirage.lua b/lua/lualine/themes/ayu_mirage.lua index 4c03e4f..3ff418b 100644 --- a/lua/lualine/themes/ayu_mirage.lua +++ b/lua/lualine/themes/ayu_mirage.lua @@ -2,41 +2,42 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color2 = "#242b38", - color3 = "#d4bfff", - color4 = "#d9d7ce", - color5 = "#272d38", - color13 = "#bbe67e", - color10 = "#59c2ff", - color8 = "#f07178", - color9 = "#607080", + color2 = '#242b38', + color3 = '#d4bfff', + color4 = '#d9d7ce', + color5 = '#272d38', + color13 = '#bbe67e', + color10 = '#59c2ff', + color8 = '#f07178', + color9 = '#607080', } +-- LuaFormatter on local ayu_mirage = { visual = { - a = { fg = colors.color2, bg = colors.color3 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color3, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, replace = { - a = { fg = colors.color2, bg = colors.color8 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color8, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, inactive = { - c = { fg = colors.color4, bg = colors.color2 }, - a = { fg = colors.color4, bg = colors.color5 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color4, bg = colors.color2}, + a = {fg = colors.color4, bg = colors.color5, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, normal = { - c = { fg = colors.color9, bg = colors.color2 }, - a = { fg = colors.color2, bg = colors.color10 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color9, bg = colors.color2}, + a = {fg = colors.color2, bg = colors.color10, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, insert = { - a = { fg = colors.color2, bg = colors.color13 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, - }, + a = {fg = colors.color2, bg = colors.color13, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} + } } return ayu_mirage diff --git a/lua/lualine/themes/codedark.lua b/lua/lualine/themes/codedark.lua index df2243a..1cb132d 100644 --- a/lua/lualine/themes/codedark.lua +++ b/lua/lualine/themes/codedark.lua @@ -1,45 +1,44 @@ -- Copyright (c) 2020-2021 Shatur95 -- MIT license, see LICENSE for more details. - - local codedark = {} - +-- LuaFormatter off local colors = { - gray = "#3C3C3C", - lightred = "#D16969", - blue = "#569CD6", - pink = "#C586C0", - black = "#262626", - white = "#D4D4D4", - green = "#608B4E", + gray = '#3C3C3C', + lightred = '#D16969', + blue = '#569CD6', + pink = '#C586C0', + black = '#262626', + white = '#D4D4D4', + green = '#608B4E', } +-- LuaFormatter on codedark.normal = { - b = { fg = colors.green, bg = colors.black }, - a = { fg = colors.black, bg = colors.green , "bold", }, - c = { fg = colors.white, bg = colors.black }, + b = {fg = colors.green, bg = colors.black}, + a = {fg = colors.black, bg = colors.green, 'bold'}, + c = {fg = colors.white, bg = colors.black} } codedark.visual = { - b = { fg = colors.pink, bg = colors.black }, - a = { fg = colors.black, bg = colors.pink , "bold", }, + b = {fg = colors.pink, bg = colors.black}, + a = {fg = colors.black, bg = colors.pink, 'bold'} } codedark.inactive = { - b = { fg = colors.black, bg = colors.blue }, - a = { fg = colors.white, bg = colors.gray , "bold", }, + b = {fg = colors.black, bg = colors.blue}, + a = {fg = colors.white, bg = colors.gray, 'bold'} } codedark.replace = { - b = { fg = colors.lightred, bg = colors.black }, - a = { fg = colors.black, bg = colors.lightred , "bold", }, - c = { fg = colors.white, bg = colors.black }, + b = {fg = colors.lightred, bg = colors.black}, + a = {fg = colors.black, bg = colors.lightred, 'bold'}, + c = {fg = colors.white, bg = colors.black} } codedark.insert = { - b = { fg = colors.blue, bg = colors.black }, - a = { fg = colors.black, bg = colors.blue , "bold", }, - c = { fg = colors.white, bg = colors.black }, + b = {fg = colors.blue, bg = colors.black}, + a = {fg = colors.black, bg = colors.blue, 'bold'}, + c = {fg = colors.white, bg = colors.black} } return codedark diff --git a/lua/lualine/themes/dracula.lua b/lua/lualine/themes/dracula.lua index 0be3386..066646a 100644 --- a/lua/lualine/themes/dracula.lua +++ b/lua/lualine/themes/dracula.lua @@ -1,56 +1,55 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit itchyny, jackno (lightline) - local dracula = {} - +-- LuaFormatter off local colors = { - gray = "#44475a", - lightgray = "#5f6a8e", - orange = "#ffb86c", - purple = "#bd93f9", - red = "#ff5555", - yellow = "#f1fa8c", - green = "#50fa7b", - white = "#f8f8f2", - black = "#282a36", + gray = '#44475a', + lightgray = '#5f6a8e', + orange = '#ffb86c', + purple = '#bd93f9', + red = '#ff5555', + yellow = '#f1fa8c', + green = '#50fa7b', + white = '#f8f8f2', + black = '#282a36', } +-- LuaFormatter on dracula.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} } dracula.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} } - dracula.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} } dracula.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} } dracula.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} } dracula.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} } return dracula diff --git a/lua/lualine/themes/forest_night.lua b/lua/lualine/themes/forest_night.lua index 6a04690..5603d51 100644 --- a/lua/lualine/themes/forest_night.lua +++ b/lua/lualine/themes/forest_night.lua @@ -1,61 +1,61 @@ -- Copyright (c) 2020-2021 gnuyent -- MIT license, see LICENSE for more details. - local forest_night = {} - +-- LuaFormatter off local colors = { - bg0 = "#323d43", - bg1 = "#3c474d", - bg3 = "#505a60", - fg = "#d8caac", - aqua = "#87c095", - green = "#a7c080", - orange = "#e39b7b", - purple = "#d39bb6", - red = "#e68183", - grey1 = "#868d80", + bg0 = '#323d43', + bg1 = '#3c474d', + bg3 = '#505a60', + fg = '#d8caac', + aqua = '#87c095', + green = '#a7c080', + orange = '#e39b7b', + purple = '#d39bb6', + red = '#e68183', + grey1 = '#868d80', } +-- LuaFormatter on forest_night.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} } forest_night.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} } forest_night.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} } forest_night.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} } forest_night.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} } forest_night.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} } forest_night.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} } return forest_night diff --git a/lua/lualine/themes/gruvbox.lua b/lua/lualine/themes/gruvbox.lua index 0f24660..a2237ce 100644 --- a/lua/lualine/themes/gruvbox.lua +++ b/lua/lualine/themes/gruvbox.lua @@ -1,10 +1,9 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. - local gruvbox = {} - +-- LuaFormatter off local colors = { - black = "#282828", + black = '#282828', white = '#ebdbb2', red = '#fb4934', green = '#b8bb26', @@ -15,42 +14,42 @@ local colors = { lightgray = '#504945', inactivegray = '#7c6f64', } +-- LuaFormatter on gruvbox.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} } gruvbox.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} } - gruvbox.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} } gruvbox.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} } gruvbox.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} } gruvbox.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} } return gruvbox diff --git a/lua/lualine/themes/gruvbox_material.lua b/lua/lualine/themes/gruvbox_material.lua index cbaf488..9d80840 100644 --- a/lua/lualine/themes/gruvbox_material.lua +++ b/lua/lualine/themes/gruvbox_material.lua @@ -1,42 +1,31 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - +-- LuaFormatter off local colors = { - fg1 = "#282828", - color2 = "#504945", - fg2 = "#ddc7a1", - color3 = "#32302f", - color4 = "#a89984", - color5 = "#7daea3", - color6 = "#a9b665", - color7 = "#d8a657", - color8 = "#d3869b", - color9 = "#ea6962", + fg1 = '#282828', + color2 = '#504945', + fg2 = '#ddc7a1', + color3 = '#32302f', + color4 = '#a89984', + color5 = '#7daea3', + color6 = '#a9b665', + color7 = '#d8a657', + color8 = '#d3869b', + color9 = '#ea6962', } +-- LuaFormatter on local M = { normal = { - a = { fg = colors.fg1, bg = colors.color4, "bold" }, - b = { fg = colors.fg2, bg = colors.color2, }, - c = { fg = colors.fg2, bg = colors.color3, }, - }, - command = { - a = { fg = colors.fg1, bg = colors.color5, "bold" }, - }, - inactive = { - a = { fg = colors.fg2, bg = colors.color2, }, - }, - insert = { - a = { fg = colors.fg1, bg = colors.color6, "bold" }, - }, - replace = { - a = { fg = colors.fg1, bg = colors.color7, "bold" }, - }, - terminal = { - a = { fg = colors.fg1, bg = colors.color8, "bold" }, - }, - visual = { - a = { fg = colors.fg1, bg = colors.color9, "bold" }, + a = {fg = colors.fg1, bg = colors.color4, 'bold'}, + b = {fg = colors.fg2, bg = colors.color2}, + c = {fg = colors.fg2, bg = colors.color3} }, + command = {a = {fg = colors.fg1, bg = colors.color5, 'bold'}}, + inactive = {a = {fg = colors.fg2, bg = colors.color2}}, + insert = {a = {fg = colors.fg1, bg = colors.color6, 'bold'}}, + replace = {a = {fg = colors.fg1, bg = colors.color7, 'bold'}}, + terminal = {a = {fg = colors.fg1, bg = colors.color8, 'bold'}}, + visual = {a = {fg = colors.fg1, bg = colors.color9, 'bold'}} } return M diff --git a/lua/lualine/themes/iceberg_dark.lua b/lua/lualine/themes/iceberg_dark.lua index aa61dbf..4e21f02 100644 --- a/lua/lualine/themes/iceberg_dark.lua +++ b/lua/lualine/themes/iceberg_dark.lua @@ -2,43 +2,44 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color2 = "#161821", - color3 = "#b4be82", - color4 = "#6b7089", - color5 = "#2e313f", - color8 = "#e2a478", - color9 = "#3e445e", - color10 = "#0f1117", - color11 = "#17171b", - color12 = "#818596", - color15 = "#84a0c6", + color2 = '#161821', + color3 = '#b4be82', + color4 = '#6b7089', + color5 = '#2e313f', + color8 = '#e2a478', + color9 = '#3e445e', + color10 = '#0f1117', + color11 = '#17171b', + color12 = '#818596', + color15 = '#84a0c6', } +-- LuaFormatter on local iceberg = { visual = { - a = { fg = colors.color2, bg = colors.color3 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color3, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, replace = { - a = { fg = colors.color2, bg = colors.color8 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color8, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, inactive = { - c = { fg = colors.color9, bg = colors.color10 }, - a = { fg = colors.color9, bg = colors.color10 , "bold", }, - b = { fg = colors.color9, bg = colors.color10 }, + c = {fg = colors.color9, bg = colors.color10}, + a = {fg = colors.color9, bg = colors.color10, 'bold'}, + b = {fg = colors.color9, bg = colors.color10} }, normal = { - c = { fg = colors.color9, bg = colors.color10 }, - a = { fg = colors.color11, bg = colors.color12 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color9, bg = colors.color10}, + a = {fg = colors.color11, bg = colors.color12, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, insert = { - a = { fg = colors.color2, bg = colors.color15 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, - }, + a = {fg = colors.color2, bg = colors.color15, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} + } } return iceberg diff --git a/lua/lualine/themes/iceberg_light.lua b/lua/lualine/themes/iceberg_light.lua index 6596119..3fce919 100644 --- a/lua/lualine/themes/iceberg_light.lua +++ b/lua/lualine/themes/iceberg_light.lua @@ -2,41 +2,42 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color5 = "#668e3d", - color8 = "#757ca3", - color9 = "#8b98b6", - color10 = "#cad0de", - color11 = "#2d539e", - color0 = "#e8e9ec", - color1 = "#9fa6c0", - color2 = "#c57339", + color5 = '#668e3d', + color8 = '#757ca3', + color9 = '#8b98b6', + color10 = '#cad0de', + color11 = '#2d539e', + color0 = '#e8e9ec', + color1 = '#9fa6c0', + color2 = '#c57339', } +-- LuaFormatter on local iceberg = { replace = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color0, bg = colors.color2 , "bold", }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color0, bg = colors.color2, 'bold'} }, visual = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color0, bg = colors.color5 , "bold", }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color0, bg = colors.color5, 'bold'} }, normal = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color0, bg = colors.color8 , "bold", }, - c = { fg = colors.color9, bg = colors.color10 }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color0, bg = colors.color8, 'bold'}, + c = {fg = colors.color9, bg = colors.color10} }, inactive = { - b = { fg = colors.color9, bg = colors.color10 }, - a = { fg = colors.color9, bg = colors.color10 , "bold", }, - c = { fg = colors.color9, bg = colors.color10 }, + b = {fg = colors.color9, bg = colors.color10}, + a = {fg = colors.color9, bg = colors.color10, 'bold'}, + c = {fg = colors.color9, bg = colors.color10} }, insert = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color0, bg = colors.color11 , "bold", }, - }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color0, bg = colors.color11, 'bold'} + } } return iceberg diff --git a/lua/lualine/themes/jellybeans.lua b/lua/lualine/themes/jellybeans.lua index 83870ba..e20fd1c 100644 --- a/lua/lualine/themes/jellybeans.lua +++ b/lua/lualine/themes/jellybeans.lua @@ -2,42 +2,43 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color2 = "#30302c", - color3 = "#f0a0c0", - color4 = "#e8e8d3", - color5 = "#4e4e43", - color8 = "#cf6a4c", - color9 = "#666656", - color10 = "#808070", - color11 = "#8197bf", - color14 = "#99ad6a", + color2 = '#30302c', + color3 = '#f0a0c0', + color4 = '#e8e8d3', + color5 = '#4e4e43', + color8 = '#cf6a4c', + color9 = '#666656', + color10 = '#808070', + color11 = '#8197bf', + color14 = '#99ad6a', } +-- LuaFormatter on local jellybeans = { visual = { - a = { fg = colors.color2, bg = colors.color3 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color3, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, replace = { - a = { fg = colors.color2, bg = colors.color8 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + a = {fg = colors.color2, bg = colors.color8, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, inactive = { - c = { fg = colors.color9, bg = colors.color2 }, - a = { fg = colors.color10, bg = colors.color2 , "bold", }, - b = { fg = colors.color9, bg = colors.color2 }, + c = {fg = colors.color9, bg = colors.color2}, + a = {fg = colors.color10, bg = colors.color2, 'bold'}, + b = {fg = colors.color9, bg = colors.color2} }, normal = { - c = { fg = colors.color10, bg = colors.color2 }, - a = { fg = colors.color2, bg = colors.color11 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, + c = {fg = colors.color10, bg = colors.color2}, + a = {fg = colors.color2, bg = colors.color11, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} }, insert = { - a = { fg = colors.color2, bg = colors.color14 , "bold", }, - b = { fg = colors.color4, bg = colors.color5 }, - }, + a = {fg = colors.color2, bg = colors.color14, 'bold'}, + b = {fg = colors.color4, bg = colors.color5} + } } return jellybeans diff --git a/lua/lualine/themes/material.lua b/lua/lualine/themes/material.lua index 581626a..7356dbb 100644 --- a/lua/lualine/themes/material.lua +++ b/lua/lualine/themes/material.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: Lokesh Krishna(lightline) - local M = {} - +-- LuaFormatter off local colors = { fg = '#eeffff', bg = '#263238', @@ -17,32 +16,33 @@ local colors = { gray2 = '#2E3C43', gray3 = '#515559', } +-- LuaFormatter on M.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} } M.insert = { - a = { fg = colors.bg, bg = colors.green, 'bold' , gui = 'bold', }, - b = { fg = colors.fg, bg = colors.gray3 , }, + a = {fg = colors.bg, bg = colors.green, 'bold', gui = 'bold'}, + b = {fg = colors.fg, bg = colors.gray3} } M.visual = { - a = { fg = colors.bg, bg = colors.purple, 'bold' , gui = 'bold', }, - b = { fg = colors.fg, bg = colors.gray3 , }, + a = {fg = colors.bg, bg = colors.purple, 'bold', gui = 'bold'}, + b = {fg = colors.fg, bg = colors.gray3} } M.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} } M.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} } return M diff --git a/lua/lualine/themes/molokai.lua b/lua/lualine/themes/molokai.lua index b4d9838..09bc476 100644 --- a/lua/lualine/themes/molokai.lua +++ b/lua/lualine/themes/molokai.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: challsted(lightline) - local molokai = {} - +-- LuaFormatter off local colors = { black = '#232526', gray = '#808080', @@ -15,29 +14,24 @@ local colors = { red = '#ff0000', yellow = '#e6db74', } +-- LuaFormatter on molokai.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} } -molokai.insert = { - a = { fg = colors.black, bg = colors.green , gui = 'bold', }, -} +molokai.insert = {a = {fg = colors.black, bg = colors.green, gui = 'bold'}} -molokai.visual = { - a = { fg = colors.black, bg = colors.yellow , gui = 'bold', }, -} +molokai.visual = {a = {fg = colors.black, bg = colors.yellow, gui = 'bold'}} -molokai.replace = { - a = { fg = colors.black, bg = colors.red , gui = 'bold', }, -} +molokai.replace = {a = {fg = colors.black, bg = colors.red, gui = 'bold'}} molokai.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} } return molokai diff --git a/lua/lualine/themes/nightfly.lua b/lua/lualine/themes/nightfly.lua index 14e3ef4..f755d11 100644 --- a/lua/lualine/themes/nightfly.lua +++ b/lua/lualine/themes/nightfly.lua @@ -1,39 +1,40 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - +-- LuaFormatter off local colors = { - color3 = "#2c3043", - color6 = "#a1aab8", - color7 = "#82aaff", - color8 = "#ae81ff", - color0 = "#092236", - color1 = "#ff5874", - color2 = "#c3ccdc", + color3 = '#2c3043', + color6 = '#a1aab8', + color7 = '#82aaff', + color8 = '#ae81ff', + color0 = '#092236', + color1 = '#ff5874', + color2 = '#c3ccdc', } +-- LuaFormatter on local nightfly = { replace = { - a = { fg = colors.color0, bg = colors.color1 , "bold", }, - b = { fg = colors.color2, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color1, 'bold'}, + b = {fg = colors.color2, bg = colors.color3} }, inactive = { - a = { fg = colors.color6, bg = colors.color3 , "bold", }, - b = { fg = colors.color6, bg = colors.color3 }, - c = { fg = colors.color6, bg = colors.color3 }, + a = {fg = colors.color6, bg = colors.color3, 'bold'}, + b = {fg = colors.color6, bg = colors.color3}, + c = {fg = colors.color6, bg = colors.color3} }, normal = { - a = { fg = colors.color0, bg = colors.color7 , "bold", }, - b = { fg = colors.color2, bg = colors.color3 }, - c = { fg = colors.color2, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color7, 'bold'}, + b = {fg = colors.color2, bg = colors.color3}, + c = {fg = colors.color2, bg = colors.color3} }, visual = { - a = { fg = colors.color0, bg = colors.color8 , "bold", }, - b = { fg = colors.color2, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color8, 'bold'}, + b = {fg = colors.color2, bg = colors.color3} }, insert = { - a = { fg = colors.color0, bg = colors.color2 , "bold", }, - b = { fg = colors.color2, bg = colors.color3 }, - }, + a = {fg = colors.color0, bg = colors.color2, 'bold'}, + b = {fg = colors.color2, bg = colors.color3} + } } return nightfly diff --git a/lua/lualine/themes/nord.lua b/lua/lualine/themes/nord.lua index 0a71140..7d6ac7b 100644 --- a/lua/lualine/themes/nord.lua +++ b/lua/lualine/themes/nord.lua @@ -1,40 +1,34 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local nord = {} - +-- LuaFormatter off local colors = { - nord1 = "#3B4252", - nord3 = "#4C566A", - nord5 = "#E5E9F0", - nord6 = "#ECEFF4", - nord7 = "#8FBCBB", - nord8 = "#88C0D0", - nord13 = "#EBCB8B", + nord1 = '#3B4252', + nord3 = '#4C566A', + nord5 = '#E5E9F0', + nord6 = '#ECEFF4', + nord7 = '#8FBCBB', + nord8 = '#88C0D0', + nord13 = '#EBCB8B', } +-- LuaFormatter on nord.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} } -nord.insert = { - a = { fg = colors.nord1, bg = colors.nord6, gui = 'bold', }, -} +nord.insert = {a = {fg = colors.nord1, bg = colors.nord6, gui = 'bold'}} -nord.visual = { - a = { fg = colors.nord1, bg = colors.nord7, gui = 'bold', }, -} +nord.visual = {a = {fg = colors.nord1, bg = colors.nord7, gui = 'bold'}} -nord.replace = { - a = { fg = colors.nord1, bg = colors.nord13, gui = 'bold', }, -} +nord.replace = {a = {fg = colors.nord1, bg = colors.nord13, gui = 'bold'}} nord.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} } return nord diff --git a/lua/lualine/themes/oceanicnext.lua b/lua/lualine/themes/oceanicnext.lua index 524e5ad..944d899 100644 --- a/lua/lualine/themes/oceanicnext.lua +++ b/lua/lualine/themes/oceanicnext.lua @@ -2,44 +2,45 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color0 = "#ffffff", - color1 = "#99c794", - color2 = "#65737e", - color3 = "#343d46", - color4 = "#6699cc", - color5 = "#d8dee9", - color6 = "#f99157", - color7 = "#ec5f67", + color0 = '#ffffff', + color1 = '#99c794', + color2 = '#65737e', + color3 = '#343d46', + color4 = '#6699cc', + color5 = '#d8dee9', + color6 = '#f99157', + color7 = '#ec5f67', } +-- LuaFormatter on local oceanicnext = { insert = { - a = { fg = colors.color0, bg = colors.color1 , "bold", }, - b = { fg = colors.color0, bg = colors.color2 }, - c = { fg = colors.color0, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color1, 'bold'}, + b = {fg = colors.color0, bg = colors.color2}, + c = {fg = colors.color0, bg = colors.color3} }, normal = { - a = { fg = colors.color0, bg = colors.color4 , "bold", }, - b = { fg = colors.color0, bg = colors.color2 }, - c = { fg = colors.color0, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color4, 'bold'}, + b = {fg = colors.color0, bg = colors.color2}, + c = {fg = colors.color0, bg = colors.color3} }, inactive = { - a = { fg = colors.color5, bg = colors.color2 , "bold", }, - b = { fg = colors.color5, bg = colors.color3 }, - c = { fg = colors.color2, bg = colors.color3 }, + a = {fg = colors.color5, bg = colors.color2, 'bold'}, + b = {fg = colors.color5, bg = colors.color3}, + c = {fg = colors.color2, bg = colors.color3} }, visual = { - a = { fg = colors.color0, bg = colors.color6 , "bold", }, - b = { fg = colors.color0, bg = colors.color2 }, - c = { fg = colors.color0, bg = colors.color3 }, + a = {fg = colors.color0, bg = colors.color6, 'bold'}, + b = {fg = colors.color0, bg = colors.color2}, + c = {fg = colors.color0, bg = colors.color3} }, replace = { - a = { fg = colors.color0, bg = colors.color7 , "bold", }, - b = { fg = colors.color0, bg = colors.color2 }, - c = { fg = colors.color0, bg = colors.color3 }, - }, + a = {fg = colors.color0, bg = colors.color7, 'bold'}, + b = {fg = colors.color0, bg = colors.color2}, + c = {fg = colors.color0, bg = colors.color3} + } } return oceanicnext diff --git a/lua/lualine/themes/onedark.lua b/lua/lualine/themes/onedark.lua index b51c386..7b897ba 100644 --- a/lua/lualine/themes/onedark.lua +++ b/lua/lualine/themes/onedark.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: Zoltan Dalmadi(lightline) - local M = {} - +-- LuaFormatter off local colors = { blue = '#61afef', green = '#98c379', @@ -17,29 +16,24 @@ local colors = { gray2 = '#2c323d', gray3 = '#3e4452', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.bg, bg = colors.blue , gui = 'bold', }, -} +M.insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}} -M.visual = { - a = { fg = colors.bg, bg = colors.purple , gui = 'bold', }, -} +M.visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}} -M.replace = { - a = { fg = colors.bg, bg = colors.red1 , gui = 'bold', }, -} +M.replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/onelight.lua b/lua/lualine/themes/onelight.lua index 37d515d..60c9e0b 100644 --- a/lua/lualine/themes/onelight.lua +++ b/lua/lualine/themes/onelight.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: Zoltan Dalmadi(lightline) - local M = {} - +-- LuaFormatter off local colors = { blue = '#61afef', green = '#98c379', @@ -17,29 +16,24 @@ local colors = { gray2 = '#f0f0f0', gray3 = '#d0d0d0', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.bg, bg = colors.blue , gui = 'bold', }, -} +M.insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}} -M.visual = { - a = { fg = colors.bg, bg = colors.purple , gui = 'bold', }, -} +M.visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}} -M.replace = { - a = { fg = colors.bg, bg = colors.red1 , gui = 'bold', }, -} +M.replace = {a = {fg = colors.bg, bg = colors.red1, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/palenight.lua b/lua/lualine/themes/palenight.lua index b3e6bca..8b9a367 100644 --- a/lua/lualine/themes/palenight.lua +++ b/lua/lualine/themes/palenight.lua @@ -1,44 +1,48 @@ +-- Copyright (c) 2020-2021 IGI-111 +-- MIT license, see LICENSE for more details. +-- LuaFormatter off local colors = { - vertsplit = "#181A1F", - special_grey = "#3B4048", - menu_grey = "#3E4452", - cursor_grey = "#2C323C", - gutter_fg_grey = "#4B5263", - blue = "#82b1ff", - dark_red = "#BE5046", - white = "#bfc7d5", - green = "#C3E88D", - purple = "#c792ea", - yellow = "#ffcb6b", - light_red = "#ff869a", - red = "#ff5370", - dark_yellow = "#F78C6C", - cyan = "#89DDFF", - comment_grey = "#697098", - black = "#292D3E", + vertsplit = '#181A1F', + special_grey = '#3B4048', + menu_grey = '#3E4452', + cursor_grey = '#2C323C', + gutter_fg_grey = '#4B5263', + blue = '#82b1ff', + dark_red = '#BE5046', + white = '#bfc7d5', + green = '#C3E88D', + purple = '#c792ea', + yellow = '#ffcb6b', + light_red = '#ff869a', + red = '#ff5370', + dark_yellow = '#F78C6C', + cyan = '#89DDFF', + comment_grey = '#697098', + black = '#292D3E', } +-- LuaFormatter on return { normal = { - a = { fg = colors.black, bg = colors.purple, "bold" }, - b = { fg = colors.purple, bg = colors.menu_grey }, - c = { fg = colors.comment_grey, bg = colors.black }, + a = {fg = colors.black, bg = colors.purple, '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, "bold" }, - b = { fg = colors.blue, bg = colors.menu_grey }, + a = {fg = colors.black, bg = colors.blue, 'bold'}, + b = {fg = colors.blue, bg = colors.menu_grey} }, visual = { - a = { fg = colors.black, bg = colors.cyan, "bold", }, - b = { fg = colors.cyan, bg = colors.menu_grey }, + a = {fg = colors.black, bg = colors.cyan, 'bold'}, + b = {fg = colors.cyan, bg = colors.menu_grey} }, replace = { - a = { fg = colors.black, bg = colors.green, "bold" }, - b = { fg = colors.green, bg = colors.menu_grey }, + a = {fg = colors.black, bg = colors.green, 'bold'}, + b = {fg = colors.green, bg = colors.menu_grey} }, inactive = { - a = { fg = colors.black, bg = colors.menu_grey, "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, 'bold'}, + b = {fg = colors.black, bg = colors.menu_grey}, + c = {fg = colors.black, bg = colors.menu_grey} + } } diff --git a/lua/lualine/themes/papercolor.lua b/lua/lualine/themes/papercolor.lua index aa91433..15abb8c 100644 --- a/lua/lualine/themes/papercolor.lua +++ b/lua/lualine/themes/papercolor.lua @@ -1,7 +1,6 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) - local background = vim.o.background -return require("lualine.themes.papercolor_"..background) +return require('lualine.themes.papercolor_' .. background) diff --git a/lua/lualine/themes/papercolor_dark.lua b/lua/lualine/themes/papercolor_dark.lua index c323cad..d8d868e 100644 --- a/lua/lualine/themes/papercolor_dark.lua +++ b/lua/lualine/themes/papercolor_dark.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: TKNGUE(lightline) - local M = {} - +-- LuaFormatter off local colors = { red = '#df0000', green = '#008700', @@ -26,29 +25,24 @@ local colors = { visual_fg = '#000000', visual_bg = '#8787af', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.background, bg = colors.blue, gui = 'bold', }, -} +M.insert = {a = {fg = colors.background, bg = colors.blue, gui = 'bold'}} -M.visual = { - a = { fg = colors.visual_fg, bg = colors.visual_bg , gui = 'bold', }, -} +M.visual = {a = {fg = colors.visual_fg, bg = colors.visual_bg, gui = 'bold'}} -M.replace = { - a = { fg = colors.background, bg = colors.pink , gui = 'bold', }, -} +M.replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/papercolor_light.lua b/lua/lualine/themes/papercolor_light.lua index 6000564..a33cd3b 100644 --- a/lua/lualine/themes/papercolor_light.lua +++ b/lua/lualine/themes/papercolor_light.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: TKNGUE(lightline) - local M = {} - +-- LuaFormatter off local colors = { red = '#df0000', green = '#008700', @@ -24,29 +23,24 @@ local colors = { statusline_inactive_fg = '#4d4d4c', statusline_inactive_bg = '#dadada', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.blue, bg = colors.background , gui = 'bold', }, -} +M.insert = {a = {fg = colors.blue, bg = colors.background, gui = 'bold'}} -M.visual = { - a = { fg = colors.background, bg = colors.orange , gui = 'bold', }, -} +M.visual = {a = {fg = colors.background, bg = colors.orange, gui = 'bold'}} -M.replace = { - a = { fg = colors.background, bg = colors.pink , gui = 'bold', }, -} +M.replace = {a = {fg = colors.background, bg = colors.pink, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/powerline.lua b/lua/lualine/themes/powerline.lua index 3d7ba49..35f35aa 100644 --- a/lua/lualine/themes/powerline.lua +++ b/lua/lualine/themes/powerline.lua @@ -1,8 +1,7 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - -local powerline = { } - +local powerline = {} +-- LuaFormatter off local Colors = { white = '#ffffff', darkestgreen = '#005f00', @@ -20,32 +19,32 @@ local Colors = { gray7 = '#9e9e9e', gray10 = '#f0f0f0', } +-- LuaFormatter on powerline.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} } powerline.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} } - powerline.visual = { - a = { fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold', }, + a = {fg = Colors.darkred, bg = Colors.brightorange, gui = 'bold'} } powerline.replace = { - a = { fg = Colors.white, bg = Colors.brightred, gui = 'bold', }, + a = {fg = Colors.white, bg = Colors.brightred, gui = 'bold'} } powerline.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} } return powerline diff --git a/lua/lualine/themes/seoul256.lua b/lua/lualine/themes/seoul256.lua index 4a6af35..cfc73da 100644 --- a/lua/lualine/themes/seoul256.lua +++ b/lua/lualine/themes/seoul256.lua @@ -2,42 +2,43 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color5 = "#d7afaf", - color6 = "#666656", - color7 = "#808070", - color10 = "#87af87", - color13 = "#df5f87", - color14 = "#87afaf", - color0 = "#e8e8d3", - color1 = "#4e4e43", - color4 = "#30302c", + color5 = '#d7afaf', + color6 = '#666656', + color7 = '#808070', + color10 = '#87af87', + color13 = '#df5f87', + color14 = '#87afaf', + color0 = '#e8e8d3', + color1 = '#4e4e43', + color4 = '#30302c', } +-- LuaFormatter on local seoul256 = { visual = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color4, bg = colors.color5 , "bold", }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color4, bg = colors.color5, 'bold'} }, inactive = { - b = { fg = colors.color6, bg = colors.color4 }, - c = { fg = colors.color6, bg = colors.color4 }, - a = { fg = colors.color7, bg = colors.color4 , "bold", }, + b = {fg = colors.color6, bg = colors.color4}, + c = {fg = colors.color6, bg = colors.color4}, + a = {fg = colors.color7, bg = colors.color4, 'bold'} }, insert = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color4, bg = colors.color10 , "bold", }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color4, bg = colors.color10, 'bold'} }, replace = { - b = { fg = colors.color0, bg = colors.color1 }, - a = { fg = colors.color4, bg = colors.color13 , "bold", }, + b = {fg = colors.color0, bg = colors.color1}, + a = {fg = colors.color4, bg = colors.color13, 'bold'} }, normal = { - b = { fg = colors.color0, bg = colors.color1 }, - c = { fg = colors.color7, bg = colors.color4 }, - a = { fg = colors.color4, bg = colors.color14 , "bold", }, - }, + b = {fg = colors.color0, bg = colors.color1}, + c = {fg = colors.color7, bg = colors.color4}, + a = {fg = colors.color4, bg = colors.color14, 'bold'} + } } return seoul256 diff --git a/lua/lualine/themes/solarized.lua b/lua/lualine/themes/solarized.lua index 3e05426..a8b544f 100644 --- a/lua/lualine/themes/solarized.lua +++ b/lua/lualine/themes/solarized.lua @@ -2,7 +2,6 @@ -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) -- License: MIT License - local background = vim.o.background -return require("lualine.themes.solarized_"..background) +return require('lualine.themes.solarized_' .. background) diff --git a/lua/lualine/themes/solarized_dark.lua b/lua/lualine/themes/solarized_dark.lua index 01b43cc..4f8f253 100644 --- a/lua/lualine/themes/solarized_dark.lua +++ b/lua/lualine/themes/solarized_dark.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) - local M = {} - +-- LuaFormatter off local colors = { base03 = '#002b36', base02 = '#073642', @@ -22,29 +21,24 @@ local colors = { cyan = '#2aa198', green = '#859900', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.base03, bg = colors.green , gui = 'bold', }, -} +M.insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}} -M.visual = { - a = { fg = colors.base03, bg = colors.magenta , gui = 'bold', }, -} +M.visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}} -M.replace = { - a = { fg = colors.base03, bg = colors.red , gui = 'bold', }, -} +M.replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/solarized_light.lua b/lua/lualine/themes/solarized_light.lua index e729732..e3635df 100644 --- a/lua/lualine/themes/solarized_light.lua +++ b/lua/lualine/themes/solarized_light.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) - local M = {} - +-- LuaFormatter off local colors = { base3 = '#002b36', base2 = '#073642', @@ -22,29 +21,24 @@ local colors = { cyan = '#2aa198', green = '#859900', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.base03, bg = colors.green , gui = 'bold', }, -} +M.insert = {a = {fg = colors.base03, bg = colors.green, gui = 'bold'}} -M.visual = { - a = { fg = colors.base03, bg = colors.magenta , gui = 'bold', }, -} +M.visual = {a = {fg = colors.base03, bg = colors.magenta, gui = 'bold'}} -M.replace = { - a = { fg = colors.base03, bg = colors.red , gui = 'bold', }, -} +M.replace = {a = {fg = colors.base03, bg = colors.red, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/themes/tomorrow.lua b/lua/lualine/themes/tomorrow.lua index 2e2b567..8836c9a 100644 --- a/lua/lualine/themes/tomorrow.lua +++ b/lua/lualine/themes/tomorrow.lua @@ -2,44 +2,45 @@ -- MIT license, see LICENSE for more details. -- Genarated by lightline to lualine theme converter -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 - +-- LuaFormatter off local colors = { - color14 = "#718c00", - color0 = "#666666", - color1 = "#c8c8c8", - color2 = "#808080", - color3 = "#fafafa", - color4 = "#4271ae", - color5 = "#4d4d4c", - color6 = "#b4b4b4", - color7 = "#555555", - color8 = "#8959a8", - color11 = "#f5871f", + color14 = '#718c00', + color0 = '#666666', + color1 = '#c8c8c8', + color2 = '#808080', + color3 = '#fafafa', + color4 = '#4271ae', + color5 = '#4d4d4c', + color6 = '#b4b4b4', + color7 = '#555555', + color8 = '#8959a8', + color11 = '#f5871f', } +-- LuaFormatter on local tomorrow = { 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} + } } return tomorrow diff --git a/lua/lualine/themes/wombat.lua b/lua/lualine/themes/wombat.lua index 33dd8b5..d88e894 100644 --- a/lua/lualine/themes/wombat.lua +++ b/lua/lualine/themes/wombat.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) - local M = {} - +-- LuaFormatter off local colors = { base03 = '#242424', base023 = '#353535', @@ -22,29 +21,24 @@ local colors = { cyan = '#8ac6f2', green = '#95e454', } +-- LuaFormatter on M.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} } -M.insert = { - a = { fg = colors.base02, bg = colors.green , gui = 'bold', }, -} +M.insert = {a = {fg = colors.base02, bg = colors.green, gui = 'bold'}} -M.visual = { - a = { fg = colors.base02, bg = colors.magenta , gui = 'bold', }, -} +M.visual = {a = {fg = colors.base02, bg = colors.magenta, gui = 'bold'}} -M.replace = { - a = { fg = colors.base023, bg = colors.red , gui = 'bold', }, -} +M.replace = {a = {fg = colors.base023, bg = colors.red, gui = 'bold'}} M.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} } return M diff --git a/lua/lualine/utils/component.lua b/lua/lualine/utils/component.lua index 1100599..d6be489 100644 --- a/lua/lualine/utils/component.lua +++ b/lua/lualine/utils/component.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. +local M = {} -local M = { } - -local highlight = require'lualine.highlight' +local highlight = require 'lualine.highlight' -- set upper or lower case local function apply_case(status, options) @@ -19,27 +18,28 @@ end -- Adds spaces to left and right of a component local function apply_padding(status, options) - local l_padding = (options.left_padding or options.padding or 1) + local l_padding = (options.left_padding or options.padding or 1) local r_padding = (options.right_padding or options.padding or 1) if l_padding then if 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(status, [[\(%#.\{-\}#\)]])[2] - status = pre_highlight .. string.rep(' ', l_padding).. - status:sub(#pre_highlight + 1, #status) + status = pre_highlight .. string.rep(' ', l_padding) .. + status:sub(#pre_highlight + 1, #status) else - status = string.rep(' ', l_padding)..status + status = string.rep(' ', l_padding) .. status end end - if r_padding then status = status..string.rep(' ', r_padding) end + if r_padding then status = status .. string.rep(' ', r_padding) end return status end -- Applies custom highlights for component local function apply_highlights(status, options, default_hl) if options.color_highlight then - status = highlight.component_format_highlight(options.color_highlight) .. status + status = highlight.component_format_highlight(options.color_highlight) .. + status end return status .. default_hl end @@ -55,16 +55,19 @@ end -- Apply separator at end of component only when -- custom highlights haven't affected background local function apply_spearator(status, options) - local separator - if options.separator and #options.separator > 0 then - separator = options.separator - elseif options.component_separators then - if options.self.section < 'lualine_x' then separator = options.component_separators[1] - else separator = options.component_separators[2] end - options.separator = separator + local separator + if options.separator and #options.separator > 0 then + separator = options.separator + elseif options.component_separators then + if options.self.section < 'lualine_x' then + separator = options.component_separators[1] + else + separator = options.component_separators[2] end - if separator then status = status .. separator end - options.separator_applied = separator + options.separator = separator + end + if separator then status = status .. separator end + options.separator_applied = separator return status end @@ -83,7 +86,8 @@ function M.draw_section(section, highlight_name) for _, component in pairs(section) do local localstatus = component[1]() if #localstatus > 0 then - local custom_highlight_at_begining = localstatus:find('%%#.*#') == 1 or component.color ~= nil + local custom_highlight_at_begining = + localstatus:find('%%#.*#') == 1 or component.color ~= nil -- Apply modifier functions for options if component.format then localstatus = component.format(localstatus) end localstatus = apply_icon(localstatus, component) @@ -91,8 +95,8 @@ function M.draw_section(section, highlight_name) localstatus = apply_padding(localstatus, component) localstatus = apply_highlights(localstatus, component, highlight_name) localstatus = apply_spearator(localstatus, component) - if custom_highlight_at_begining or - (#drawn_components > 0 and not drawn_components[#drawn_components].separator_applied)then + if custom_highlight_at_begining or (#drawn_components > 0 and + not drawn_components[#drawn_components].separator_applied) then -- Don't prepend with old highlight when the component changes it imidiately -- Or when it was already applied with separator table.insert(status, localstatus) @@ -105,9 +109,9 @@ function M.draw_section(section, highlight_name) -- Draw nothing when all the components were empty if #status == 0 then return '' end -- Remove separators sorounding custom highlighted component - for i=1,#status do - if (drawn_components[i].color and drawn_components[i].color.bg) - or drawn_components[i].custom_highlight then + for i = 1, #status do + if (drawn_components[i].color and drawn_components[i].color.bg) or + drawn_components[i].custom_highlight then status[i] = strip_separator(status[i], drawn_components[i]) if i > 1 then status[i - 1] = strip_separator(status[i - 1], drawn_components[i - 1]) @@ -118,5 +122,4 @@ function M.draw_section(section, highlight_name) return table.concat(status) end - return M diff --git a/lua/lualine/utils/cterm_colors.lua b/lua/lualine/utils/cterm_colors.lua index 71bae5a..e82afb5 100644 --- a/lua/lualine/utils/cterm_colors.lua +++ b/lua/lualine/utils/cterm_colors.lua @@ -1,9 +1,8 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local M = {} - +-- LuaFormatter off -- color conversion local color_table = { -- lookup table for cterm colors @@ -273,25 +272,26 @@ local color_table = { {'254', { 228, 228, 228 }}, {'255', { 238, 238, 238 }}, } +-- LuaFormatter on function M.get_cterm_color(hex_color) local function get_color_distance(color1, color2) -- returns how much color2 deviates from color1 - local dr = math.abs(color1[1] - color2[1]) / (color1[1]+1) * 100 - local dg = math.abs(color1[2] - color2[2]) / (color1[2]+1) * 100 - local db = math.abs(color1[3] - color2[3]) / (color1[3]+1) * 100 + local dr = math.abs(color1[1] - color2[1]) / (color1[1] + 1) * 100 + local dg = math.abs(color1[2] - color2[2]) / (color1[2] + 1) * 100 + local db = math.abs(color1[3] - color2[3]) / (color1[3] + 1) * 100 return (dr + dg + db) end - local r = tonumber(hex_color:sub(2,3), 16) - local g = tonumber(hex_color:sub(4,5), 16) - local b = tonumber(hex_color:sub(6,7), 16) + local r = tonumber(hex_color:sub(2, 3), 16) + local g = tonumber(hex_color:sub(4, 5), 16) + local b = tonumber(hex_color:sub(6, 7), 16) -- check which cterm color is closest to hex colors in terms of rgb values 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] diff --git a/lua/lualine/utils/utils.lua b/lua/lualine/utils/utils.lua index adae1a3..98d6ebb 100644 --- a/lua/lualine/utils/utils.lua +++ b/lua/lualine/utils/utils.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. - local M = {} -- Works as a decorator to expand set_lualine_theme functions @@ -21,7 +20,7 @@ function M.extract_highlight_colors(color_group, scope) local cterm_colors = vim.api.nvim_get_hl_by_name(color_group, false) local color = { ctermfg = cterm_colors.foreground, - ctermbg = cterm_colors.background, + ctermbg = cterm_colors.background } if gui_colors.background then color.guibg = string.format('#%06x', gui_colors.background) @@ -48,7 +47,7 @@ end -- clears loaded_highlights table and highlights function M.clear_highlights() - for highlight_name, _ in pairs(M.loaded_highlights)do + for highlight_name, _ in pairs(M.loaded_highlights) do vim.cmd('highlight clear ' .. highlight_name) M.loaded_highlights[highlight_name] = nil end