| 1 |
--------------------------------------------------------------------------- |
| 2 |
--- VIM hotkeys for awful.hotkeys_widget |
| 3 |
-- |
| 4 |
-- @author Yauheni Kirylau <[email protected]> |
| 5 |
-- @copyright 2014-2015 Yauheni Kirylau |
| 6 |
-- @submodule awful.hotkeys_popup |
| 7 |
--------------------------------------------------------------------------- |
| 8 |
|
| 9 |
local hotkeys_popup = require("awful.hotkeys_popup.widget") |
| 10 |
|
| 11 |
local vim_rule_any = {name={"vim", "VIM"}} |
| 12 |
for group_name, group_data in pairs({ |
| 13 |
["VIM: motion"] = { color="#009F00", rule_any=vim_rule_any }, |
| 14 |
["VIM: command"] = { color="#aFaF00", rule_any=vim_rule_any }, |
| 15 |
["VIM: command (insert)"] = { color="#cF4F40", rule_any=vim_rule_any }, |
| 16 |
["VIM: operator"] = { color="#aF6F00", rule_any=vim_rule_any }, |
| 17 |
["VIM: find"] = { color="#65cF9F", rule_any=vim_rule_any }, |
| 18 |
["VIM: scroll"] = { color="#659FdF", rule_any=vim_rule_any }, |
| 19 |
}) do |
| 20 |
hotkeys_popup.add_group_rules(group_name, group_data) |
| 21 |
end |
| 22 |
|
| 23 |
|
| 24 |
local vim_keys = { |
| 25 |
|
| 26 |
["VIM: motion"] = {{ |
| 27 |
modifiers = {}, |
| 28 |
keys = { |
| 29 |
['`']="goto mark", |
| 30 |
['0']='"hard" BOL', |
| 31 |
['-']="prev line", |
| 32 |
w="next word", |
| 33 |
e="end word", |
| 34 |
['[']=". misc", |
| 35 |
[']']=". misc", |
| 36 |
["'"]=". goto mk. BOL", |
| 37 |
b="prev word", |
| 38 |
["|"]='BOL/goto col', |
| 39 |
["$"]='EOL', |
| 40 |
["%"]='goto matching bracket', |
| 41 |
["^"]='"soft" BOL', |
| 42 |
["("]='sentence begin', |
| 43 |
[")"]='sentence end', |
| 44 |
["_"]='"soft" BOL down', |
| 45 |
["+"]='next line', |
| 46 |
W='next WORD', |
| 47 |
E='end WORD', |
| 48 |
['{']="paragraph begin", |
| 49 |
['}']="paragraph end", |
| 50 |
G='EOF/goto line', |
| 51 |
H='move cursor to screen top', |
| 52 |
M='move cursor to screen middle', |
| 53 |
L='move cursor to screen bottom', |
| 54 |
B='prev WORD', |
| 55 |
} |
| 56 |
}, { |
| 57 |
modifiers = {"Ctrl"}, |
| 58 |
keys = { |
| 59 |
u="half page up", |
| 60 |
d="half page down", |
| 61 |
b="page up", |
| 62 |
f="page down", |
| 63 |
o="prev mark", |
| 64 |
} |
| 65 |
}}, |
| 66 |
|
| 67 |
["VIM: operator"] = {{ |
| 68 |
modifiers = {}, |
| 69 |
keys = { |
| 70 |
['=']="auto format", |
| 71 |
y="yank", |
| 72 |
d="delete", |
| 73 |
c="change", |
| 74 |
["!"]='external filter', |
| 75 |
['<']='unindent', |
| 76 |
['>']='indent', |
| 77 |
} |
| 78 |
}}, |
| 79 |
|
| 80 |
["VIM: command"] = {{ |
| 81 |
modifiers = {}, |
| 82 |
keys = { |
| 83 |
['~']="toggle case", |
| 84 |
q=". record macro", |
| 85 |
r=". replace char", |
| 86 |
u="undo", |
| 87 |
p="paste after", |
| 88 |
gg="go to the top of file", |
| 89 |
gf="open file under cursor", |
| 90 |
x="delete char", |
| 91 |
v="visual mode", |
| 92 |
m=". set mark", |
| 93 |
['.']="repeat command", |
| 94 |
["@"]='. play macro', |
| 95 |
["&"]='repeat :s', |
| 96 |
Q='ex mode', |
| 97 |
Y='yank line', |
| 98 |
U='undo line', |
| 99 |
P='paste before cursor', |
| 100 |
D='delete to EOL', |
| 101 |
J='join lines', |
| 102 |
K='help', |
| 103 |
[':']='ex cmd line', |
| 104 |
['"']='. register spec', |
| 105 |
ZZ='quit and save', |
| 106 |
ZQ='quit discarding changes', |
| 107 |
X='back-delete', |
| 108 |
V='visual lines selection', |
| 109 |
} |
| 110 |
}, { |
| 111 |
modifiers = {"Ctrl"}, |
| 112 |
keys = { |
| 113 |
w=". window operations", |
| 114 |
r="redo", |
| 115 |
["["]="normal mode", |
| 116 |
a="increase number", |
| 117 |
x="decrease number", |
| 118 |
g="file/cursor info", |
| 119 |
z="suspend", |
| 120 |
c="cancel/normal mode", |
| 121 |
v="visual block selection", |
| 122 |
} |
| 123 |
}}, |
| 124 |
|
| 125 |
["VIM: command (insert)"] = {{ |
| 126 |
modifiers = {}, |
| 127 |
keys = { |
| 128 |
i="insert mode", |
| 129 |
o="open below", |
| 130 |
a="append", |
| 131 |
s="subst char", |
| 132 |
R='replace mode', |
| 133 |
I='insert at BOL', |
| 134 |
O='open above', |
| 135 |
A='append at EOL', |
| 136 |
S='subst line', |
| 137 |
C='change to EOL', |
| 138 |
} |
| 139 |
}}, |
| 140 |
|
| 141 |
["VIM: find"] = {{ |
| 142 |
modifiers = {}, |
| 143 |
keys = { |
| 144 |
[';']="repeat t/T/f/F", |
| 145 |
[',']="reverse t/T/f/F", |
| 146 |
['/']=". find", |
| 147 |
['?']='. reverse find', |
| 148 |
n="next search match", |
| 149 |
N='prev search match', |
| 150 |
f=". find char", |
| 151 |
F='. reverse find char', |
| 152 |
t=". 'till char", |
| 153 |
T=". reverse 'till char", |
| 154 |
["*"]='find word under cursor', |
| 155 |
["#"]='reverse find under cursor', |
| 156 |
} |
| 157 |
}}, |
| 158 |
|
| 159 |
["VIM: scroll"] = {{ |
| 160 |
modifiers = {}, |
| 161 |
keys = { |
| 162 |
zt="scroll cursor to the top", |
| 163 |
zz="scroll cursor to the center", |
| 164 |
zb="scroll cursor to the bottom", |
| 165 |
} |
| 166 |
},{ |
| 167 |
modifiers = {"Ctrl"}, |
| 168 |
keys = { |
| 169 |
e="scroll line up", |
| 170 |
y="scroll line down", |
| 171 |
} |
| 172 |
}}, |
| 173 |
} |
| 174 |
|
| 175 |
hotkeys_popup.add_hotkeys(vim_keys) |
| 176 |
|
| 177 |
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 |