chore: autogen (vimdocs+formating)
This commit is contained in:
parent
bf6e2eaf54
commit
6f28adb21f
|
@ -31,7 +31,7 @@ local bubbles_theme = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require('lualine').setup({
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
theme = bubbles_theme,
|
theme = bubbles_theme,
|
||||||
component_separators = '|',
|
component_separators = '|',
|
||||||
|
@ -59,4 +59,4 @@ require('lualine').setup({
|
||||||
},
|
},
|
||||||
tabline = {},
|
tabline = {},
|
||||||
extensions = {},
|
extensions = {},
|
||||||
})
|
}
|
||||||
|
|
|
@ -78,15 +78,15 @@ local function ins_right(component)
|
||||||
table.insert(config.sections.lualine_x, component)
|
table.insert(config.sections.lualine_x, component)
|
||||||
end
|
end
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
function()
|
function()
|
||||||
return '▊'
|
return '▊'
|
||||||
end,
|
end,
|
||||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
-- mode component
|
-- mode component
|
||||||
function()
|
function()
|
||||||
-- auto change color according to neovims mode
|
-- auto change color according to neovims mode
|
||||||
|
@ -117,25 +117,25 @@ ins_left({
|
||||||
end,
|
end,
|
||||||
color = 'LualineMode',
|
color = 'LualineMode',
|
||||||
padding = { right = 1 },
|
padding = { right = 1 },
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
-- filesize component
|
-- filesize component
|
||||||
'filesize',
|
'filesize',
|
||||||
cond = conditions.buffer_not_empty,
|
cond = conditions.buffer_not_empty,
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
'filename',
|
'filename',
|
||||||
cond = conditions.buffer_not_empty,
|
cond = conditions.buffer_not_empty,
|
||||||
color = { fg = colors.magenta, gui = 'bold' },
|
color = { fg = colors.magenta, gui = 'bold' },
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_left({ 'location' })
|
ins_left { 'location' }
|
||||||
|
|
||||||
ins_left({ 'progress', color = { fg = colors.fg, gui = 'bold' } })
|
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
'diagnostics',
|
'diagnostics',
|
||||||
sources = { 'nvim_diagnostic' },
|
sources = { 'nvim_diagnostic' },
|
||||||
symbols = { error = ' ', warn = ' ', info = ' ' },
|
symbols = { error = ' ', warn = ' ', info = ' ' },
|
||||||
|
@ -144,17 +144,17 @@ ins_left({
|
||||||
color_warn = { fg = colors.yellow },
|
color_warn = { fg = colors.yellow },
|
||||||
color_info = { fg = colors.cyan },
|
color_info = { fg = colors.cyan },
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
-- Insert mid section. You can make any number of sections in neovim :)
|
-- Insert mid section. You can make any number of sections in neovim :)
|
||||||
-- for lualine it's any number greater then 2
|
-- for lualine it's any number greater then 2
|
||||||
ins_left({
|
ins_left {
|
||||||
function()
|
function()
|
||||||
return '%='
|
return '%='
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_left({
|
ins_left {
|
||||||
-- Lsp server name .
|
-- Lsp server name .
|
||||||
function()
|
function()
|
||||||
local msg = 'No Active Lsp'
|
local msg = 'No Active Lsp'
|
||||||
|
@ -173,30 +173,30 @@ ins_left({
|
||||||
end,
|
end,
|
||||||
icon = ' LSP:',
|
icon = ' LSP:',
|
||||||
color = { fg = '#ffffff', gui = 'bold' },
|
color = { fg = '#ffffff', gui = 'bold' },
|
||||||
})
|
}
|
||||||
|
|
||||||
-- Add components to right sections
|
-- Add components to right sections
|
||||||
ins_right({
|
ins_right {
|
||||||
'o:encoding', -- option component same as &encoding in viml
|
'o:encoding', -- option component same as &encoding in viml
|
||||||
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||||
cond = conditions.hide_in_width,
|
cond = conditions.hide_in_width,
|
||||||
color = { fg = colors.green, gui = 'bold' },
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_right({
|
ins_right {
|
||||||
'fileformat',
|
'fileformat',
|
||||||
fmt = string.upper,
|
fmt = string.upper,
|
||||||
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||||
color = { fg = colors.green, gui = 'bold' },
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_right({
|
ins_right {
|
||||||
'branch',
|
'branch',
|
||||||
icon = '',
|
icon = '',
|
||||||
color = { fg = colors.violet, gui = 'bold' },
|
color = { fg = colors.violet, gui = 'bold' },
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_right({
|
ins_right {
|
||||||
'diff',
|
'diff',
|
||||||
-- Is it me or the symbol for modified us really weird
|
-- Is it me or the symbol for modified us really weird
|
||||||
symbols = { added = ' ', modified = '柳 ', removed = ' ' },
|
symbols = { added = ' ', modified = '柳 ', removed = ' ' },
|
||||||
|
@ -206,15 +206,15 @@ ins_right({
|
||||||
removed = { fg = colors.red },
|
removed = { fg = colors.red },
|
||||||
},
|
},
|
||||||
cond = conditions.hide_in_width,
|
cond = conditions.hide_in_width,
|
||||||
})
|
}
|
||||||
|
|
||||||
ins_right({
|
ins_right {
|
||||||
function()
|
function()
|
||||||
return '▊'
|
return '▊'
|
||||||
end,
|
end,
|
||||||
color = { fg = colors.blue },
|
color = { fg = colors.blue },
|
||||||
padding = { left = 1 },
|
padding = { left = 1 },
|
||||||
})
|
}
|
||||||
|
|
||||||
-- Now don't forget to initialize lualine
|
-- Now don't forget to initialize lualine
|
||||||
lualine.setup(config)
|
lualine.setup(config)
|
||||||
|
|
|
@ -55,7 +55,7 @@ local function search_result()
|
||||||
if not last_search or last_search == '' then
|
if not last_search or last_search == '' then
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
local searchcount = vim.fn.searchcount({ maxcount = 9999 })
|
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,13 +68,13 @@ local function modified()
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
|
|
||||||
require('lualine').setup({
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
theme = theme,
|
theme = theme,
|
||||||
component_separators = '',
|
component_separators = '',
|
||||||
section_separators = { left = '', right = '' },
|
section_separators = { left = '', right = '' },
|
||||||
},
|
},
|
||||||
sections = process_sections({
|
sections = process_sections {
|
||||||
lualine_a = { 'mode' },
|
lualine_a = { 'mode' },
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
'branch',
|
'branch',
|
||||||
|
@ -116,9 +116,9 @@ require('lualine').setup({
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
lualine_y = { search_result, 'filetype' },
|
lualine_y = { search_result, 'filetype' },
|
||||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||||
}),
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_c = { '%f %y %m' },
|
lualine_c = { '%f %y %m' },
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
-- Copyright (c) 2020-2021 hoob3rt
|
-- Copyright (c) 2020-2021 hoob3rt
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
highlight = 'lualine.highlight',
|
highlight = 'lualine.highlight',
|
||||||
loader = 'lualine.utils.loader',
|
loader = 'lualine.utils.loader',
|
||||||
utils_section = 'lualine.utils.section',
|
utils_section = 'lualine.utils.section',
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
utils_notices = 'lualine.utils.notices',
|
utils_notices = 'lualine.utils.notices',
|
||||||
config_module = 'lualine.config',
|
config_module = 'lualine.config',
|
||||||
})
|
}
|
||||||
local config -- Stores currently applied config
|
local config -- Stores currently applied config
|
||||||
local new_config = true -- Stores config that will be applied
|
local new_config = true -- Stores config that will be applied
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ function M:update_status()
|
||||||
local buffers = {}
|
local buffers = {}
|
||||||
for b = 1, vim.fn.bufnr('$') do
|
for b = 1, vim.fn.bufnr('$') do
|
||||||
if vim.fn.buflisted(b) ~= 0 and vim.api.nvim_buf_get_option(b, 'buftype') ~= 'quickfix' then
|
if vim.fn.buflisted(b) ~= 0 and vim.api.nvim_buf_get_option(b, 'buftype') ~= 'quickfix' then
|
||||||
buffers[#buffers + 1] = Buffer({ bufnr = b, options = self.options, highlights = self.highlights })
|
buffers[#buffers + 1] = Buffer { bufnr = b, options = self.options, highlights = self.highlights }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local current_bufnr = vim.api.nvim_get_current_buf()
|
local current_bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
@ -110,7 +110,7 @@ function M:update_status()
|
||||||
-- start drawing from current buffer and draw left and right of it until
|
-- start drawing from current buffer and draw left and right of it until
|
||||||
-- all buffers are drawn or max_length has been reached.
|
-- all buffers are drawn or max_length has been reached.
|
||||||
if current == -2 then
|
if current == -2 then
|
||||||
local b = Buffer({ bufnr = vim.api.nvim_get_current_buf(), options = self.options, highlights = self.highlights })
|
local b = Buffer { bufnr = vim.api.nvim_get_current_buf(), options = self.options, highlights = self.highlights }
|
||||||
b.current = true
|
b.current = true
|
||||||
if self.options.self.section < 'lualine_x' then
|
if self.options.self.section < 'lualine_x' then
|
||||||
b.last = true
|
b.last = true
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
-- Copyright (c) 2020-2021 hoob3rt
|
-- Copyright (c) 2020-2021 hoob3rt
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
default_config = 'lualine.components.diagnostics.config',
|
default_config = 'lualine.components.diagnostics.config',
|
||||||
sources = 'lualine.components.diagnostics.sources',
|
sources = 'lualine.components.diagnostics.sources',
|
||||||
highlight = 'lualine.highlight',
|
highlight = 'lualine.highlight',
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
utils_notices = 'lualine.utils.notices',
|
utils_notices = 'lualine.utils.notices',
|
||||||
})
|
}
|
||||||
|
|
||||||
local M = lualine_require.require('lualine.component'):extend()
|
local M = lualine_require.require('lualine.component'):extend()
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
Job = 'lualine.utils.job',
|
Job = 'lualine.utils.job',
|
||||||
})
|
}
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
-- Copyright (c) 2020-2021 shadmansaleh
|
-- Copyright (c) 2020-2021 shadmansaleh
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
git_diff = 'lualine.components.diff.git_diff',
|
git_diff = 'lualine.components.diff.git_diff',
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
utils_notices = 'lualine.utils.notices',
|
utils_notices = 'lualine.utils.notices',
|
||||||
highlight = 'lualine.highlight',
|
highlight = 'lualine.highlight',
|
||||||
})
|
}
|
||||||
local M = lualine_require.require('lualine.component'):extend()
|
local M = lualine_require.require('lualine.component'):extend()
|
||||||
|
|
||||||
local default_options = {
|
local default_options = {
|
||||||
|
@ -81,7 +81,7 @@ function M:update_status(is_focused)
|
||||||
|
|
||||||
local result = {}
|
local result = {}
|
||||||
-- loop though data and load available sections in result table
|
-- 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 git_diff[name] and git_diff[name] > 0 then
|
||||||
if self.options.colored then
|
if self.options.colored then
|
||||||
table.insert(result, colors[name] .. self.options.symbols[name] .. git_diff[name])
|
table.insert(result, colors[name] .. self.options.symbols[name] .. git_diff[name])
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
-- Copyright (c) 2020-2021 hoob3rt
|
-- Copyright (c) 2020-2021 hoob3rt
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
highlight = 'lualine.highlight',
|
highlight = 'lualine.highlight',
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
})
|
}
|
||||||
local M = lualine_require.require('lualine.component'):extend()
|
local M = lualine_require.require('lualine.component'):extend()
|
||||||
|
|
||||||
local default_options = {
|
local default_options = {
|
||||||
|
|
|
@ -58,7 +58,7 @@ function M:update_status()
|
||||||
local data = {}
|
local data = {}
|
||||||
local tabs = {}
|
local tabs = {}
|
||||||
for t = 1, vim.fn.tabpagenr('$') do
|
for t = 1, vim.fn.tabpagenr('$') do
|
||||||
tabs[#tabs + 1] = Tab({ tabnr = t, options = self.options, highlights = self.highlights })
|
tabs[#tabs + 1] = Tab { tabnr = t, options = self.options, highlights = self.highlights }
|
||||||
end
|
end
|
||||||
-- mark the first, last, current, before current, after current tabpages
|
-- mark the first, last, current, before current, after current tabpages
|
||||||
-- for rendering
|
-- for rendering
|
||||||
|
@ -93,7 +93,7 @@ function M:update_status()
|
||||||
-- start drawing from current tab and draw left and right of it until
|
-- start drawing from current tab and draw left and right of it until
|
||||||
-- all tabpages are drawn or max_length has been reached.
|
-- all tabpages are drawn or max_length has been reached.
|
||||||
if current_tab == nil then -- maybe redundent code
|
if current_tab == nil then -- maybe redundent code
|
||||||
local t = Tab({ tabnr = vim.fn.tabpagenr(), options = self.options, highlights = self.highlights })
|
local t = Tab { tabnr = vim.fn.tabpagenr(), options = self.options, highlights = self.highlights }
|
||||||
t.current = true
|
t.current = true
|
||||||
t.last = true
|
t.last = true
|
||||||
data[#data + 1] = t:render()
|
data[#data + 1] = t:render()
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local require = lualine_require.require
|
local require = lualine_require.require
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
color_utils = 'lualine.utils.color_utils',
|
color_utils = 'lualine.utils.color_utils',
|
||||||
})
|
}
|
||||||
|
|
||||||
local section_highlight_map = { x = 'c', y = 'b', z = 'a' }
|
local section_highlight_map = { x = 'c', y = 'b', z = 'a' }
|
||||||
local active_theme = nil
|
local active_theme = nil
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
|
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
utils_notices = 'lualine.utils.notices',
|
utils_notices = 'lualine.utils.notices',
|
||||||
})
|
}
|
||||||
local sep = package.config:sub(1, 1)
|
local sep = package.config:sub(1, 1)
|
||||||
local wal_colors_path = table.concat({ os.getenv('HOME'), '.cache', 'wal', 'colors.sh' }, sep)
|
local wal_colors_path = table.concat({ os.getenv('HOME'), '.cache', 'wal', 'colors.sh' }, sep)
|
||||||
local wal_colors_file = io.open(wal_colors_path, 'r')
|
local wal_colors_file = io.open(wal_colors_path, 'r')
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
local lualine_require = require('lualine_require')
|
local lualine_require = require('lualine_require')
|
||||||
local require = lualine_require.require
|
local require = lualine_require.require
|
||||||
local modules = lualine_require.lazy_require({
|
local modules = lualine_require.lazy_require {
|
||||||
utils = 'lualine.utils.utils',
|
utils = 'lualine.utils.utils',
|
||||||
notice = 'lualine.utils.notices',
|
notice = 'lualine.utils.notices',
|
||||||
})
|
}
|
||||||
local is_valid_filename = lualine_require.is_valid_filename
|
local is_valid_filename = lualine_require.is_valid_filename
|
||||||
local sep = lualine_require.sep
|
local sep = lualine_require.sep
|
||||||
|
|
||||||
|
@ -213,10 +213,10 @@ end
|
||||||
local function load_theme(theme_name)
|
local function load_theme(theme_name)
|
||||||
assert(is_valid_filename(theme_name), 'Invalid filename')
|
assert(is_valid_filename(theme_name), 'Invalid filename')
|
||||||
local retval
|
local retval
|
||||||
local path = table.concat({ 'lua/lualine/themes/', theme_name, '.lua' })
|
local path = table.concat { 'lua/lualine/themes/', theme_name, '.lua' }
|
||||||
local files = vim.api.nvim_get_runtime_file(path, true)
|
local files = vim.api.nvim_get_runtime_file(path, true)
|
||||||
if #files <= 0 then
|
if #files <= 0 then
|
||||||
path = table.concat({ 'lua/lualine/themes/', theme_name, '/init.lua' })
|
path = table.concat { 'lua/lualine/themes/', theme_name, '/init.lua' }
|
||||||
files = vim.api.nvim_get_runtime_file(path, true)
|
files = vim.api.nvim_get_runtime_file(path, true)
|
||||||
end
|
end
|
||||||
local n_files = #files
|
local n_files = #files
|
||||||
|
|
|
@ -53,10 +53,10 @@ function M.require(module)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pattern_path = table.concat({ 'lua/', module:gsub('%.', '/'), '.lua' })
|
pattern_path = table.concat { 'lua/', module:gsub('%.', '/'), '.lua' }
|
||||||
local paths = vim.api.nvim_get_runtime_file(pattern_path, false)
|
local paths = vim.api.nvim_get_runtime_file(pattern_path, false)
|
||||||
if #paths <= 0 then
|
if #paths <= 0 then
|
||||||
pattern_path = table.concat({ 'lua/', module:gsub('%.', '/'), '/init.lua' })
|
pattern_path = table.concat { 'lua/', module:gsub('%.', '/'), '/init.lua' }
|
||||||
paths = vim.api.nvim_get_runtime_file(pattern_path, false)
|
paths = vim.api.nvim_get_runtime_file(pattern_path, false)
|
||||||
end
|
end
|
||||||
if #paths > 0 then
|
if #paths > 0 then
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('Component:', function()
|
||||||
local comp = require('lualine.components.special.function_component')(opts)
|
local comp = require('lualine.components.special.function_component')(opts)
|
||||||
-- correct for lualine_c
|
-- correct for lualine_c
|
||||||
eq('', comp.options.separator)
|
eq('', comp.options.separator)
|
||||||
local opts2 = build_component_opts({ self = { section = 'lualine_y' } })
|
local opts2 = build_component_opts { self = { section = 'lualine_y' } }
|
||||||
local comp2 = require('lualine.components.special.function_component')(opts2)
|
local comp2 = require('lualine.components.special.function_component')(opts2)
|
||||||
-- correct for lualine_u
|
-- correct for lualine_u
|
||||||
eq('', comp2.options.separator)
|
eq('', comp2.options.separator)
|
||||||
|
@ -31,7 +31,7 @@ describe('Component:', function()
|
||||||
|
|
||||||
it('create option highlights', function()
|
it('create option highlights', function()
|
||||||
local color = { fg = '#224532', bg = '#892345' }
|
local color = { fg = '#224532', bg = '#892345' }
|
||||||
local opts1 = build_component_opts({ color = color })
|
local opts1 = build_component_opts { color = color }
|
||||||
local hl = require('lualine.highlight')
|
local hl = require('lualine.highlight')
|
||||||
stub(hl, 'create_component_highlight_group')
|
stub(hl, 'create_component_highlight_group')
|
||||||
hl.create_component_highlight_group.returns('MyCompHl')
|
hl.create_component_highlight_group.returns('MyCompHl')
|
||||||
|
@ -43,7 +43,7 @@ describe('Component:', function()
|
||||||
assert.stub(hl.create_component_highlight_group).was_called_with(color, comp1.options.component_name, comp1.options)
|
assert.stub(hl.create_component_highlight_group).was_called_with(color, comp1.options.component_name, comp1.options)
|
||||||
hl.create_component_highlight_group:revert()
|
hl.create_component_highlight_group:revert()
|
||||||
color = 'MyHl'
|
color = 'MyHl'
|
||||||
local opts2 = build_component_opts({ color = color })
|
local opts2 = build_component_opts { color = color }
|
||||||
stub(hl, 'create_component_highlight_group')
|
stub(hl, 'create_component_highlight_group')
|
||||||
hl.create_component_highlight_group.returns('MyCompLinkedHl')
|
hl.create_component_highlight_group.returns('MyCompLinkedHl')
|
||||||
local comp2 = require('lualine.components.special.function_component')(opts2)
|
local comp2 = require('lualine.components.special.function_component')(opts2)
|
||||||
|
@ -56,143 +56,143 @@ describe('Component:', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can draw', function()
|
it('can draw', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, 'test')
|
assert_component(nil, opts, 'test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can apply separators', function()
|
it('can apply separators', function()
|
||||||
local opts = build_component_opts({ padding = 0 })
|
local opts = build_component_opts { padding = 0 }
|
||||||
assert_component(nil, opts, 'test')
|
assert_component(nil, opts, 'test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can apply default highlight', function()
|
it('can apply default highlight', function()
|
||||||
local opts = build_component_opts({ padding = 0, hl = '%#My_highlight#' })
|
local opts = build_component_opts { padding = 0, hl = '%#My_highlight#' }
|
||||||
assert_component(nil, opts, '%#My_highlight#test')
|
assert_component(nil, opts, '%#My_highlight#test')
|
||||||
opts = build_component_opts({
|
opts = build_component_opts {
|
||||||
function()
|
function()
|
||||||
return '%#Custom_hl#test'
|
return '%#Custom_hl#test'
|
||||||
end,
|
end,
|
||||||
padding = 0,
|
padding = 0,
|
||||||
hl = '%#My_highlight#',
|
hl = '%#My_highlight#',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, '%#Custom_hl#test%#My_highlight#')
|
assert_component(nil, opts, '%#Custom_hl#test%#My_highlight#')
|
||||||
opts = build_component_opts({
|
opts = build_component_opts {
|
||||||
function()
|
function()
|
||||||
return 'in middle%#Custom_hl#test'
|
return 'in middle%#Custom_hl#test'
|
||||||
end,
|
end,
|
||||||
padding = 0,
|
padding = 0,
|
||||||
hl = '%#My_highlight#',
|
hl = '%#My_highlight#',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, '%#My_highlight#in middle%#Custom_hl#test%#My_highlight#')
|
assert_component(nil, opts, '%#My_highlight#in middle%#Custom_hl#test%#My_highlight#')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('Global options:', function()
|
describe('Global options:', function()
|
||||||
it('left_padding', function()
|
it('left_padding', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = { left = 5 },
|
padding = { left = 5 },
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, ' test')
|
assert_component(nil, opts, ' test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('right_padding', function()
|
it('right_padding', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = { right = 5 },
|
padding = { right = 5 },
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, 'test ')
|
assert_component(nil, opts, 'test ')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('padding', function()
|
it('padding', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 5,
|
padding = 5,
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, ' test ')
|
assert_component(nil, opts, ' test ')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('icon', function()
|
it('icon', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
icon = '0',
|
icon = '0',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, '0 test')
|
assert_component(nil, opts, '0 test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('icons_enabled', function()
|
it('icons_enabled', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
icon = '0',
|
icon = '0',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, '0 test')
|
assert_component(nil, opts, '0 test')
|
||||||
local opts2 = build_component_opts({
|
local opts2 = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
icons_enabled = false,
|
icons_enabled = false,
|
||||||
icon = '0',
|
icon = '0',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts2, 'test')
|
assert_component(nil, opts2, 'test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('separator', function()
|
it('separator', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
separator = '|',
|
separator = '|',
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, 'test|')
|
assert_component(nil, opts, 'test|')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fmt', function()
|
it('fmt', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
fmt = function(data)
|
fmt = function(data)
|
||||||
return data:sub(1, 1):upper() .. data:sub(2, #data)
|
return data:sub(1, 1):upper() .. data:sub(2, #data)
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, 'Test')
|
assert_component(nil, opts, 'Test')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cond', function()
|
it('cond', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
cond = function()
|
cond = function()
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
assert_component(nil, opts, 'test')
|
assert_component(nil, opts, 'test')
|
||||||
local opts2 = build_component_opts({
|
local opts2 = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
cond = function()
|
cond = function()
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
assert_component(nil, opts2, '')
|
assert_component(nil, opts2, '')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('color', function()
|
it('color', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
color = 'MyHl',
|
color = 'MyHl',
|
||||||
})
|
}
|
||||||
local comp = require('lualine.components.special.function_component')(opts)
|
local comp = require('lualine.components.special.function_component')(opts)
|
||||||
local custom_link_hl_name = 'lualine_' .. comp.options.component_name .. '_no_mode'
|
local custom_link_hl_name = 'lualine_' .. comp.options.component_name .. '_no_mode'
|
||||||
eq('%#' .. custom_link_hl_name .. '#test', comp:draw(opts.hl))
|
eq('%#' .. custom_link_hl_name .. '#test', comp:draw(opts.hl))
|
||||||
local opts2 = build_component_opts({
|
local opts2 = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
color = { bg = '#230055', fg = '#223344' },
|
color = { bg = '#230055', fg = '#223344' },
|
||||||
})
|
}
|
||||||
local hl = require('lualine.highlight')
|
local hl = require('lualine.highlight')
|
||||||
stub(hl, 'component_format_highlight')
|
stub(hl, 'component_format_highlight')
|
||||||
hl.component_format_highlight.returns('%#MyCompHl#')
|
hl.component_format_highlight.returns('%#MyCompHl#')
|
||||||
|
@ -206,10 +206,10 @@ end)
|
||||||
|
|
||||||
describe('Encoding component', function()
|
describe('Encoding component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
local tmp_path = 'tmp.txt'
|
local tmp_path = 'tmp.txt'
|
||||||
local tmp_fp = io.open(tmp_path, 'w')
|
local tmp_fp = io.open(tmp_path, 'w')
|
||||||
tmp_fp:write('test file')
|
tmp_fp:write('test file')
|
||||||
|
@ -223,10 +223,10 @@ end)
|
||||||
|
|
||||||
describe('Fileformat component', function()
|
describe('Fileformat component', function()
|
||||||
it('works with icons', function()
|
it('works with icons', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
local fmt = vim.bo.fileformat
|
local fmt = vim.bo.fileformat
|
||||||
vim.bo.fileformat = 'unix'
|
vim.bo.fileformat = 'unix'
|
||||||
assert_component('fileformat', opts, '')
|
assert_component('fileformat', opts, '')
|
||||||
|
@ -237,11 +237,11 @@ describe('Fileformat component', function()
|
||||||
vim.bo.fileformat = fmt
|
vim.bo.fileformat = fmt
|
||||||
end)
|
end)
|
||||||
it('works without icons', function()
|
it('works without icons', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
icons_enabled = false,
|
icons_enabled = false,
|
||||||
})
|
}
|
||||||
assert_component('fileformat', opts, vim.bo.fileformat)
|
assert_component('fileformat', opts, vim.bo.fileformat)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -266,10 +266,10 @@ describe('Filetype component', function()
|
||||||
end
|
end
|
||||||
return old_require(...)
|
return old_require(...)
|
||||||
end
|
end
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component('filetype', opts, 'lua')
|
assert_component('filetype', opts, 'lua')
|
||||||
_G.require = old_require
|
_G.require = old_require
|
||||||
end)
|
end)
|
||||||
|
@ -288,12 +288,12 @@ describe('Filetype component', function()
|
||||||
hl.create_component_highlight_group.returns('MyCompHl')
|
hl.create_component_highlight_group.returns('MyCompHl')
|
||||||
utils.extract_highlight_colors.returns('#000')
|
utils.extract_highlight_colors.returns('#000')
|
||||||
|
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
colored = true,
|
colored = true,
|
||||||
icon_only = false,
|
icon_only = false,
|
||||||
})
|
}
|
||||||
assert_component('filetype', opts, '%#MyCompHl_normal#*%#lualine_c_normal# lua')
|
assert_component('filetype', opts, '%#MyCompHl_normal#*%#lualine_c_normal# lua')
|
||||||
assert.stub(utils.extract_highlight_colors).was_called_with('test_highlight_group', 'fg')
|
assert.stub(utils.extract_highlight_colors).was_called_with('test_highlight_group', 'fg')
|
||||||
assert.stub(hl.create_component_highlight_group).was_called_with({ fg = '#000' }, 'test_highlight_group', opts)
|
assert.stub(hl.create_component_highlight_group).was_called_with({ fg = '#000' }, 'test_highlight_group', opts)
|
||||||
|
@ -314,11 +314,11 @@ describe('Filetype component', function()
|
||||||
stub(utils, 'extract_highlight_colors')
|
stub(utils, 'extract_highlight_colors')
|
||||||
hl.create_component_highlight_group.returns('MyCompHl')
|
hl.create_component_highlight_group.returns('MyCompHl')
|
||||||
utils.extract_highlight_colors.returns('#000')
|
utils.extract_highlight_colors.returns('#000')
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
colored = false,
|
colored = false,
|
||||||
})
|
}
|
||||||
assert_component('filetype', opts, '* lua')
|
assert_component('filetype', opts, '* lua')
|
||||||
hl.create_component_highlight_group:revert()
|
hl.create_component_highlight_group:revert()
|
||||||
utils.extract_highlight_colors:revert()
|
utils.extract_highlight_colors:revert()
|
||||||
|
@ -332,12 +332,12 @@ describe('Filetype component', function()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
colored = false,
|
colored = false,
|
||||||
icon_only = true,
|
icon_only = true,
|
||||||
})
|
}
|
||||||
assert_component('filetype', opts, '*')
|
assert_component('filetype', opts, '*')
|
||||||
package.loaded['nvim-web-devicons'] = nil
|
package.loaded['nvim-web-devicons'] = nil
|
||||||
end)
|
end)
|
||||||
|
@ -347,10 +347,10 @@ describe('Hostname component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
stub(vim.loop, 'os_gethostname')
|
stub(vim.loop, 'os_gethostname')
|
||||||
vim.loop.os_gethostname.returns('localhost')
|
vim.loop.os_gethostname.returns('localhost')
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component('hostname', opts, 'localhost')
|
assert_component('hostname', opts, 'localhost')
|
||||||
vim.loop.os_gethostname:revert()
|
vim.loop.os_gethostname:revert()
|
||||||
end)
|
end)
|
||||||
|
@ -358,20 +358,20 @@ end)
|
||||||
|
|
||||||
describe('Location component', function()
|
describe('Location component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component('location', opts, '%3l:%-2v')
|
assert_component('location', opts, '%3l:%-2v')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('Progress component', function()
|
describe('Progress component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component('progress', opts, '%3p%%')
|
assert_component('progress', opts, '%3p%%')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -379,11 +379,11 @@ end)
|
||||||
describe('Mode component', function()
|
describe('Mode component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
stub(vim.api, 'nvim_get_mode')
|
stub(vim.api, 'nvim_get_mode')
|
||||||
vim.api.nvim_get_mode.returns({ mode = 'n', blocking = false })
|
vim.api.nvim_get_mode.returns { mode = 'n', blocking = false }
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
assert_component('mode', opts, 'NORMAL')
|
assert_component('mode', opts, 'NORMAL')
|
||||||
vim.api.nvim_get_mode:revert()
|
vim.api.nvim_get_mode:revert()
|
||||||
end)
|
end)
|
||||||
|
@ -391,10 +391,10 @@ end)
|
||||||
|
|
||||||
describe('FileSize component', function()
|
describe('FileSize component', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
local fname = 'test-file.txt'
|
local fname = 'test-file.txt'
|
||||||
local f = io.open(fname, 'w')
|
local f = io.open(fname, 'w')
|
||||||
f:write(string.rep('........................................\n', 200))
|
f:write(string.rep('........................................\n', 200))
|
||||||
|
@ -421,24 +421,24 @@ describe('Filename component', function()
|
||||||
end
|
end
|
||||||
|
|
||||||
it('works', function()
|
it('works', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
file_status = false,
|
file_status = false,
|
||||||
path = 0,
|
path = 0,
|
||||||
})
|
}
|
||||||
vim.cmd(':e test-file.txt')
|
vim.cmd(':e test-file.txt')
|
||||||
assert_component('filename', opts, 'test-file.txt')
|
assert_component('filename', opts, 'test-file.txt')
|
||||||
vim.cmd(':bdelete!')
|
vim.cmd(':bdelete!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can show file_status', function()
|
it('can show file_status', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
file_status = true,
|
file_status = true,
|
||||||
path = 0,
|
path = 0,
|
||||||
})
|
}
|
||||||
vim.cmd(':e test-file.txt')
|
vim.cmd(':e test-file.txt')
|
||||||
vim.bo.modified = false
|
vim.bo.modified = false
|
||||||
assert_component('filename', opts, 'test-file.txt')
|
assert_component('filename', opts, 'test-file.txt')
|
||||||
|
@ -451,24 +451,24 @@ describe('Filename component', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can show relative path', function()
|
it('can show relative path', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
file_status = false,
|
file_status = false,
|
||||||
path = 1,
|
path = 1,
|
||||||
})
|
}
|
||||||
vim.cmd(':e test-file.txt')
|
vim.cmd(':e test-file.txt')
|
||||||
assert_component('filename', opts, shorten_path(vim.fn.expand('%:~:.')))
|
assert_component('filename', opts, shorten_path(vim.fn.expand('%:~:.')))
|
||||||
vim.cmd(':bdelete!')
|
vim.cmd(':bdelete!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can show full path', function()
|
it('can show full path', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
file_status = false,
|
file_status = false,
|
||||||
path = 2,
|
path = 2,
|
||||||
})
|
}
|
||||||
vim.cmd(':e test-file.txt')
|
vim.cmd(':e test-file.txt')
|
||||||
assert_component('filename', opts, shorten_path(vim.fn.expand('%:p')))
|
assert_component('filename', opts, shorten_path(vim.fn.expand('%:p')))
|
||||||
vim.cmd(':bdelete!')
|
vim.cmd(':bdelete!')
|
||||||
|
@ -476,10 +476,10 @@ describe('Filename component', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('vim option & variable component', function()
|
describe('vim option & variable component', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
|
|
||||||
local function assert_vim_var_component(name, options, result)
|
local function assert_vim_var_component(name, options, result)
|
||||||
options[1] = name
|
options[1] = name
|
||||||
|
@ -514,10 +514,10 @@ describe('vim option & variable component', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('Vim option & variable component', function()
|
describe('Vim option & variable component', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
|
|
||||||
local function assert_vim_var_component(name, options, result)
|
local function assert_vim_var_component(name, options, result)
|
||||||
options[1] = name
|
options[1] = name
|
||||||
|
@ -569,10 +569,10 @@ describe('Branch component', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with regular branches', function()
|
it('works with regular branches', function()
|
||||||
local opts = build_component_opts({
|
local opts = build_component_opts {
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
padding = 0,
|
padding = 0,
|
||||||
})
|
}
|
||||||
local branch_comp = helpers.init_component('branch', opts)
|
local branch_comp = helpers.init_component('branch', opts)
|
||||||
vim.cmd('e ' .. file)
|
vim.cmd('e ' .. file)
|
||||||
assert_comp_ins(branch_comp, ' test_branch')
|
assert_comp_ins(branch_comp, ' test_branch')
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe('config parsing', function()
|
||||||
describe('options', function()
|
describe('options', function()
|
||||||
describe('icons_enabled', function()
|
describe('icons_enabled', function()
|
||||||
it('default', function()
|
it('default', function()
|
||||||
local config = config_module.apply_configuration({})
|
local config = config_module.apply_configuration {}
|
||||||
eq(config.options.icons_enabled, true)
|
eq(config.options.icons_enabled, true)
|
||||||
end)
|
end)
|
||||||
it('custom', function()
|
it('custom', function()
|
||||||
|
@ -21,7 +21,7 @@ describe('config parsing', function()
|
||||||
|
|
||||||
describe('theme', function()
|
describe('theme', function()
|
||||||
it('default', function()
|
it('default', function()
|
||||||
local config = config_module.apply_configuration({})
|
local config = config_module.apply_configuration {}
|
||||||
eq(config.options.theme, 'auto')
|
eq(config.options.theme, 'auto')
|
||||||
end)
|
end)
|
||||||
it('custom', function()
|
it('custom', function()
|
||||||
|
@ -36,7 +36,7 @@ describe('config parsing', function()
|
||||||
|
|
||||||
describe('separators', function()
|
describe('separators', function()
|
||||||
it('default', function()
|
it('default', function()
|
||||||
local config = config_module.apply_configuration({})
|
local config = config_module.apply_configuration {}
|
||||||
eq(config.options.component_separators, { left = '', right = '' })
|
eq(config.options.component_separators, { left = '', right = '' })
|
||||||
eq(config.options.section_separators, { left = '', right = '' })
|
eq(config.options.section_separators, { left = '', right = '' })
|
||||||
end)
|
end)
|
||||||
|
@ -85,7 +85,7 @@ describe('config parsing', function()
|
||||||
|
|
||||||
describe('disabled filetypes', function()
|
describe('disabled filetypes', function()
|
||||||
it('default', function()
|
it('default', function()
|
||||||
local config = config_module.apply_configuration({})
|
local config = config_module.apply_configuration {}
|
||||||
eq(config.options.disabled_filetypes, {})
|
eq(config.options.disabled_filetypes, {})
|
||||||
end)
|
end)
|
||||||
it('custom', function()
|
it('custom', function()
|
||||||
|
|
|
@ -57,7 +57,7 @@ end)
|
||||||
describe('Section genarator', function()
|
describe('Section genarator', function()
|
||||||
local sec = require('lualine.utils.section')
|
local sec = require('lualine.utils.section')
|
||||||
it('can draw', function()
|
it('can draw', function()
|
||||||
local opts = build_component_opts({ section_separators = { left = '', right = '' } })
|
local opts = build_component_opts { section_separators = { left = '', right = '' } }
|
||||||
local section = {
|
local section = {
|
||||||
require('lualine.components.special.function_component')(opts),
|
require('lualine.components.special.function_component')(opts),
|
||||||
require('lualine.components.special.function_component')(opts),
|
require('lualine.components.special.function_component')(opts),
|
||||||
|
@ -66,16 +66,16 @@ describe('Section genarator', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can remove separators from component with custom colors', function()
|
it('can remove separators from component with custom colors', function()
|
||||||
local opts = build_component_opts({ section_separators = { left = '', right = '' } })
|
local opts = build_component_opts { section_separators = { left = '', right = '' } }
|
||||||
local opts_colored = build_component_opts({ color = 'MyColor' })
|
local opts_colored = build_component_opts { color = 'MyColor' }
|
||||||
local opts_colored2 = build_component_opts({
|
local opts_colored2 = build_component_opts {
|
||||||
color = { bg = '#223344' },
|
color = { bg = '#223344' },
|
||||||
section_separators = { left = '', right = '' },
|
section_separators = { left = '', right = '' },
|
||||||
})
|
}
|
||||||
local opts_colored3 = build_component_opts({
|
local opts_colored3 = build_component_opts {
|
||||||
color = { fg = '#223344' },
|
color = { fg = '#223344' },
|
||||||
section_separators = { left = '', right = '' },
|
section_separators = { left = '', right = '' },
|
||||||
})
|
}
|
||||||
require('lualine.highlight').create_highlight_groups(require('lualine.themes.gruvbox'))
|
require('lualine.highlight').create_highlight_groups(require('lualine.themes.gruvbox'))
|
||||||
local section = {
|
local section = {
|
||||||
require('lualine.components.special.function_component')(opts),
|
require('lualine.components.special.function_component')(opts),
|
||||||
|
|
Loading…
Reference in New Issue