diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-10-17 11:29:52 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-10-20 12:21:22 +0800 |
| commit | ddff35e5ab6a9bed29c49547eaee91637854f029 (patch) | |
| tree | b6059182aac4aa418fa9d5d7628ba67efa34839b /src/normal.cc | |
| parent | 209113aa1c37464687612520542795900d461215 (diff) | |
Move keymap as an implementation detail of the normal mode keys
Only expose a free function that tries to get the NormalCmd from a
key.
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/normal.cc b/src/normal.cc index 454c8fdc..213598d3 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1943,7 +1943,7 @@ void force_redraw(Context& context, NormalParams) } } -const HashMap<Key, NormalCmd> keymap{ +static const HashMap<Key, NormalCmd> keymap{ { {'h'}, {"move left", move<CharCount, Backward>} }, { {'j'}, {"move down", move<LineCount, Forward>} }, { {'k'}, {"move up", move<LineCount, Backward>} }, @@ -2131,4 +2131,12 @@ const HashMap<Key, NormalCmd> keymap{ { {ctrl('l')}, {"force redraw", force_redraw} }, }; +Optional<NormalCmd> get_normal_command(Key key) +{ + auto it = keymap.find(key); + if (it != keymap.end()) + return it->value; + return {}; +} + } |
