diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 420a66e59..2e39355c0 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -25,8 +25,11 @@ Added opened from a page should stack on each other or not. - New `completion.open_categories` setting which allows to configure which categories are shown in the `:open` completion, and how they are ordered. -- New `:config-add-dict` and `:config-add-list` commands to easily add a new - element to a dict/list setting. +- New config manipulation commands: + * `:config-add-dict` and `:config-add-list` to a new element to a dict/list + setting. + * `:config-remove-dict` and `:config-remove-list` to remove an element from a + dict/list setting. - New `hints.selectors` setting which allows to configure what CSS selectors are used for hints, and also allows adding custom hint groups. diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 51903da11..b2f85d905 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -41,6 +41,8 @@ It is possible to run or bind multiple commands by separating them with `;;`. |<>|Set all settings back to their default. |<>|Cycle an option between multiple values. |<>|Open the config.py file in the editor. +|<>|Remove a key from a dict. +|<>|Remove a value from a list. |<>|Read a config.py file. |<>|Unset an option. |<>|Write the current configuration to a config.py file. @@ -280,7 +282,7 @@ Add a key/value pair to a dictionary option. * +'value'+: The value to place in the dictionary. ==== optional arguments -* +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed. +* +*-t*+, +*--temp*+: Add value temporarily until qutebrowser is closed. * +*-r*+, +*--replace*+: Replace existing values. By default, existing values are not overwritten. @@ -295,7 +297,7 @@ Append a value to a config option that is a list. * +'value'+: The value to append to the end of the list. ==== optional arguments -* +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed. +* +*-t*+, +*--temp*+: Add value temporarily until qutebrowser is closed. [[config-clear]] === config-clear @@ -332,6 +334,32 @@ Open the config.py file in the editor. ==== optional arguments * +*-n*+, +*--no-source*+: Don't re-source the config file after editing. +[[config-remove-dict]] +=== config-remove-dict +Syntax: +:config-remove-dict [*--temp*] 'option' 'key'+ + +Remove a key from a dict. + +==== positional arguments +* +'option'+: The name of the option. +* +'key'+: The key to remove from the dict. + +==== optional arguments +* +*-t*+, +*--temp*+: Remove value temporarily until qutebrowser is closed. + +[[config-remove-list]] +=== config-remove-list +Syntax: +:config-remove-list [*--temp*] 'option' 'value'+ + +Remove a value from a list. + +==== positional arguments +* +'option'+: The name of the option. +* +'value'+: The value to remove from the list. + +==== optional arguments +* +*-t*+, +*--temp*+: Remove value temporarily until qutebrowser is closed. + [[config-source]] === config-source Syntax: +:config-source [*--clear*] ['filename']+ diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 01fd9950b..d71d16351 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -258,7 +258,7 @@ class ConfigCommands: Args: option: The name of the option. value: The value to append to the end of the list. - temp: Set value temporarily until qutebrowser is closed. + temp: Add value temporarily until qutebrowser is closed. """ opt = self._config.get_opt(option) valid_list_types = (configtypes.List, configtypes.ListOrValue) @@ -280,7 +280,7 @@ class ConfigCommands: option: The name of the option. key: The key to use. value: The value to place in the dictionary. - temp: Set value temporarily until qutebrowser is closed. + temp: Add value temporarily until qutebrowser is closed. replace: Replace existing values. By default, existing values are not overwritten. """ @@ -308,7 +308,7 @@ class ConfigCommands: Args: option: The name of the option. value: The value to remove from the list. - temp: Set value temporarily until qutebrowser is closed. + temp: Remove value temporarily until qutebrowser is closed. """ opt = self._config.get_opt(option) valid_list_types = (configtypes.List, configtypes.ListOrValue) @@ -335,7 +335,7 @@ class ConfigCommands: Args: option: The name of the option. key: The key to remove from the dict. - temp: Set value temporarily until qutebrowser is closed. + temp: Remove value temporarily until qutebrowser is closed. """ opt = self._config.get_opt(option) if not isinstance(opt.typ, configtypes.Dict): diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py index 4bf3b7691..a726500cf 100644 --- a/tests/unit/config/test_configcommands.py +++ b/tests/unit/config/test_configcommands.py @@ -357,7 +357,7 @@ class TestAdd: class TestRemove: - """Test :config-add-list and :config-add-dict.""" + """Test :config-remove-list and :config-remove-dict.""" @pytest.mark.parametrize('value', ['25%', '50%']) @pytest.mark.parametrize('temp', [True, False])