-
Notifications
You must be signed in to change notification settings - Fork 9
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
Form selection #12
Comments
Agreed this will be useful to have, and should be straight forward to add. Will get around to it when I have a moment :) |
This implements a set of API's for deleting nodes and forms. + `delete_form` - Delete the entire form under the cursor + `delete_in_form` - Deletes all elements within the form under the cursor + `delete_element` - Deletes the element under the cursor Addresses #12
This builds on top of the previous form/element deletions work by expanding it to work for text object selections. This allows constructing selections within/around forms and elements which can be operated on natively by `d`, `c`, `y` and friends. Closes #12
This builds on top of the previous form/element deletions work by expanding it to work for text object selections. This allows constructing selections within/around forms and elements which can be operated on natively by `d`, `c`, `y`, `v` and friends. Closes #12
Just a note that I don't think there's a way to select root elements / forms still. So there's no |
You'll have to ignore the Fennel and custom macros for exporting values from the Lua module, but here's what I use in Conjure to select the root form in tree sitter across multiple languages. So this may be a good template to rip off to get started with. |
Ah you are right I forgot about the root form selections. Shouldn't be too difficult to add, if you want to take a stab at it go ahead :) Otherwise I can look into it when I get a moment. |
I'm working on this at the moment but a heads up that the tests seem to fail for the slurp/barfing in the Neovim nightly build. I swapped to stable and they run just fine.
|
Yea I noticed this recently too, something changed upstream in nightly that's broken this plugin. See #32 as well - split tests to allow running against either nightly or stable. Will try get nightly working again in that PR. |
Ok I actually just disabled nightly for now and merged that PR. Running |
Nice, rebased my changes on this and opening a PR with my first pass now. I have selections and deletions working, will probably add more tests, may need to add more methods for visual selections too, mostly focussed on deletions so far. Also you may find this useful: https://github.com/Olical/nfnl/blob/main/.github/workflows/test.yaml It's my GitHub action tests I use to run Plenary Busted (like you do) in GitHub Actions across multiple Neovim versions. The downside is that it doesn't work locally the same way, I run the tests in whatever Neovim version I have installed locally. Just thought I'd share in case you liked the way you can just add version numbers to the list. |
The af and if objects selects forms
The aF and iF objects select top-level forms.
Why
Replicate vim-sexp Text Object Selections
Clojure uses multiples types for surrounds
( { [
being able to refer to each with justf/F
makes text manipulation within Clojure much easier.Expected behaviour
Current form
(+ 1 1)
(Cursor anywhere within expression)()
deletes everything within formTop level form
(+ 1 (+ 2 3))
(Cursor within sub form)()
deletes everything within top level formThe text was updated successfully, but these errors were encountered: