Explain relationship between 'c' and 'config.set' better

[ci skip]
This commit is contained in:
Florian Bruhin 2017-09-22 11:33:42 +02:00
parent 43ab27634f
commit d9a3268405

View File

@ -88,7 +88,9 @@ Two global objects are pre-defined when running `config.py`: `c` and `config`.
Changing settings Changing settings
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
`c` is a shorthand object to easily set settings like this: While you can set settings using the `config.set()` method (which is explained
in the next section), it's easier to use the `c` shorthand object to easily set
settings like this:
.config.py: .config.py:
[source,python] [source,python]
@ -136,6 +138,8 @@ If you want to set settings based on their name as a string, use the
.config.py: .config.py:
[source,python] [source,python]
---- ----
# Equivalent to:
# c.content.javascript.enabled = False
config.set('content.javascript.enabled', False) config.set('content.javascript.enabled', False)
---- ----
@ -143,6 +147,8 @@ To read a setting, use the `config.get` method:
[source,python] [source,python]
---- ----
# Equivalent to:
# color = c.colors.completion.fg
color = config.get('colors.completion.fg') color = config.get('colors.completion.fg')
---- ----