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
Flow movements #23
Merged
Merged
Flow movements #23
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
considering incorporating the BRACKET jumps into the same function, so I wanted to establish a rollback point.
non-list elements crossing list boundaries) are basically working. Checking in work before beginning on documentation and cleanup.
Just realized there's a good use-case for visual mode versions of these commands. Establishing a rollback point before implementing...
flow commands need cursor to remain on near side of element when visual mode is re-activated, added an optional arg to select_current_marks(), which allows desired cursor position (which obviously must correspond to one of the visual marks) to be specified. Need to clean up and document. Also need to add visual mode support for the element flow commands.
whether to modify logic to use end of visual selection in desired direction as start of search. Currently, I use cursor position unconditionally, but it occurs to me that if a single element is selected, it's likely the user would want the jump to move to a different element, not just a different side of the current one.
the documentation. Did a bit of cleanup and commenting in the source file, but more is needed...
list flow commands to note the distinction between in/out flow. Began (but didn't finish) updating the documentation. Also, changed "element" to "nonlist" in what were previously known as "element flow" commands, to reflect the fact that a list can't be a target of a non-list flow command (though a list can be an element in normal vim-sexp parlance).
naming changes, but wanted to backup.
documentation to reflect the changes. A bit more cleanup needed, but wanted to establish rollback point before picking one of the alternate presentations of the list flow command documentation.
bit more rework to handle character literals and comments properly.
however, I'm thinking of going to a simpler fix, which is more robust, albeit possibly a bit less efficient.
was added to handle some edge cases that aren't handled any where else in vim-sexp.
Reworked handling of BOF/EOF for list_flow to make more consistent with the philosophy of accepting whatever we find as target: e.g., I now select the list corresponding to the final bracket of desired type, even if cursor started on it. Also, fixed bug whereby only parens were treated as brackets. --leaf_flow-- Simplified logic significantly after deciding not to handle (admittedly somewhat pathological) edge cases that the rest of vim-sexp doesn't handle. Commented the rationale in the function header. --Cleanup-- Final review and commenting of flow functions (both list and leaf). Removed alternate (but now dead) implementations of leaf_flow.
should have been used.
Impressive changes. Now that this is implemented, I can see the ergonomic benefits. |
Thanks!
…On Mon, May 15, 2017 at 11:25 AM, Sung Pae ***@***.***> wrote:
Impressive changes. Now that this is implemented, I can see the ergonomic
benefits.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#23 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC7pQDRIX-stdCFpigw4r5ROJw6W-B6Eks5r6HyFgaJpZM4Nadh9>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Synopsis
Adds commands for moving in and out of lists in a way that's not possible with vim-sexp's other movement commands. Something like Paredit's up/down list commands, but with a traversal paradigm inspired by the Emacs Lispy package's "flow" command.
Motivation
Although vim-sexp already provides commands for moving forward and backward within a list, sometimes you want to "escape" from the current list, or descend into a child list. The added commands are called "flow commands" because they permit you to flow freely in and out of lists. In fact, it is possible to use an unbroken sequence of flow commands to move all the way from one end of the buffer to the other. Flow commands fall into 2 basic categories:
List
Land only on brackets. There are 4 variants, differentiated by both the direction moved in the buffer, and the type of bracket landed on (open or close).
Leaf
Land only on leaf (non-list) elements (atoms, strings, comments)
See doc/vim-sexp.txt for details and examples...