描述
Split off from https://github.com/qutebrowser/qutebrowser/issues/499#issuecomment-306508021 with some minor changes (adding :config-unset and :config-source, removing :conf-replace, see @lamarpavel's answer to the original comment):
What I haven't really talked about above is how the commands will look to edit some more complex setting types (like lists or dictionaries) from qutebrowser.
Things which used to be a section (like searchengines) will now be a dictionary, and the bindings will be too. There are also various things like hints -> prev/next-regexes which will actually be stored as list.
My current idea how to handle this is to add a few new :config-* commands, with :set being an alias to :config-set because :set is just a common thing to have.
Setting
-
:config-set(aka:set) will take a JSON syntax to set the elements, and override any previous settings. Examples::set custom-headers '{"X-Answer": "42"}'
Resetting a setting
-
:config-unset(or:config-reset) will be needed for various reasons: -
To reset something which was customized via
:setand now is inautoconfig.ymlback to the default (i.e. removing it from theautoconfig.yml) -
With per-domain settings: To unset a per-domain setting (and go back to either the global customized value, or the default).
-
Maybe as
:config-unset --tempor so to unset all temporarily set options.
Adding
-
:config-addadds a new element to a dictionary or list. Maybe with a--replaceswitch needed to override existing values.
Examples:
:config-add custom-headers X-Answer 42:config-add searchengines wiki https://en.wikipedia.org/wiki/{}:config-add next-regexes weiter
Removing
-
:config-removeremoves an element by key (dicts) or value (lists).
Examples:
:config-remove custom-headers X-Answer:config-remove searchengines wiki:config-remove next-regexes weiter
Replacing
-
:config-replacesearches an element as per above, and replaces the value.
Examples:
:config-replace custom-headers X-Answer 23:config-replace searchengines wiki https://de.wikipedia.org/wiki/{}:config-replace next-regexes weiter [Ww]eiter
Toggling
-
:config-list-toggleeither adds to or removes from a list. This can be useful for user stylesheets. Maybe better as part of:config-replacethough?
Examples:
:config-list-toggle content.user_stylesheets ~/.../darkmode.css
Source
-
:config-sourcereloads the config (see #54). It can take a filename to load that file instead. It should maybe support bothautoconfig.ymlandconfig.pylike files.
Examples:
:config-source(reloadautoconfig.ymlandconfig.py):config-source ~/.config/qutebrowser/night.py(could be used to set a user CSS and recolor the UI; like a theme)
Editing
-
:config-editto open theconfig.pyfile in the configured editor.
--
Thoughts? Any other modifications which should be supported?