From 75e5b8b39bebae0ec26dec5c7638ccba83b9f55f Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 19 Dec 2019 11:42:27 +0100 Subject: [PATCH] refactor(hotkeys: vim): don't add each group rule manually --- lib/awful/hotkeys_popup/keys/vim.lua | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/awful/hotkeys_popup/keys/vim.lua b/lib/awful/hotkeys_popup/keys/vim.lua index 0ef8ada43..fdfa6f889 100644 --- a/lib/awful/hotkeys_popup/keys/vim.lua +++ b/lib/awful/hotkeys_popup/keys/vim.lua @@ -8,20 +8,6 @@ local hotkeys_popup = require("awful.hotkeys_popup.widget") -local vim_rule_any = {name={"vim", "VIM"}} -for group_name, group_data in pairs({ - ["VIM: motion"] = { rule_any=vim_rule_any }, - ["VIM: command"] = { rule_any=vim_rule_any }, - ["VIM: command (insert)"] = { rule_any=vim_rule_any }, - ["VIM: operator"] = { rule_any=vim_rule_any }, - ["VIM: find"] = { rule_any=vim_rule_any }, - ["VIM: scroll"] = { rule_any=vim_rule_any }, - ["VIM: fold"] = { rule_any=vim_rule_any }, -}) do - hotkeys_popup.add_group_rules(group_name, group_data) -end - - local vim_keys = { ["VIM: motion"] = {{ @@ -191,4 +177,9 @@ local vim_keys = { hotkeys_popup.add_hotkeys(vim_keys) +local vim_rule_any = {name={"vim", "VIM"}} +for group_name, _ in pairs(vim_keys) do + hotkeys_popup.add_group_rules(group_name, { rule_any=vim_rule_any }) +end + -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80