[llvm] [vim] Improve iskeyword for LLVM IR (PR #117905)
Fraser Cormack via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 03:44:38 PST 2024
frasercrmck wrote:
> Just so I understand the issue being addressed by this issue, is it that variable identifiers that begin with `%` or `@` are treated currently as two words, such that motions don't act on the whole identifier?
Yes, partially. However, it's more than that; since `.` is treated as a word separator, I find IR values very cumbersome to work with. For example, word-based motions on `a %foo.i.i.0 b` currently take 9 `w`s to move the cursor from `a` to `b`. With this patch it'd be 2, as with any other "word" in any other language. You can also have your cursor anywhere on `%foo.i.i.0` and `*` will take you to the next occurrence. This was my primary motivation for the patch. Yes, you have capital-w `W`ord motions to combat some of what I'm saying, but operators like `*` can't work with those.
It's a balance, however, since it becomes harder to move through these sub-components of identifiers. You'd probably have to start using motions based on finding the next/previous `.` character. Ultimately, people can change this to suit their needs. This is about a sensible default. I could always leave in a comment explaining to comment this `iskeyword` out to have such-and-such behaviour.
All that said, I was thinking I should add the non-latin alphanumeric characters back to the list. That keeps strings just as easy to navigate through (we don't want something like `hübsch` to become more difficult to navigate through)
https://github.com/llvm/llvm-project/pull/117905
More information about the llvm-commits
mailing list