I am trying to customize nyxt with new functions but I can’t figure out how. The manual shows an example command being defined #, but does not say WHERE it should be defined. Using the repl works but the changes aren’t persisted. I tried defining a new command in numerous files but none worked. I tried also modifying the copy-url function slightly to give it a new name in the buffer.lisp file, but those changes where not picked up either.
So, suppose I want a new command that copies both url and title to the clipboard together, where should I define that command? And, if I want to modify the current copy-url command, how should I do that? I spent hours reading the manual but made no progress.
New or modified versions of commands need to be added to your config file, which is located at ~/.config/nyxt/config.lisp. If you read the manual from Nyxt itself (visit URL nyxt:manual#configuration), you’ll find this information in detail.
To modify an existing command, you just need to define it with the same name. Example:
(define-command copy-url ()
"Save current URL to clipboard."
(echo "I am a modified version of the copy-url command."))
All feedback on the manual is welcome and I’d like to encourage you to open a PR so that we improve it together. Thanks!
Ah yes that does the trick. I was flicking between the manual in nyxt and the webpage and assumed they where the same, but I will take another look and see if a PR is in order. Cheers!
They’re the same, and they’re always in sync. But when you open Nyxt browser: Documentation you’ll see that the the excerpt Any settings can be overridden manually by /home/doe/.config/nyxt/config.lisp differs from what you see from Nyxt. I.e. “doe” is replaced by your system’s account name. It may confuse some people.
Do you know why I can fuzzy search existing commands, so I can type copy- in the command buffer and copy-url and copy-title show up, but to find my new command I have to type it’s whole name: copy-url-and-title, and then it shows as a lisp expression.
You need to show me how you have defined the command.
Adding (define-command hello-world () "Test" (echo "Hello!")) to the config, allows you to call the command hello-world when you invoke execute-command.
Using your example (and having an otherwise empty config), I have to type the whole hello-world for it to show up, and it then shows under Lisp expression. I just wondered why the difference with other commands which allow partial matching?