Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Jun 20, 2024
1 parent 79bd736 commit 84317a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions lua/fzfx/cfg/vim_keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ end

--- @param output_lines string[]
--- @return fzfx.VimKeyMap[]
M._get_vim_keymaps = function(output_lines)
M._get_keymaps = function(output_lines)
local LAST_SET_FROM = "\tLast set from "
local LAST_SET_FROM_LUA = "\tLast set from Lua"
local LINE = " line "
Expand Down Expand Up @@ -260,12 +260,12 @@ M._get_vim_keymaps = function(output_lines)
end

-- log.debug(
-- "|fzfx.config - _get_vim_keymaps| keys_output_map1:%s",
-- "|_get_keymaps| keys_output_map1:%s",
-- vim.inspect(keys_output_map)
-- )
local api_keymaps = vim.api.nvim_get_keymap("") --[[@as table]]
-- log.debug(
-- "|fzfx.config - _get_vim_keymaps| api_keys_list:%s",
-- "|_get_keymaps| api_keys_list:%s",
-- vim.inspect(api_keys_list)
-- )
local api_maps = {}
Expand Down Expand Up @@ -330,15 +330,15 @@ M._get_vim_keymaps = function(output_lines)
end
end

log.debug(string.format("|_get_vim_keymaps| keys_output_map2:%s", vim.inspect(output_maps)))
log.debug(string.format("|_get_keymaps| keys_output_map2:%s", vim.inspect(output_maps)))
local sorted_results = {}
for _, o in pairs(output_maps) do
table.insert(sorted_results, o)
end
table.sort(sorted_results, function(a, b)
return a.lhs < b.lhs
end)
log.debug(string.format("|_get_vim_keymaps| results:%s", vim.inspect(sorted_results)))
log.debug(string.format("|_get_keymaps| results:%s", vim.inspect(sorted_results)))
return sorted_results
end

Expand Down Expand Up @@ -451,7 +451,7 @@ M._make_provider = function(mode)
--- @param context fzfx.VimKeyMapsPipelineContext
--- @return string[]|nil
local function impl(query, context)
local keymaps = M._get_vim_keymaps(context.output_lines)
local keymaps = M._get_keymaps(context.output_lines)
local target_keymaps = {}
if mode == "a" then
target_keymaps = keymaps
Expand Down Expand Up @@ -589,7 +589,7 @@ M._context_maker = function()
}
ctx.output_lines = M._get_maps_output_in_lines()

local keymaps = M._get_vim_keymaps(ctx.output_lines)
local keymaps = M._get_keymaps(ctx.output_lines)
local key_column_width, opts_column_width = M._calculate_columns_widths(keymaps)
ctx.key_column_width = key_column_width
ctx.opts_column_width = opts_column_width
Expand Down
6 changes: 3 additions & 3 deletions spec/cfg/vim_keymaps_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ describe("fzfx.cfg.vim_keymaps", function()
end
end
end)
it("_get_vim_keymaps", function()
local actual = vim_keymaps_cfg._get_vim_keymaps(CONTEXT.output_lines)
it("_get_keymaps", function()
local actual = vim_keymaps_cfg._get_keymaps(CONTEXT.output_lines)
-- print(string.format("vim keymaps:%s\n", vim.inspect(actual)))
assert_eq(type(actual), "table")
assert_true(#actual >= 0)
Expand Down Expand Up @@ -133,7 +133,7 @@ describe("fzfx.cfg.vim_keymaps", function()
assert_eq(actual2, string.len("Mode|Noremap|Nowait|Silent"))
end)
it("_render_lines", function()
local keymaps = vim_keymaps_cfg._get_vim_keymaps(CONTEXT.output_lines)
local keymaps = vim_keymaps_cfg._get_keymaps(CONTEXT.output_lines)
local lhs_width, opts_width = vim_keymaps_cfg._calculate_columns_widths(keymaps)
local actual = vim_keymaps_cfg._render_lines(keymaps, lhs_width, opts_width)
-- print(string.format("render vim keymaps:%s\n", vim.inspect(actual)))
Expand Down

0 comments on commit 84317a6

Please sign in to comment.