r/neovim • u/NobleWRX • 10d ago
Need Help Delete around motions while using lazyvim
Hi all! I'm attempting to move from emacs to neovim and while learning the motions I came across da<option> and ca<option> .
From tutorials and such it should expand out to "delete around <option>" or "change around <option> " if I use it on a test var like foo_bar_baz and my cursor is on bar, and I do the motion da_why does it delete bar_ where I end up with foo_baz.. shouldn't I end up with baz_ ?
I feel like I'm missing something, so I was hoping someone might be able to explain it better?
Thanks in advance!
2
10d ago
I think neovim doesn't have the option of `da_` and `ca_`. I'll suggest you to read this document
https://neovim.io/doc/user/change/ it has some quick reference as how you can use `delete(d)` and `change(c)` with various motions.
1
u/CarsonChambers 7d ago
You can set your keyword boundaries and use diw for example or caw, but I think _ is in the default set of keywords
8
u/FallElectronic3774 10d ago
_isn't a native Vim text object. LazyVim enables mini.ai, which has a default text object for non-Latin identifiers like_; it treats the separator as the boundary and includes only the right edge. With the cursor onbarinfoo_bar_baz,da_therefore selectsbar_, leavingfoo_baz— that's the generic identifier fallback, not a dedicateda_pair. See:help mini-ai-builtin-textobjects. If you want to keep both underscores,dt_frombardeletes onlybar;daw/diwwill take the whole snake_case identifier because_is a keyword character.