@@ -247,6 +247,8 @@ impl MappableCommand {
247247 move_prev_long_word_start, "Move to start of previous long word",
248248 move_next_long_word_end, "Move to end of next long word",
249249 move_prev_long_word_end, "Move to end of previous long word",
250+ move_parent_node_end, "Move to end of the parent node",
251+ move_parent_node_start, "Move to beginning of the parent node",
250252 extend_next_word_start, "Extend to start of next word",
251253 extend_prev_word_start, "Extend to start of previous word",
252254 extend_next_word_end, "Extend to end of next word",
@@ -255,6 +257,8 @@ impl MappableCommand {
255257 extend_prev_long_word_start, "Extend to start of previous long word",
256258 extend_next_long_word_end, "Extend to end of next long word",
257259 extend_prev_long_word_end, "Extend to end of prev long word",
260+ extend_parent_node_end, "Extend to end of the parent node",
261+ extend_parent_node_start, "Extend to beginning of the parent node",
258262 find_till_char, "Move till next occurrence of char",
259263 find_next_char, "Move to next occurrence of char",
260264 extend_till_char, "Extend till next occurrence of char",
@@ -4605,6 +4609,46 @@ fn select_prev_sibling(cx: &mut Context) {
46054609 select_sibling_impl(cx, &|node| Node::prev_sibling(&node))
46064610}
46074611
4612+fn move_node_bound_impl(cx: &mut Context, dir: Direction, movement: Movement) {
4613+ let motion = move |editor: &mut Editor| {
4614+ let (view, doc) = current!(editor);
4615+
4616+ if let Some(syntax) = doc.syntax() {
4617+ let text = doc.text().slice(..);
4618+ let current_selection = doc.selection(view.id);
4619+
4620+ let selection = movement::move_parent_node_end(
4621+ syntax,
4622+ text,
4623+ current_selection.clone(),
4624+ dir,
4625+ movement,
4626+ );
4627+
4628+ doc.set_selection(view.id, selection);
4629+ }
4630+ };
4631+
4632+ motion(cx.editor);
4633+ cx.editor.last_motion = Some(Motion(Box::new(motion)));
4634+}
4635+
4636+pub fn move_parent_node_end(cx: &mut Context) {
4637+ move_node_bound_impl(cx, Direction::Forward, Movement::Move)
4638+}
4639+
4640+pub fn move_parent_node_start(cx: &mut Context) {
4641+ move_node_bound_impl(cx, Direction::Backward, Movement::Move)
4642+}
4643+
4644+pub fn extend_parent_node_end(cx: &mut Context) {
4645+ move_node_bound_impl(cx, Direction::Forward, Movement::Extend)
4646+}
4647+
4648+pub fn extend_parent_node_start(cx: &mut Context) {
4649+ move_node_bound_impl(cx, Direction::Backward, Movement::Extend)
4650+}
4651+
46084652fn match_brackets(cx: &mut Context) {
46094653 let (view, doc) = current!(cx.editor);
46104654 let is_select = cx.editor.mode == Mode::Select;