From ab2007bd4ec9a8945b245e34fcb8560173e12f71 Mon Sep 17 00:00:00 2001 From: Viktor Palmkvist Date: Wed, 1 Jul 2015 17:47:42 +0200 Subject: [PATCH] Add remapping of text object keys --- src/commands.cc | 6 ++++-- src/keymap_manager.hh | 1 + src/normal.cc | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index b1f5cabe..ab791f66 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1097,6 +1097,7 @@ KeymapMode parse_keymap_mode(const String& str) if (prefix_match("goto", str)) return KeymapMode::Goto; if (prefix_match("view", str)) return KeymapMode::View; if (prefix_match("user", str)) return KeymapMode::User; + if (prefix_match("object", str)) return KeymapMode::Object; throw runtime_error(format("unknown keymap mode '{}'", str)); } @@ -1112,7 +1113,8 @@ const CommandDesc map_key_cmd = { " prompt\n" " goto\n" " view\n" - " user\n", + " user\n" + " object\n", ParameterDesc{{}, ParameterDesc::Flags::None, 4, 4}, CommandFlags::None, CommandHelper{}, @@ -1125,7 +1127,7 @@ const CommandDesc map_key_cmd = { complete(params[0], pos_in_token, scopes) }; if (token_to_complete == 1) { - constexpr const char* modes[] = { "normal", "insert", "menu", "prompt", "goto", "view", "user" }; + constexpr const char* modes[] = { "normal", "insert", "menu", "prompt", "goto", "view", "user", "object" }; return { 0_byte, params[1].length(), complete(params[1], pos_in_token, modes) }; } diff --git a/src/keymap_manager.hh b/src/keymap_manager.hh index d5e96322..3eeb0ebb 100644 --- a/src/keymap_manager.hh +++ b/src/keymap_manager.hh @@ -20,6 +20,7 @@ enum class KeymapMode : char Goto, View, User, + Object, }; class KeymapManager diff --git a/src/normal.cc b/src/normal.cc index a9357806..92236498 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -900,7 +900,7 @@ template void select_object(Context& context, NormalParams params) { const int level = params.count <= 0 ? 0 : params.count - 1; - on_next_key_with_autoinfo(context, KeymapMode::None, + on_next_key_with_autoinfo(context, KeymapMode::Object, [level](Key key, Context& context) { if (key.modifiers != Key::Modifiers::None) return;