-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add a hover-minor-mode to premit user can define key map on it (And can remove keybinding when disable it) #12
Comments
hum, we do have a map for hover to add custom keybindings (define-key hover-mode-map (kbd "C-x q") #'hover-kill) |
So, maybe i misunderstood somethings, hover-mode-map, is for hover-mode, right? it for the buffer of Anyway, because hover not support Chinese character, i have to switch to and back ... |
Well, you can define your own bindings in any map you want, like dart-mode-map for example. |
The reason is, i want to use same keybinding when work with lsp-dart or hover. please check my config: ;; for lsp-dart
(require 'dart-mode)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
(with-eval-after-load 'lsp-mode
(setq lsp-signature-auto-activate nil)
;; (setq lsp-dart-dap-flutter-hot-reload-on-save t)
(define-key dart-mode-map (kbd "C-M-x") 'lsp-dart-dap-flutter-hot-reload)
(define-key dart-mode-map (kbd "<escape>") 'lsp-dart-show-flutter-outline)
(add-hook 'dart-mode-hook 'lsp)
)
;; for hover
;; (require 'hover)
(with-eval-after-load 'hover
(define-key dart-mode-map (kbd "C-M-x") 'hover-run-or-hot-restart)
(define-key hover-mode-map (kbd "C-M-x") 'hover-run-or-hot-reload)
(setq
hover-screenshot-path (concat (getenv "HOME") "/Pictures")
hover-screenshot-prefix "magpie-"
hover-observatory-uri "http://127.0.0.1:50300"
hover-clear-buffer-on-hot-restart t
hover-hot-reload-on-save t
)
)
you can see in my config, both sure i can define use different keybinding for hover restart and lsp-dart reload, but that not good, because they do almost same things, right? if we have hover-minor-mode like this: (defvar hover-minor-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-M-x") 'hover-run-or-hot-restart)
map)
"Keymap for function `hover-minor-mode'.")
;;;###autoload
(define-minor-mode hover-minor-mode
"add keybinding."
:lighter " hover"
:keymap hover-minor-mode-map
:group 'hover) When i enable this minor mode, i can use user can always select disable or enable this minor mode when starting emacs use config. |
Alright, my point is that we would create a empty minor-mode on hover that does nothing (the define-key or yours makes sense for you but not for everyone), it seems you can already solve that with the code you provided in your config right? |
Yes, anyway, i expected to write less code in my config. i consider this is a quite usual way to resolve this issue, it very suitable for current case, you can add the default binding of yours as hover-minor-mode default keybinding, that fine, because i can always rebinding/unbinding it, even, let user to enable this minor mode (set minor mode disable as default) |
yeah, anyway, I think we can have this common minor mode on hover.el for users tweak as well, sounds ok to me |
Okay, thank you, we need improve README.md too for mention it, i can contribute a PR for this, but mostly, my bad english need tweak a lot i guess, so, please do it. 😄 |
I create a PR for this, please check |
@ericdallo , BTW, i don't know if flutter linux desktop if works on your's NixOS, for recent days, i found our project start to working on linux desktop, use linux desktop with lsp-dart, give me a much better experience then android emulator too, so, if you never try it, pleave give a try, it even more better then hover on some aspects, e.g. chinese input method support. |
Makes sense @zw963, we use at work because of complex plugins setups, but it should work as well the flutter desktop, thanks for the info |
What i means is, like this:
The text was updated successfully, but these errors were encountered: