@@ -398,6 +398,12 @@ impl MappableCommand {
398 surround_delete, "Surround delete",
398 surround_delete, "Surround delete",
399 select_textobject_around, "Select around object",
399 select_textobject_around, "Select around object",
400 select_textobject_inner, "Select inside object",
400 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",
401 dap_launch, "Launch debug target",
407 dap_launch, "Launch debug target",
402 dap_toggle_breakpoint, "Toggle breakpoint",
408 dap_toggle_breakpoint, "Toggle breakpoint",
403 dap_continue, "Continue program execution",
409 dap_continue, "Continue program execution",
@@ -5907,6 +5913,52 @@ fn scroll_down(cx: &mut Context) {
5907 scroll(cx, cx.count(), Direction::Forward);
5913 scroll(cx, cx.count(), Direction::Forward);
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();
5922+ let new_range = match doc.language_config().zip(doc.syntax()) {
5923+ Some((lang_config, syntax)) => movement::goto_treesitter_object(
5928+ syntax.tree().root_node(),
5935+ doc.set_selection(view.id, Selection::single(new_range.anchor, new_range.head));
5938+fn goto_next_function(cx: &mut Context) {
5939+ goto_ts_object_impl(cx, "function", Direction::Forward)
5942+fn goto_prev_function(cx: &mut Context) {
5943+ goto_ts_object_impl(cx, "function", Direction::Backward)
5946+fn goto_next_class(cx: &mut Context) {
5947+ goto_ts_object_impl(cx, "class", Direction::Forward)
5950+fn goto_prev_class(cx: &mut Context) {
5951+ goto_ts_object_impl(cx, "class", Direction::Backward)
5954+fn goto_next_parameter(cx: &mut Context) {
5955+ goto_ts_object_impl(cx, "parameter", Direction::Forward)
5958+fn goto_prev_parameter(cx: &mut Context) {
5959+ goto_ts_object_impl(cx, "parameter", Direction::Backward)
5910fn select_textobject_around(cx: &mut Context) {
5962fn select_textobject_around(cx: &mut Context) {
5911 select_textobject(cx, textobject::TextObject::Around);
5963 select_textobject(cx, textobject::TextObject::Around);