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

Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. #1590

Open
sakurawald opened this issue Nov 8, 2024 · 3 comments

Comments

@sakurawald
Copy link
Contributor

sakurawald commented Nov 8, 2024

I am using vi-mode in sdl2 version lem.
If you use mouse click, to select a region.
And then using keyboard to use vi commands, the selected region still be slected, and is not count as the vi-visual mode.

To let the vi-mode works normally, you have to type escape or click the mouse again, to un-mark the selected region.
However, i want to know if there is a way to un-mark the selected region selected by mouse-click automatically while entering the vi-mode.

image

@sakurawald
Copy link
Contributor Author

I didn't find a universal way to defien escape key sequence for vi-mode, so i do this:

;; use jk to escape vim. (use v key to escape in visual mode)
(define-key lem-vi-mode:*insert-keymap* "j k" 'lem-vi-mode/commands:vi-normal)
(define-key lem-vi-mode:*ex-keymap* "j k" 'lem-vi-mode/commands:vi-normal)

(define-key lem-vi-mode:*normal-keymap* "Space j k" 'escape)

@sakurawald
Copy link
Contributor Author

That's annoy, since if you use mouse click to select a region, then the vi-mode still in NORMAL instead of VISUAL.

@sakurawald
Copy link
Contributor Author

sakurawald commented Nov 9, 2024

Maybe one solution is to, write 2 hooks:

  1. on region marked, switch to vi-visual-mode
  2. on region un-marked, swtich to vi-normal-mode

However, i don't know how to do this, and wheter there are existing hooks for this purpose.

@sakurawald sakurawald changed the title Un-mark the selected region automatically in vi-mode. sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Nov 15, 2024
@vindarel vindarel changed the title sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Nov 19, 2024
@vindarel vindarel changed the title Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Nov 19, 2024
@vindarel vindarel changed the title Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Feature: sync the mark region between vi-visual-mode and the mark region selected by mouse-clicking. Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants