feat: Helix mode: move_next_word_end (#223)
* Helix mode: move_next_word_end * fix: don't match against legacy unshifted keys when we have extended input text closes #205 * refactor: remove duplicate implementation of command.get_id * feat: re-add support for integer command arguments closes #182 * feat: display pending integer argument in keybind widget * fix: call configured init_commands for all mode types * feat: add flow mode keybindings for setting integer argument * feat: add support for repeat integer arguments to many commands * feat: add emacs mode keybindings for setting integer argument * feat: add vim mode keybindings for setting integer argument * resolving conflit * disable_selection --------- Co-authored-by: CJ van den Berg <cj@vdbonline.com>
This commit is contained in:
parent
ae815043d9
commit
7a1a411aaf
2 changed files with 16 additions and 2 deletions
|
@ -129,7 +129,7 @@ pub const CurSel = struct {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn disable_selection(self: *Self, root: Buffer.Root, metrics: Buffer.Metrics) void {
|
pub fn disable_selection(self: *Self, root: Buffer.Root, metrics: Buffer.Metrics) void {
|
||||||
switch (tui.get_selection_style()) {
|
switch (tui.get_selection_style()) {
|
||||||
.normal => self.disable_selection_normal(),
|
.normal => self.disable_selection_normal(),
|
||||||
.inclusive => self.disable_selection_inclusive(root, metrics),
|
.inclusive => self.disable_selection_inclusive(root, metrics),
|
||||||
|
|
|
@ -110,7 +110,6 @@ const cmds_ = struct {
|
||||||
ed.with_selections_const_repeat(root, Editor.move_cursor_word_right_vim, ctx) catch {};
|
ed.with_selections_const_repeat(root, Editor.move_cursor_word_right_vim, ctx) catch {};
|
||||||
ed.clamp();
|
ed.clamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const move_next_word_start_meta: Meta = .{ .description = "Move next word start", .arguments = &.{.integer} };
|
pub const move_next_word_start_meta: Meta = .{ .description = "Move next word start", .arguments = &.{.integer} };
|
||||||
|
|
||||||
pub fn move_prev_word_start(_: *void, ctx: Ctx) Result {
|
pub fn move_prev_word_start(_: *void, ctx: Ctx) Result {
|
||||||
|
@ -127,6 +126,21 @@ const cmds_ = struct {
|
||||||
}
|
}
|
||||||
pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
|
pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
|
||||||
|
|
||||||
|
pub fn move_next_word_end(_: *void, _: Ctx) Result {
|
||||||
|
const mv = tui.mainview() orelse return;
|
||||||
|
const ed = mv.get_active_editor() orelse return;
|
||||||
|
const root = try ed.buf_root();
|
||||||
|
|
||||||
|
for (ed.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
|
cursel.disable_selection(root, ed.metrics);
|
||||||
|
};
|
||||||
|
|
||||||
|
ed.with_selections_const(root, Editor.move_cursor_word_right_end_vim) catch {};
|
||||||
|
ed.with_selections_const(root, Editor.move_cursor_right) catch {};
|
||||||
|
ed.clamp();
|
||||||
|
}
|
||||||
|
pub const move_next_word_end_meta: Meta = .{ .description = "Move next word end" };
|
||||||
|
|
||||||
pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result {
|
pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result {
|
||||||
const mv = tui.mainview() orelse return;
|
const mv = tui.mainview() orelse return;
|
||||||
const ed = mv.get_active_editor() orelse return;
|
const ed = mv.get_active_editor() orelse return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue