Merge pull request #682 from actionless/vim-bindings-improvements

chore(awful: hotkeys: vim): small improvements in hotkeys descriptions
This commit is contained in:
Daniel Hahler 2016-02-12 23:00:26 +01:00
commit de3d97fb0d
2 changed files with 78 additions and 36 deletions

View File

@ -10,7 +10,7 @@ local beautiful = require("beautiful")
-- Notification library -- Notification library
local naughty = require("naughty") local naughty = require("naughty")
local menubar = require("menubar") local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup.widget") local hotkeys_popup = require("awful.hotkeys_popup").widget
-- {{{ Error handling -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to

View File

@ -11,10 +11,12 @@ local hotkeys_popup = require("awful.hotkeys_popup.widget")
local vim_rule_any = {name={"vim", "VIM"}} local vim_rule_any = {name={"vim", "VIM"}}
for group_name, group_data in pairs({ for group_name, group_data in pairs({
vim_motion= { color="#009F00", rule_any=vim_rule_any }, ["VIM: motion"] = { color="#009F00", rule_any=vim_rule_any },
vim_command= { color="#aFaF00", 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: command (insert)"] = { color="#cF4F40", rule_any=vim_rule_any },
vim_operator= { color="#aF6F00", 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 },
}) do }) do
hotkeys_popup.group_rules[group_name] = group_data hotkeys_popup.group_rules[group_name] = group_data
end end
@ -22,7 +24,7 @@ end
local vim_keys = { local vim_keys = {
vim_motion={{ ["VIM: motion"] = {{
modifiers = {}, modifiers = {},
keys = { keys = {
['`']="goto mark", ['`']="goto mark",
@ -30,43 +32,40 @@ local vim_keys = {
['-']="prev line", ['-']="prev line",
w="next word", w="next word",
e="end word", e="end word",
t=". 'till",
['[']=". misc", ['[']=". misc",
[']']=". misc", [']']=". misc",
f=". find char",
[';']="repeat t/T/f/F",
["'"]=". goto mk. BOL", ["'"]=". goto mk. BOL",
b="prev word", b="prev word",
n="next word", ["|"]='BOL/goto col',
[',']="reverse t/T/f/F",
['/']=". find",
['~']="toggle case",
["#"]='prev indent',
["$"]='EOL', ["$"]='EOL',
["%"]='goto match bracket', ["%"]='goto matching bracket',
["^"]='"soft" BOL', ["^"]='"soft" BOL',
["*"]='next indent', ["("]='sentence begin',
["("]='begin sentence', [")"]='sentence end',
[")"]='end sentence',
["_"]='"soft" BOL down', ["_"]='"soft" BOL down',
["+"]='next line', ["+"]='next line',
W='next WORD', W='next WORD',
E='end WORD', E='end WORD',
T=". back 'till", ['{']="paragraph begin",
['{']="begin parag.", ['}']="paragraph end",
['}']="end parag.",
F='. "back" find char',
G='EOF/goto line', G='EOF/goto line',
H='screen top', H='move cursor to screen top',
L='screen bottom', M='move cursor to screen middle',
L='move cursor to screen bottom',
B='prev WORD', B='prev WORD',
N='prev (find)', }
M='screen middle', }, {
['?']='. find(rev.)', modifiers = {"Ctrl"},
keys = {
u="half page up",
d="half page down",
b="page up",
f="page down",
o="prev mark",
} }
}}, }},
vim_operator={{ ["VIM: operator"] = {{
modifiers = {}, modifiers = {},
keys = { keys = {
['=']="auto format", ['=']="auto format",
@ -79,15 +78,16 @@ local vim_keys = {
} }
}}, }},
vim_command={{ ["VIM: command"] = {{
modifiers = {}, modifiers = {},
keys = { keys = {
['~']="toggle case",
q=". record macro", q=". record macro",
r=". replace char", r=". replace char",
u="undo", u="undo",
p="paste after", p="paste after",
g="gg: top of file, gf: open file here", gg="go to the top of file",
z="zt: cursor to top, zb: bottom, zz: center", gf="open file under cursor",
x="delete char", x="delete char",
v="visual mode", v="visual mode",
m=". set mark", m=". set mark",
@ -97,20 +97,33 @@ local vim_keys = {
Q='ex mode', Q='ex mode',
Y='yank line', Y='yank line',
U='undo line', U='undo line',
P='paste before', P='paste before cursor',
D='delete to EOL', D='delete to EOL',
J='join lines', J='join lines',
K='help', K='help',
[':']='ex cmd line', [':']='ex cmd line',
['"']='. register spec', ['"']='. register spec',
["|"]='BOL/goto col', ZZ='quit and save',
Z='quit and ZZ:save or ZQ:not', ZQ='quit discarding changes',
X='back-delete', X='back-delete',
V='visual lines', V='visual lines selection',
}
}, {
modifiers = {"Ctrl"},
keys = {
w=". window operations",
r="redo",
["["]="normal mode",
a="increase number",
x="decrease number",
g="file/cursor info",
z="suspend",
c="cancel/normal mode",
v="visual block selection",
} }
}}, }},
vim_command_insert={{ ["VIM: command (insert)"] = {{
modifiers = {}, modifiers = {},
keys = { keys = {
i="insert mode", i="insert mode",
@ -125,6 +138,35 @@ local vim_keys = {
C='change to EOL', C='change to EOL',
} }
}}, }},
["VIM: find"] = {{
modifiers = {},
keys = {
[';']="repeat t/T/f/F",
[',']="reverse t/T/f/F",
['/']=". find",
['?']='. reverse find',
n="next search match",
N='prev search match',
f=". find char",
F='. reverse find char',
t=". 'till char",
T=". reverse 'till char",
["*"]='find word under cursor',
["#"]='reverse find under cursor',
}
}},
["VIM: scroll"] = {{
modifiers = {},
keys = {
e="scroll line up",
y="scroll line down",
zt="scroll cursor to the top",
zz="scroll cursor to the center",
zb="scroll cursor to the bottom",
}
}},
} }
hotkeys_popup.add_hotkeys(vim_keys) hotkeys_popup.add_hotkeys(vim_keys)