feat(plugins/heirline): add component to display screenkey keys

This commit is contained in:
Nicolas Goudry 2024-06-16 00:12:21 +02:00
parent 281069d97e
commit a36c9106f9
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44

View file

@ -10,6 +10,8 @@
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/heirline.lua
config = ''
local status = require("astroui.status")
local screenkey = require("screenkey")
vim.g.screenkey_statusline_component = true
require("heirline").setup({
opts = {
@ -32,6 +34,20 @@
status.component.lsp(),
status.component.virtual_env(),
status.component.treesitter(),
{
provider = function()
local keys = screenkey.get_keys()
if keys == nil or keys == "" then
return
end
return " " .. keys
end,
update = {
"User",
pattern = "Screenkey*",
callback = vim.schedule_wrap(function() vim.cmd("redrawstatus") end),
},
},
status.component.nav(),
status.component.mode { surround = { separator = "right" } },
},