Hi, I’m new to nyxt, and I have a question on setting up nyxt with a custom config. With the following config, when I press j on a web page to invoke follow-hint, the hint prompt would not show up, and I’d get the following error:
WARN - Warning: Error on GTK thread: The value
NIL
is not of type
NKEYMAPS/CORE:KEYMAP
when binding NKEYMAPS/CORE:KEYMAP
If I comment out the last define-configuration, the hint prompt would work as expected. Do you know how I could fix it? Thank you.
(defvar *web-buffer-modes*
'(:emacs-mode :no-script-mode :blocker-mode))
(define-configuration web-buffer
((default-modes `(,@*web-buffer-modes* ,@%slot-value%))))
(define-configuration (:modable-buffer :prompt-buffer :editor-buffer)
"Set up Emacs keybindings everywhere possible."
((default-modes `(:emacs-mode ,@%slot-value%))))
(define-configuration :hint-mode
"Set up QWERTY home row as the hint keys."
((hints-alphabet "ASDFGHJKL")))
(define-configuration :document-mode
"Document mode keybindings."
((keyscheme-map
(keymaps:define-keyscheme-map
"my-document" (list :import %slot-value%)
nyxt/keyscheme:emacs
(list
"B" 'switch-buffer-previous
"F" 'switch-buffer-next
"b" 'scroll-left
"f" 'scroll-right
"i" 'jump-to-heading
"g" 'reload-current-buffer
"j" 'follow-hint
"J" 'follow-hint-new-buffer
"k" 'delete-current-buffer
"l" 'history-bakcwards
"n" 'scroll-down
"o" 'set-url
"p" 'scroll-up
"r" 'history-forwards
"w" 'copy-url
"<" 'scroll-to-top
">" 'scroll-to-bottom
"C-h x" 'describe-command
"C-s" :search-buffer
"C-z" 'switch-buffer
"M-n" 'next-heading
"M-p" 'previous-heading
)))))
;; if I comment out the following then prompt works
(define-configuration :prompt-buffer-mode
"Prompt buffer mode keybindings."
((keyscheme-map
(keymaps:define-keyscheme-map
"my-prompt-buffer" (list :import %slot-value%)
nyxt/keyscheme:emacs
(list
"C-s" 'next-suggestion
"C-r" 'previous-suggestion
)))))
@ycp Firstly, very interesting configuration. The keybindings you’re defining are in line with what I’d consider good defaults for the Emacs keyscheme.
I tried that with both the keyscheme-map and the override-map, but it did not make any difference. Could someone increase the priority on github given no workaround works so far?
Or maybe let’s forget about my config. What is the config out there that most faithfully follows emacs keybinding? Is there any config out there that binds C-s/C-r to next/previous-suggestion in prompt buffer?
@ycp you can assign keybindings in the prompt buffer as you wish. The issue arises when you have the same key (say C-r) bound in the prompt buffer document-mode.
@aadcg I don’t quite understand your comment. What do you mean by “same key”? I mean C-r does not appear more than once in the config.
Could you suggest a workaround? I tried override-map but it did not make any difference (see my previous comment about my attempt). I am new to nyxt, but this has been the issue stopping me from continuing to try nyxt.
@aadcg OK C-s does appear twice in my config, but removing one occurrence (from document-mode, say) does not fix the issue. Also in your minimal reprod config file in the github issue, C-s also only appears once. So I am still not sure what you mean by “same key”.