Skip to content

Commit

Permalink
fix(help): sort keymaps case incensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 28, 2024
1 parent 0fd665b commit cb2c5c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/trouble/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,15 @@ function M:help()
text:append("# Keymaps ", "Title"):nl():nl()
---@type string[]
local keys = vim.tbl_keys(self.win.keys)
table.sort(keys)
table.sort(keys, function(a, b)
local lowa = string.lower(a)
local lowb = string.lower(b)
if lowa == lowb then
return a > b -- Preserve original order for equal strings
else
return lowa < lowb
end
end)
for _, key in ipairs(keys) do
local desc = self.win.keys[key]
text:append(" - ", "@punctuation.special.markdown")
Expand Down

0 comments on commit cb2c5c9

Please sign in to comment.