lispyville-toggle-mark-type appears to lose final character of selection on transition to visual state
bpstahlman opened this issue · 2 comments
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?
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.
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.