-
Notifications
You must be signed in to change notification settings - Fork 23
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
Support for lispy-tab #33
Comments
I personally just use
|
lispy--normalize-1 does mainly 2 things (as far as I know) beside
indentation:
- It squeezes all whitespace.
- It puts all parenthesis on the lines where they belong.
It might not sound so useful if you've got good lisp-y habits and always
write your code with good style, but the point is that it allows you to
completely leave aside the good manners and let you go berserk writing
code faster than you ever did. (In my opinion.)
What would the expected behavior be? Act on top-level forms only or forms at the earliest level in the region only?
I'm not sure I understand. `lispy--normalize` is recursive, if that was
a misunderstanding.
My suggestion is as follows:
- `==` works on the s-exp at point (instead of the line).
- And for the others, same rule: works on the surrounding s-exp. If
there is more than one block (e.g. `gg=G`) then process them all.
|
Right, so it would be redundant to use it on a sexp within an already normalized sexp (which is why I mentioned same level options). I ask this because I'm not sure what behavior would be most preferable and some behaviors would be easier to implement. Consider this example: (foo
(bar
~(baz)
(qux)))
| Basic summary of some possiblities:
1 is less precise, and since you could just use a text object for the top level form if you wanted, it's probably preferable to be more precise. I'm leaning towards 3 or 5. What would your preference be? |
What are `~` and `|`? Mark and point?
Agreed, I think it's better to lean towards more precision. For now, I'm not sure which one I'd like better, I guess I need some time and practice to figure it out.
|
Yes. I went ahead and added an experimental |
Looks great so far! |
@noctuid After calling |
I still haven't exactly decided how point restoration should work. Would you care to post some before/after examples with |
@noctuid Sure!
It jumps to the beginning of the buffer after prettifying. I want it to stay where it was. |
- Add key theme - Add basic test - Add section to readme Addresses #33.
I've made some minor changes and added a key theme that remaps
This seems like the expected behavior for this case as using a marker will move the point to the previous line. However, when characters before the buffer position are deleted, this doesn't work the same:
Neither stays with the closing paren for this case, but the marker behavior makes a little more sense. This issue could be avoided by using the 2nd behavior and only normalizing lists that start within the region. This would prevent characters from before the point from being deleted, but it seems a little less convenient (e.g. for the above examples you would need to use The choice doesn't seem obvious to me, so any feedback would be appreciated. |
👍🏻
Does =a solve the preservation problem? If so, that’s better. If not, go
with the marker solution? If someone improves the marker system this will
automatically improve.
…On Wed, Mar 28, 2018 at 1:28 AM Fox Kiester ***@***.***> wrote:
I've made some minor changes and added a key theme that remaps evil-indent.
The main issue is whether the point should be preserved by buffer position
or a marker. For example, by position:
(foo
|a
)
;; with == becomes
(foo
|a)
This seems like the expected behavior for this case as using a marker will
move the point to the previous line. However, when characters before the
buffer position are deleted, this doesn't work the same:
(foo
|)
(bar)
;; with == becomes
(foo)
|(bar)
;; or using a marker becomes
|(foo)
(bar)
Neither stays with the closing paren for this case, but the marker
behavior makes a little more sense.
This issue could be avoided by using the 2nd behavior and only normalizing
lists that start within the region. This would prevent characters from
before the point from being deleted, but it seems a little less convenient
(e.g. for the above examples you would need to use =a( instead of ==).
The choice doesn't seem obvious to me, so any feedback would be
appreciated.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aii--nrGTf-1NCUnzAAEI-iS_xaTgTkgks5tiqfdgaJpZM4SHnjU>
.
|
It looks like the reason markers don't work as expected is because lispy actually deletes the entire sexp and then re-inserts it, so the marker just ends up before the newly inserted sexp. I can't think of any sane workaround at the moment. |
@noctuid: Could you update |
I find lispy-tab super useful, but it's mapping to Evil is not obvious since it serves both for folding (usually TAB) and for indenting (usually
=
).The indentation part is done by
lispy--normalize
. This function is so good it'd be fantastic to be able to run it over the whole buffer. Don't know Ifgg=G
can do that... :)The text was updated successfully, but these errors were encountered: