From d1f17228dd20fe42b88bcdf39d5316c7cfae74e2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 9 Mar 2015 13:55:55 +0000 Subject: [PATCH] Use a static array to store the keymap --- src/normal.cc | 4 +++- src/normal.hh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 7a6cc6dd..bfdfcf65 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1350,7 +1350,7 @@ void move(Context& context, NormalParams params) selections.sort_and_merge_overlapping(); } -KeyMap keymap = +static NormalCmdDesc cmds[] = { { 'h', "move left", move }, { 'j', "move down", move }, @@ -1515,4 +1515,6 @@ KeyMap keymap = { Key::PageDown, "scroll one page down", scroll }, }; +KeyMap keymap = cmds; + } diff --git a/src/normal.hh b/src/normal.hh index 4a453415..96cf1457 100644 --- a/src/normal.hh +++ b/src/normal.hh @@ -1,8 +1,8 @@ #ifndef normal_hh_INCLUDED #define normal_hh_INCLUDED +#include "array_view.hh" #include "keys.hh" -#include "unordered_map.hh" #include "string.hh" namespace Kakoune @@ -23,7 +23,7 @@ struct NormalCmdDesc void (*func)(Context& context, NormalParams params); }; -using KeyMap = Vector; +using KeyMap = const ArrayView; extern KeyMap keymap; }