@@ -398,6 +398,12 @@ impl MappableCommand {
398398 surround_delete, "Surround delete",
399399 select_textobject_around, "Select around object",
400400 select_textobject_inner, "Select inside object",
401+ goto_next_function, "Goto next function",
402+ goto_prev_function, "Goto previous function",
403+ goto_next_class, "Goto next class",
404+ goto_prev_class, "Goto previous class",
405+ goto_next_parameter, "Goto next parameter",
406+ goto_prev_parameter, "Goto previous parameter",
401407 dap_launch, "Launch debug target",
402408 dap_toggle_breakpoint, "Toggle breakpoint",
403409 dap_continue, "Continue program execution",
@@ -5907,6 +5913,52 @@ fn scroll_down(cx: &mut Context) {
59075913 scroll(cx, cx.count(), Direction::Forward);
59085914}
59095915
5916+fn goto_ts_object_impl(cx: &mut Context, object: &str, direction: Direction) {
5917+ let count = cx.count();
5918+ let (view, doc) = current!(cx.editor);
5919+ let text = doc.text().slice(..);
5920+ let range = doc.selection(view.id).primary();
5921+
5922+ let new_range = match doc.language_config().zip(doc.syntax()) {
5923+ Some((lang_config, syntax)) => movement::goto_treesitter_object(
5924+ text,
5925+ range,
5926+ object,
5927+ direction,
5928+ syntax.tree().root_node(),
5929+ lang_config,
5930+ count,
5931+ ),
5932+ None => range,
5933+ };
5934+
5935+ doc.set_selection(view.id, Selection::single(new_range.anchor, new_range.head));
5936+}
5937+
5938+fn goto_next_function(cx: &mut Context) {
5939+ goto_ts_object_impl(cx, "function", Direction::Forward)
5940+}
5941+
5942+fn goto_prev_function(cx: &mut Context) {
5943+ goto_ts_object_impl(cx, "function", Direction::Backward)
5944+}
5945+
5946+fn goto_next_class(cx: &mut Context) {
5947+ goto_ts_object_impl(cx, "class", Direction::Forward)
5948+}
5949+
5950+fn goto_prev_class(cx: &mut Context) {
5951+ goto_ts_object_impl(cx, "class", Direction::Backward)
5952+}
5953+
5954+fn goto_next_parameter(cx: &mut Context) {
5955+ goto_ts_object_impl(cx, "parameter", Direction::Forward)
5956+}
5957+
5958+fn goto_prev_parameter(cx: &mut Context) {
5959+ goto_ts_object_impl(cx, "parameter", Direction::Backward)
5960+}
5961+
59105962fn select_textobject_around(cx: &mut Context) {
59115963 select_textobject(cx, textobject::TextObject::Around);
59125964}