Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add textobjects queries #20924

Merged
merged 14 commits into from
Dec 3, 2024
Merged

Add textobjects queries #20924

merged 14 commits into from
Dec 3, 2024

Conversation

ConradIrwin
Copy link
Member

@ConradIrwin ConradIrwin commented Nov 20, 2024

Co-Authored-By: Max [email protected]

Release Notes:

  • vim: Added motions [[, [], ]], ][ for navigating by section, [m, ]m, [M, ]M for navigating by method, and [*, ]*, [/, ]/ for comments. These currently only work for languages built in to Zed, as they are powered by new tree-sitter queries.
  • vim: Added new text objects: ic, ac for inside/around classes, if,af for functions/methods, and g c for comments. These currently only work for languages built in to Zed, as they are powered by new tree-sitter queries.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 20, 2024
}
}

let user_properties = Some(serde_json::json!({
"is_staff": body.is_staff,
"Country": country_code.clone(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these telemetry changes intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not on this branch

@ConradIrwin ConradIrwin merged commit 75c9dc1 into main Dec 3, 2024
14 checks passed
@ConradIrwin ConradIrwin deleted the vim-textobject branch December 3, 2024 17:37
@opsnull
Copy link

opsnull commented Dec 4, 2024

Will these convenient grammatical movement features be supported in non-vim modes?

@ConradIrwin
Copy link
Member Author

I think they should be, but it's not clear to me the best way to make them available. Do you use an editor that supports this, and if so, what does the UX feel like? (and if not, what would you like?)

@1925381584
Copy link

amazing, [[, [], ]], ][ is exactly what I've been wanting lately, and ic, ac, if, af these is what I wanted when I first started working with zed, and now they all work. so amazing

@opsnull
Copy link

opsnull commented Dec 4, 2024

I think they should be, but it's not clear to me the best way to make them available. Do you use an editor that supports this, and if so, what does the UX feel like? (and if not, what would you like?)

Yes, I'm using emacs, and emacs support lots of sexp selection/movement and mark. I use customized keybindings to use them.

eg.

| C-M-f   | forward-sexp               | Match forward token (e.g. string, parentheses) on right of cursor |
| C-M-b   | backward-sexp              | Match backward token on left of cursor |
| C-M-a   | beginning-of-defun         | Move cursor backward to start of function definition |
| C-M-e   | end-of-defun               | Move cursor forward to end of function definition |
| C-M-n   | forward-list               | Move forward by parentheses |
| C-M-p   | backward-list              | Move backward by parentheses |
| C-M-u   | backward-up-list           | Jump to upper level of current parentheses |
| C-M-@   | mark-sexp                  | Mark current S-expression |
| C-M-SPC | mark-sexp                  | Mark current S-expression |
| C-M-h   | mark-defun                 | Mark function |
| C-M-q   | prog-indent-sexp           | Format current S-expression |

Some emacs pacakges eg.

  1. https://www.masteringemacs.org/article/combobulate-structured-movement-editing-treesitter
  2. https://github.com/haritkapadia/ts-movement?tab=readme-ov-file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants