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

lispyville-toggle-mark-type appears to lose final character of selection on transition to visual state #283

Open
bpstahlman opened this issue Feb 1, 2021 · 2 comments
Labels

Comments

@bpstahlman
Copy link

bpstahlman commented Feb 1, 2021

I'm using the mark-toggle and mark-special key themes, and I have the following in my init.el to allow me to toggle between special and visual states:

(eval-after-load 'lispyville
  `(progn
     (lispy-define-key lispy-mode-map "v" #'lispyville-toggle-mark-type)))

If I enter lispy special on the start of a parenthesized sexp, then hit m, the entire sexp is selected as expected. But if I want to copy the sexp, I use v to toggle to evil visual state (since y in lispy special is mapped to non-copy functionality). Although the call to lispyville-toggle-mark-type does indeed toggle state from lispy special to evil visual, the resulting visual region does not include the closing parenthesis. Is this a bug, or do I likely have something misconfigured? Also, am I going about this all wrong? Is there a better way to copy (yank) a sexp? Lispy's C-y doesn't work because its mapped in evil insert state to evil-copy-from-above and in evil normal state to evil-scroll-line-up. I guess I could use lispy's n command, but I'm wondering if there's an operator-based, idiomatic Vim way to perform copies, which is sexp-aware...

Edit: I should have mentioned that the off-by-one cursor issue happens only when cursor is at the end of the region when I hit v: for instance, if I hit d to move to the start of the region after marking the sexp but before hitting v, there's no issue.

Also, I just remembered the "text-objects" theme, which I'm thinking may provide the idiomatic yank/delete operator capability I was looking for... I'll try playing around with that. IIUC, the text-objects are supposed to work without targets.el, correct?

@noctuid
Copy link
Owner

noctuid commented Apr 6, 2021

Do you have evil-move-cursor-back as t? Fixing this may be as simple as letting it to nil inside lispyville-toggle-mark-type. I will add some tests and fix it.

Yes, I would use a text object. The current text objects will work without targets.el, but I don't remember how well they work. They won't be fully robust until I've finished things.el, and that won't happen anytime soon.

@noctuid noctuid added the bug label Apr 6, 2021
@bpstahlman
Copy link
Author

I do have evil-move-cursor-back set to t, but I think the culprit is evil-move-beyond-eol, which was set to nil. Setting it seems to fix the issue.

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

No branches or pull requests

2 participants