Skip to content

Conversation

naryl
Copy link

@naryl naryl commented Oct 2, 2024

Fixing some discrepancies with vim as I stumble upon them.

Fixed:

  • C-u/C-d should scroll half a page by default and preserve cursor location relative to window.
  • % when not on a paren should find the following paren on the same line and then do its jump.

Found, not fixed:

  • ` is not implemented.
  • () and {} motions are not implemented.

@naryl
Copy link
Author

naryl commented Oct 2, 2024

C-u/C-d depends on this: #1556

@naryl
Copy link
Author

naryl commented Oct 4, 2024

{} are already implemented, they just get overriden by paredit-mode. This makes them work properly:

(define-key lem-paredit-mode:*paredit-mode-keymap* "{" nil)
(define-key lem-paredit-mode:*paredit-mode-keymap* "}" nil)
(define-key lem-vi-mode:*insert-keymap* "{" 'lem-paredit-mode:paredit-insert-brace)
(define-key lem-vi-mode:*insert-keymap* "}" 'lem-paredit-mode:paredit-close-brace)

I feel like there should be a better way to make vi-mode and paredit-mode be nice to each other.

@naryl naryl marked this pull request as ready for review October 4, 2024 13:46
@cxxxr cxxxr merged commit c3c2ce7 into lem-project:main Oct 4, 2024
2 checks passed
(loop :until (or (syntax-open-paren-char-p (character-at point))
(syntax-closed-paren-char-p (character-at point))
(= (point-charpos point) (length (line-string point))))
:do (incf (point-charpos point)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I realized after merging that changing point-charpos breaks encapsulation.
I think it would be better to use line-end-p and character-offset instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll do it within 24h. Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it still a problem with temporary point? Like (with-point ((point (copy-point point))) ...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but copy-point is not necessary because it is used automatically with-point.
(with-point ((point point)) ...)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(apropos "line-end-p") doesn't find anything. There's a struct line-end-item-p but I don't think it's what I need here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it was end-line-p.

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.

2 participants