Add remapping of text object keys
This commit is contained in:
parent
6689bf0b46
commit
ab2007bd4e
|
@ -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) };
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ enum class KeymapMode : char
|
|||
Goto,
|
||||
View,
|
||||
User,
|
||||
Object,
|
||||
};
|
||||
|
||||
class KeymapManager
|
||||
|
|
|
@ -900,7 +900,7 @@ template<ObjectFlags flags, SelectMode mode = SelectMode::Replace>
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user