Add object command
This commit is contained in:
parent
89cd68d8af
commit
000aa2282c
|
@ -681,6 +681,10 @@ in order to specify the wanted object:
|
||||||
*c*::
|
*c*::
|
||||||
select user defined object, will prompt for open and close text
|
select user defined object, will prompt for open and close text
|
||||||
|
|
||||||
|
*<a-;>*::
|
||||||
|
run a command in object context. The expansions `%val{count}` and
|
||||||
|
`%val{register}` are available here.
|
||||||
|
|
||||||
== Prompt commands
|
== Prompt commands
|
||||||
|
|
||||||
When pressing `:` in normal mode, Kakoune will open a prompt to enter
|
When pressing `:` in normal mode, Kakoune will open a prompt to enter
|
||||||
|
|
|
@ -1252,12 +1252,12 @@ void select_object(Context& context, NormalParams params)
|
||||||
whole ? "" : (flags & ObjectFlags::ToBegin ? " begin" : " end"));
|
whole ? "" : (flags & ObjectFlags::ToBegin ? " begin" : " end"));
|
||||||
};
|
};
|
||||||
|
|
||||||
const int count = params.count <= 0 ? 0 : params.count - 1;
|
|
||||||
on_next_key_with_autoinfo(context, KeymapMode::Object,
|
on_next_key_with_autoinfo(context, KeymapMode::Object,
|
||||||
[count](Key key, Context& context) {
|
[params](Key key, Context& context) {
|
||||||
if (key == Key::Escape)
|
if (key == Key::Escape)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const int count = params.count <= 0 ? 0 : params.count - 1;
|
||||||
static constexpr struct ObjectType
|
static constexpr struct ObjectType
|
||||||
{
|
{
|
||||||
Key key;
|
Key key;
|
||||||
|
@ -1311,6 +1311,12 @@ void select_object(Context& context, NormalParams params)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key == alt(';'))
|
||||||
|
{
|
||||||
|
command(context, params);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr struct SurroundingPair
|
static constexpr struct SurroundingPair
|
||||||
{
|
{
|
||||||
char opening;
|
char opening;
|
||||||
|
@ -1365,7 +1371,8 @@ void select_object(Context& context, NormalParams params)
|
||||||
{{'i'}, "indent"},
|
{{'i'}, "indent"},
|
||||||
{{'u'}, "argument"},
|
{{'u'}, "argument"},
|
||||||
{{'n'}, "number"},
|
{{'n'}, "number"},
|
||||||
{{'c'}, "custom object desc"}}));
|
{{'c'}, "custom object desc"},
|
||||||
|
{{alt(';')}, "run command in object context"}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Direction { Backward = -1, Forward = 1 };
|
enum Direction { Backward = -1, Forward = 1 };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user