Skip to content

Comments

Change vi-mode to a global minor mode to make its keybinds' priority high#992

Closed
fukamachi wants to merge 2 commits intolem-project:mainfrom
fukamachi:vi-global-minor-mode
Closed

Change vi-mode to a global minor mode to make its keybinds' priority high#992
fukamachi wants to merge 2 commits intolem-project:mainfrom
fukamachi:vi-global-minor-mode

Conversation

@fukamachi
Copy link
Collaborator

This fixes that Return adds a newline even in NORMAL mode with lisp-mode.

@fukamachi fukamachi marked this pull request as draft August 23, 2023 06:14
@fukamachi fukamachi marked this pull request as ready for review August 23, 2023 08:07
@fukamachi
Copy link
Collaborator Author

fukamachi commented Aug 23, 2023

This resolves most cases of keybinding, but it is not perfect. For example, vi-mode's keymap precedes directory-mode's, so Return doesn't work in directory-mode.

While Lem doesn't have as many layers as Emacs, such as buffer-local keymaps, this kind of problem remains.

@fukamachi fukamachi marked this pull request as draft August 23, 2023 13:12
@fukamachi
Copy link
Collaborator Author

Buffer-local keymap and buffer-created hook are required to change keybindings for each mode flexibly.

@fukamachi
Copy link
Collaborator Author

Without them, it can be achieved by overwriting execute method, like:

(defmethod execute ((mode directory-mode) (command vi-return) uarg)
  (declare (ignore uarg))
  (directory-mode-find-file))

However, M-x describe-key <Return> still says it's bound to vi-return, and all commands have to be overwritten.

@fukamachi
Copy link
Collaborator Author

Will be fixed in a different way at #1008.

@fukamachi fukamachi closed this Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant