Skip to content

Commit

Permalink
feat: use vim map description if rhs isn't available (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy authored Dec 21, 2023
1 parent f078320 commit f2e85f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/hawtkeys/ts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,17 @@ local function get_keymaps_from_vim()

local vimKeymapsRaw = vim.api.nvim_get_keymap("")
print("Collecting vim keymaps")

for _, vimKeymap in ipairs(vimKeymapsRaw) do
local rhs = vimKeymap.rhs
if rhs == nil or rhs == "" then
rhs = vimKeymap.desc
end
table.insert(vimKeymaps, {
mode = vimKeymap.mode,
-- TODO: leader subsitiution as vim keymaps contain raw leader
rhs = rhs,
lhs = vimKeymap.lhs:gsub(hawtkeys.config.leader, "<leader>"),
rhs = vimKeymap.rhs,
from_file = "Vim Defaults",
})
end
Expand Down

0 comments on commit f2e85f8

Please sign in to comment.