-
Notifications
You must be signed in to change notification settings - Fork 10
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
Request: move to next form start #53
Comments
Isn't that |
Not quite, no. As far as I understand it, Example: initial cursor location indicated with
My implementation above:
|
Thanks for your interest, glad you are enjoying the plugin! Something that I am cautious to do is broaden the scope of this plugin too much. Fundamentally I want to keep it focused on lisp specific syntax modifications. I'm definitely not apposed to adding movement API's to this plugin (we already have done this) if they make sense. But as much as possible if it is something that can be pushed out to other plugins I think I would prefer that. I say all this because there is already a generalized treesitter textobjects plugin for various operation found here - https://github.com/nvim-treesitter/nvim-treesitter-textobjects. Specifically relevant to this discussion is the section on motions. Can you take a look at that and see if that is something that might address your use case? One thing that stands out as different after giving it a brief glance is that your implementation automatically decides to move to an inner form but the textobjects plugin would require separate keybindings. If that's not a good enough solution then maybe it's something we can consider adding. Let me know your thoughts. Also relevant here is #49 (which I haven't yet replied to either 😅) |
I absolutely understand. It's a pet peeve of mine when plugins end up bloated with unnecessary features and functionality. This was a main aspect that drew me to nvim-paredit; everything feels like it belongs. As there were a few core "motions" already in the API, I figured it may be useful to provide a different method for advancing the cursor. (I think the core of my It's been a little while since I've looked into nvim-treesitter-textobjects, but I'll give it another look. On a cursory glance, it does seem to be more geared to imperative code, rather than s-expression selection/manipulation. Please feel free to resolve this issue. Thank you for your consideration. |
Turns out I got kinda fixated playing around with this concept. Spent a while iterating on movements, if you're interested in taking a look. https://github.com/carlinigraphy/scm-edit.nvim/blob/main/lua/scm-edit/motions.lua I find the |
Hi @julienvincent, I haven't done any meaningful treesitter configuration, but I'd be interested to try if it can get this functionality:
|
I'm revisiting this issue now and on second thought I think I'd be happy to accept PR's that add this kind of functionality. If someone is interested in working on this I think it would an appropriate addition to nvim-paredit. |
I've been starting a few new scheme projects, and have been thinking about this plugin often. If it doesn't end up being too much of a hassle, I'll try to draft a PR. I have the core working, but the guts are fundamentally different. Not sure if I can easily port over. |
Love the plugin. The tree-sitter API is absolutely the correct way to go about s-expr editing. The only feature I find missing is the ability to jump to the sibling form's start/end. (Not the existing functionality of jumping to the parent's start/end.)
I spent the weekend drafting a brief example.
api/motions.lua
I haven't implemented the details to also jump to the form end, or jump to previous start/end, but I think this should serve as a solid baseline if you're interested.
The text was updated successfully, but these errors were encountered: