From a3b4e074156725500116ed5a8640a5cbb660ed02 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 19 Dec 2019 11:37:24 +0100 Subject: [PATCH 1/3] chore(hotkeys: vim): add fold-related --- lib/awful/hotkeys_popup/keys/vim.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/awful/hotkeys_popup/keys/vim.lua b/lib/awful/hotkeys_popup/keys/vim.lua index 16e4ec4b4..bb3ab6d47 100644 --- a/lib/awful/hotkeys_popup/keys/vim.lua +++ b/lib/awful/hotkeys_popup/keys/vim.lua @@ -170,6 +170,22 @@ local vim_keys = { y="scroll line down", } }}, + + ["VIM: fold"] = {{ + modifiers = {}, + keys = { + za="toggle", + zc="close", + zo="open", + zA="toggle recursive", + zC="close recursive", + zO="open recursive", + zm="close all one level", + zr="open all one level", + zM="close all", + zR="open all", + } + }}, } hotkeys_popup.add_hotkeys(vim_keys) From db9334605a2edf6f04a49b4c32b8528b1d367f1a Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 19 Dec 2019 11:38:46 +0100 Subject: [PATCH 2/3] fix(hotkeys: vim): don't use hardcoded colors --- lib/awful/hotkeys_popup/keys/vim.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/awful/hotkeys_popup/keys/vim.lua b/lib/awful/hotkeys_popup/keys/vim.lua index bb3ab6d47..0ef8ada43 100644 --- a/lib/awful/hotkeys_popup/keys/vim.lua +++ b/lib/awful/hotkeys_popup/keys/vim.lua @@ -10,12 +10,13 @@ local hotkeys_popup = require("awful.hotkeys_popup.widget") local vim_rule_any = {name={"vim", "VIM"}} for group_name, group_data in pairs({ - ["VIM: motion"] = { color="#009F00", rule_any=vim_rule_any }, - ["VIM: command"] = { color="#aFaF00", rule_any=vim_rule_any }, - ["VIM: command (insert)"] = { color="#cF4F40", rule_any=vim_rule_any }, - ["VIM: operator"] = { color="#aF6F00", rule_any=vim_rule_any }, - ["VIM: find"] = { color="#65cF9F", rule_any=vim_rule_any }, - ["VIM: scroll"] = { color="#659FdF", rule_any=vim_rule_any }, + ["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 From 75e5b8b39bebae0ec26dec5c7638ccba83b9f55f Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 19 Dec 2019 11:42:27 +0100 Subject: [PATCH 3/3] 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