Skip to content
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

[DRAFT] feature: recenter line if jump target point is not inside window. (vi-mode) #1695

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sakurawald
Copy link
Contributor

In vim, the jump-back and jump-next will recenter jump target line if the line is not inside the window before jump.

@sakurawald
Copy link
Contributor Author

The code is formatted by the default formatter provided by lem.
I didn't know why the identation is different from the original file. It's annoy, each time i have to reset the identation differs.

@sakurawald
Copy link
Contributor Author

sakurawald commented Dec 9, 2024

Sorry, i didn't notice that 1 line code is deleted accidently. Now the CI tests will pass.

@sakurawald
Copy link
Contributor Author

I remove the target-point binding in let form, and document the return value of (jump-back) and (jump-next).
It looks clearer.

@sakurawald sakurawald changed the title feature: recenter line if jump target point is not inside window. (vi-mode) [DRAFT] feature: recenter line if jump target point is not inside window. (vi-mode) Dec 10, 2024
@sakurawald
Copy link
Contributor Author

sakurawald commented Dec 10, 2024

I make this pr a draft, and considering make it a feature in lem.

A new line positioning strategy to re-position where the line should the cursor in after jumping the point. Or to say, a function line-view-position-function to be called after we move-point to a new point.

The strategy can be: none, recenter-current-line-if-new-point-is-not-inside-original-window-view, scroll-line-to-top-of-window, scroll-line-to-bottom-of-window.

We can introduce a new special variable named line-positioning-strategy and making it integrate with the move-point function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant