From 6bb1f80a987c7ff4a5d6c8e6e74928adfdcab241 Mon Sep 17 00:00:00 2001 From: Zhizhen He Date: Thu, 30 Mar 2023 12:12:37 +0800 Subject: [PATCH] fix: typo (#997) --- CONTRIBUTING.md | 2 +- README.md | 6 +++--- THEMES.md | 2 +- examples/evil_lualine.lua | 2 +- lua/lualine.lua | 2 +- lua/lualine/component.lua | 2 +- lua/lualine/components/diff/git_diff.lua | 4 ++-- lua/lualine/highlight.lua | 4 ++-- lua/lualine/themes/auto.lua | 22 ++++++++++------------ lua/lualine/utils/fn_store.lua | 2 +- lua/lualine/utils/loader.lua | 2 +- lua/lualine/utils/section.lua | 16 ++++++++-------- lua/lualine/utils/utils.lua | 4 ++-- lua/lualine_require.lua | 2 +- tests/helpers.lua | 2 +- tests/spec/component_spec.lua | 2 +- tests/spec/config_spec.lua | 2 +- tests/spec/lualine_spec.lua | 6 +++--- tests/spec/utils_spec.lua | 6 +++--- tests/statusline.lua | 2 +- 20 files changed, 45 insertions(+), 47 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d9d37e..53857ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ Good luck! *Let's introduce you to the tools we use.* - Your PR needs to pass tests & linter. We lint our codebase with [luacheck](https://github.com/mpeterv/luacheck) - and run tests with [plenary-test][plenary.nvim] these will be ran on CI. If you want you can run tests & linter + and run tests with [plenary-test][plenary.nvim] these will be run on CI. If you want you can run tests & linter locally with `make test` & `make lint` respectively. Or `make check` to run both linter & tests. For running tests you'll have to make sure lualine.nvim, [plenary.nvim][plenary.nvim] and [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) are in same directory. diff --git a/README.md b/README.md index e6eade5..8094df9 100644 --- a/README.md +++ b/README.md @@ -470,7 +470,7 @@ sections = { #### Component specific options These are options that are available on specific components. -For example you have option on `diagnostics` component to +For example, you have option on `diagnostics` component to specify what your diagnostic sources will be. #### buffers component options @@ -867,7 +867,7 @@ require('lualine').setup { extensions = { my_extension } } ### Refreshing lualine By default lualine refreshes itself based on timer and some events. You can set the interval of the timer with refresh option. However you can also force -lualine to refresh at any time by calling lualine.refresh function. +lualine to refresh at any time by calling `lualine.refresh` function. ```lua require('lualine').refresh({ scope = 'tabpage', -- scope of refresh all/tabpage/window @@ -882,7 +882,7 @@ So you can simply do require('lualine').refresh() ``` -Avoid calling lualine.refresh inside components. Since components are evaluated +Avoid calling `lualine.refresh` inside components. Since components are evaluated during refresh, calling refresh while refreshing can have undesirable effects. ### Disabling lualine diff --git a/THEMES.md b/THEMES.md index 6aba355..184bfc7 100644 --- a/THEMES.md +++ b/THEMES.md @@ -54,7 +54,7 @@ But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when ### base16 -This theme will automatically uses colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin. +This theme will automatically use colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin. The following example is using the `tomorrow-night` colorscheme:

diff --git a/examples/evil_lualine.lua b/examples/evil_lualine.lua index a5be3da..2515520 100644 --- a/examples/evil_lualine.lua +++ b/examples/evil_lualine.lua @@ -73,7 +73,7 @@ local function ins_left(component) table.insert(config.sections.lualine_c, component) end --- Inserts a component in lualine_x ot right section +-- Inserts a component in lualine_x at right section local function ins_right(component) table.insert(config.sections.lualine_x, component) end diff --git a/lua/lualine.lua b/lua/lualine.lua index 435547f..2a87dd7 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -358,7 +358,7 @@ local function refresh(opts) local wins = {} local old_actual_curwin = vim.g.actual_curwin - -- ignore focus on filetypes listes in options.ignore_focus + -- ignore focus on filetypes listed in options.ignore_focus local curwin = vim.api.nvim_get_current_win() local curtab = vim.api.nvim_get_current_tabpage() if last_focus[curtab] == nil or not vim.api.nvim_win_is_valid(last_focus[curtab]) then diff --git a/lua/lualine/component.lua b/lua/lualine/component.lua index a4d9d9b..e985509 100644 --- a/lua/lualine/component.lua +++ b/lua/lualine/component.lua @@ -201,7 +201,7 @@ function M:apply_section_separators() end end ----Add on click funtion description to already drawn item +---Add on click function description to already drawn item function M:apply_on_click() if self.on_click_id then self.status = self:format_fn(self.on_click_id, self.status) diff --git a/lua/lualine/components/diff/git_diff.lua b/lua/lualine/components/diff/git_diff.lua index 6879001..a460f8f 100644 --- a/lua/lualine/components/diff/git_diff.lua +++ b/lua/lualine/components/diff/git_diff.lua @@ -84,7 +84,7 @@ end ---updates the job args function M.update_diff_args() - -- Donn't show git diff when current buffer doesn't have a filename + -- Don't show git diff when current buffer doesn't have a filename active_bufnr = tostring(vim.api.nvim_get_current_buf()) if #vim.fn.expand('%') == 0 then M.diff_args = nil @@ -121,7 +121,7 @@ function M.update_diff_args() M.update_git_diff() end ----update git_diff veriable +---update git_diff variable function M.update_git_diff() if M.diff_args then diff_output_cache = {} diff --git a/lua/lualine/highlight.lua b/lua/lualine/highlight.lua index f297d8b..a30b15c 100644 --- a/lua/lualine/highlight.lua +++ b/lua/lualine/highlight.lua @@ -183,7 +183,7 @@ function M.highlight(name, foreground, background, gui, link) } end ----Attach a hl to another, so the attachee auto updates on change to hl that it's attached too. +---Attach a hl to another, so the attached auto updates on change to hl that it's attached too. ---@param provider string the hl receiver is getting attached to ---@param receiver string the hl that will be auto updated upon change to provider ---@param provider_el_type string (fg/bg) what element receiver relates to of provider @@ -328,7 +328,7 @@ function M.create_component_highlight_group(color, highlight_tag, options, apply end if type(color) ~= 'function' and (apply_no_default or (color.bg and color.fg)) then - -- When bg and fg are both present we donn't need to set highlighs for + -- When bg and fg are both present we don't need to set highlights for -- each mode as they will surely look the same. So we can work without options local highlight_group_name = table.concat({ 'lualine', section, highlight_tag }, '_') M.highlight(highlight_group_name, color.fg, color.bg, color.gui, nil) diff --git a/lua/lualine/themes/auto.lua b/lua/lualine/themes/auto.lua index 9f2339d..fe106bd 100644 --- a/lua/lualine/themes/auto.lua +++ b/lua/lualine/themes/auto.lua @@ -70,11 +70,11 @@ local function clamp(val, left, right) end -- Changes brightness of rgb_color by percentage -local function brightness_modifier(rgb_color, parcentage) +local function brightness_modifier(rgb_color, percentage) local color = rgb_str2num(rgb_color) - color.red = clamp(color.red + (color.red * parcentage / 100), 0, 255) - color.green = clamp(color.green + (color.green * parcentage / 100), 0, 255) - color.blue = clamp(color.blue + (color.blue * parcentage / 100), 0, 255) + color.red = clamp(color.red + (color.red * percentage / 100), 0, 255) + color.green = clamp(color.green + (color.green * percentage / 100), 0, 255) + color.blue = clamp(color.blue + (color.blue * percentage / 100), 0, 255) return rgb_num2str(color) end @@ -90,19 +90,17 @@ end -- Changes brightness of foreground color to achieve contrast -- without changing the color local function apply_contrast(highlight) - local hightlight_bg_avg = get_color_avg(highlight.bg) + local highlight_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 > 0.5 then - contranst_change_step = -contranst_change_step + local contrast_change_step = 5 + if highlight_bg_avg > 0.5 then + contrast_change_step = -contrast_change_step end -- Don't waste too much time here max 25 iteration 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 - highlight.fg = contrast_modifier(highlight.fg, contranst_change_step) + while math.abs(get_color_avg(highlight.fg) - highlight_bg_avg) < contrast_threshold_config and iteration_count < 25 do + highlight.fg = contrast_modifier(highlight.fg, contrast_change_step) iteration_count = iteration_count + 1 end end diff --git a/lua/lualine/utils/fn_store.lua b/lua/lualine/utils/fn_store.lua index 8bceeef..a3b59ae 100644 --- a/lua/lualine/utils/fn_store.lua +++ b/lua/lualine/utils/fn_store.lua @@ -15,7 +15,7 @@ function M.register_fn(id, fn) end ---Get the function with id ----@param id number id of the fn to retrive +---@param id number id of the fn to retrieve ---@return function function M.get_fn(id) vim.validate { id = { id, 'n' } } diff --git a/lua/lualine/utils/loader.lua b/lua/lualine/utils/loader.lua index 3eba13b..37baa01 100644 --- a/lua/lualine/utils/loader.lua +++ b/lua/lualine/utils/loader.lua @@ -243,7 +243,7 @@ local function load_theme(theme_name) end if not file_found then -- This shouldn't happen but somehow we have multiple files but they - -- apear to be in lualines repo . Just run the first one + -- appear to be in lualines repo . Just run the first one retval = dofile(files[1]) end end diff --git a/lua/lualine/utils/section.lua b/lua/lualine/utils/section.lua index a288f10..1521a02 100644 --- a/lua/lualine/utils/section.lua +++ b/lua/lualine/utils/section.lua @@ -12,7 +12,7 @@ local highlight = require('lualine.highlight') ---@param section table list of components ---@param section_name string used for getting proper hl ---@param is_focused boolean ----@return string formated string for a section +---@return string formatted string for a section --TODO Clean this up this does lots of messy stuff. function M.draw_section(section, section_name, is_focused) local highlight_name = highlight.format_highlight(section_name, is_focused) @@ -21,7 +21,7 @@ function M.draw_section(section, section_name, is_focused) for _, component in pairs(section) do -- load components into status table if type(component) ~= 'table' or (type(component) == 'table' and not component.component_no) then - return '' -- unknown element in section. section posibly not yet loaded + return '' -- unknown element in section. section possibly not yet loaded end table.insert(status, component:draw(highlight_name, is_focused)) end @@ -81,14 +81,14 @@ function M.draw_section(section, section_name, is_focused) end end - local left_sparator_string = '' + local left_separator_string = '' if section_name > 'x' and section[first_component_no] and type(section[first_component_no].options.separator) ~= 'table' and (section[1].options.section_separators.right ~= nil and section[1].options.section_separators.right ~= '') then - left_sparator_string = string.format( + left_separator_string = string.format( '%%s{%s}', section[first_component_no].options.ls_separator or section[1].options.section_separators.right ) @@ -107,17 +107,17 @@ function M.draw_section(section, section_name, is_focused) local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find('^%%s{.-}') if find_start_trans_sep_start then -- the section doesn't need to be prepended with default hl when sections - -- first component has trasitionals sep + -- first component has transitional sep needs_hl = status_str:find('^%%#', find_start_trans_sep_end + 1) else needs_hl = status_str:find('^%%#') end if needs_hl then - -- Don't prepend with old highlight when the component changes it imidiately - return left_sparator_string .. status_str + -- Don't prepend with old highlight when the component changes it immediately + return left_separator_string .. status_str else - return left_sparator_string .. highlight_name .. status_str + return left_separator_string .. highlight_name .. status_str end end diff --git a/lua/lualine/utils/utils.lua b/lua/lualine/utils/utils.lua index 2f74c3e..143d041 100644 --- a/lua/lualine/utils/utils.lua +++ b/lua/lualine/utils/utils.lua @@ -191,13 +191,13 @@ function M.stl_escape(str) return str:gsub('%%', '%%%%') end ----A safe call inside a timmer +---A safe call inside a timer ---@param timer userdata ---@param augroup string|nil autocmd group to reset too on error. ---@param fn function ---@param max_err integer ---@param err_msg string ----@return function a wraped fn that can be called inside a timer and that +---@return function a wrapped fn that can be called inside a timer and that ---stops the timer after max_err errors in calling fn function M.timer_call(timer, augroup, fn, max_err, err_msg) local err_cnt, ret = 0, nil diff --git a/lua/lualine_require.lua b/lua/lualine_require.lua index f315728..968e9af 100644 --- a/lua/lualine_require.lua +++ b/lua/lualine_require.lua @@ -16,7 +16,7 @@ if source:sub(1, 1) == '@' then end end ---- checks if name is valied +--- checks if name is valid ---@param name string ---@return boolean function M.is_valid_filename(name) diff --git a/tests/helpers.lua b/tests/helpers.lua index f76a3e4..204cc2f 100644 --- a/tests/helpers.lua +++ b/tests/helpers.lua @@ -35,7 +35,7 @@ M.assert_component = function(component, opts, result, is_active) eq(result, comp:draw(opts.hl, is_active or true)) end -function M.assert_component_instence(comp, result) +function M.assert_component_instance(comp, result) eq(result, comp:draw(comp.options.hl)) end -- sets defaults for component options diff --git a/tests/spec/component_spec.lua b/tests/spec/component_spec.lua index b5dad63..8f89720 100644 --- a/tests/spec/component_spec.lua +++ b/tests/spec/component_spec.lua @@ -757,7 +757,7 @@ describe('Branch component', function() "git -c user.name='asdf' -c user.email='asdf@jlk.org' -C " .. tmpdir .. ' ' .. string.format(...) ) end - local assert_comp_ins = helpers.assert_component_instence + local assert_comp_ins = helpers.assert_component_instance before_each(function() tmpdir = os.tmpname() diff --git a/tests/spec/config_spec.lua b/tests/spec/config_spec.lua index 71d29a0..ba7532a 100644 --- a/tests/spec/config_spec.lua +++ b/tests/spec/config_spec.lua @@ -73,7 +73,7 @@ describe('config parsing', function() eq(config.options.section_separators, { left = 'b', right = 'a' }) end) end) - it('no seprarators', function() + it('no separators', function() local config = { options = { component_separators = {}, section_separators = {} }, } diff --git a/tests/spec/lualine_spec.lua b/tests/spec/lualine_spec.lua index 6ba5d5f..47854ea 100644 --- a/tests/spec/lualine_spec.lua +++ b/tests/spec/lualine_spec.lua @@ -26,7 +26,7 @@ describe('Lualine', function() statusline = 1000, tabline = 1000, winbar = 1000, - } + }, }, sections = { lualine_a = { 'mode' }, @@ -102,7 +102,7 @@ describe('Lualine', function() ]===]) end) - it('get_config can retrive config', function() + it('get_config can retrieve config', function() eq(config, require('lualine').get_config()) end) @@ -207,7 +207,7 @@ describe('Lualine', function() ]===]) end) - it('mid divider can be disbled on special case', function() + it('mid divider can be disabled on special case', function() config.options.always_divide_middle = false config.sections.lualine_x = {} config.sections.lualine_y = {} diff --git a/tests/spec/utils_spec.lua b/tests/spec/utils_spec.lua index cc44d07..30654b7 100644 --- a/tests/spec/utils_spec.lua +++ b/tests/spec/utils_spec.lua @@ -10,7 +10,7 @@ local stub = require('luassert.stub') describe('Utils', function() local utils = require('lualine.utils.utils') - it('can retrive highlight groups', function() + it('can retrieve highlight groups', function() local hl2 = { fg = '#aabbcc', bg = '#889977', sp = '#997788', reverse = true, undercurl = true } -- handles non existing hl groups eq(utils.extract_highlight_colors('hl2'), nil) @@ -79,7 +79,7 @@ describe('Utils', function() end) end) -describe('Cterm genarator', function() +describe('Cterm generator', function() local cterm = require('lualine.utils.color_utils') it('can convert rgb to cterm', function() @@ -90,7 +90,7 @@ describe('Cterm genarator', function() end) end) -describe('Section genarator', function() +describe('Section generator', function() local hl = require('lualine.highlight') stub(hl, 'format_highlight') hl.format_highlight.returns('%#lualine_c_normal#') diff --git a/tests/statusline.lua b/tests/statusline.lua index 0dac80d..96d1ee4 100644 --- a/tests/statusline.lua +++ b/tests/statusline.lua @@ -42,7 +42,7 @@ ---]===]) --- ``` --- ---- For more flexibility you can match a patten in expect block. +--- For more flexibility you can match a pattern in expect block. --- ``lua --- statusline:expect([===[ --- highlights = {