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

vim: */# do not work if "current word" starts or ends with punctuation #20584

Open
1 task done
withamoliver opened this issue Nov 13, 2024 · 3 comments
Open
1 task done
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc vim

Comments

@withamoliver
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

  1. Add @ or# to language word_characters (or look at a JavaScript file which already includes #).
  2. Put your cursor over a word which includes a @ or # character.
  3. Find under cursor with vim */#.
  4. No matches are found.
  5. Unselecting the Use Regular Expressions option results in matches being found.

Environment

Zed: v0.160.7 (Zed)
OS: macOS 14.4.1
Memory: 32 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

@notpeter
Copy link
Member

What is an example search string that does not work with regex enabled? I wouldn't expect @ or # to need to be regex escaped. 🤔

What is the behavior you expect?

  1. If "Use Regular Expression" is checked it should be unchecked when triggering this.
  2. If "Use Regular Expression" is checked the search string should be regex escaped.
  3. Something else?

@withamoliver
Copy link
Author

Interestingly #count and count# don't work but co#unt does. It looks like the text which ends up in the search bar converts the # to \#.

Similarly @count and count@ don't work but co@unt does, but this time there's no conversion of the text which ends up in the search bar.

The behaviour I expect is that if I put my cursor on a 'word' which includes a @ or # and use vim: move to next (* key) or use vim: move to prev (# key) then it should go to the next/prev instance of that 'word'. I don't care what ends up in the search bar or whether Use Regular Expressions is checked, I just want it to find the next instance.

@JosephTLyons JosephTLyons added vim editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc and removed triage labels Nov 15, 2024
@ConradIrwin
Copy link
Member

Currently the search bar uses \< and \> when word-only mode is enabled (which it is for */#). This doesn't know about zed's word-characters, so fails because there is not a word-break at the beginning/end of the query.

@ConradIrwin ConradIrwin changed the title @/# don't work in language word_characters when using vim */# find under cursor vim: */# do not work if "current word" starts or ends with punctuation Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc vim
Projects
None yet
Development

No branches or pull requests

4 participants