Right way to modify keybindings in visual mode?

Hi all, im new to nyxt, so maybe it’s a dumb question.

I want to change some keybindings in visual mode and has already some ideas, but i’m not sure which one is the common way to do that, here is my thought:

First, visual mode is seems like not a buffer, so i can’t modify it by define-configuration(am i right?), so i can either re-define the visual mode to override the original one or maybe add a hook after visual mode, and use this hook to change my keybindings.

But i don’t think this two solutions are “elegant”, that’s why i asked here :slight_smile:

Hello. You actually can configure visual-mode (as most of Nyxt entities) via define-configuration. The snippet you can modify keybindings with is something like:

;; visual-mode is configurable, but you need to use proper package prefix for that.
(define-configuration nyxt/visual-mode:visual-mode
  ((keymap-scheme (let ((scheme %slot-default%))
                    ;; Use scheme:cua or scheme:vi-normal, if that strikes your fancy.
                    (keymap:define-key (gethash scheme:emacs scheme)
                      ;; Put as much keybindings as you want here.
                      "M-C-s-z" 'reload-current-buffer)

Note that this overrides old keybindings if you list them explicitly, so no need to re-create the keymap.

1 Like

oh great! That’s exactly what i want. Thanks :kissing_heart: