diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 38f76ac9b..67a70d049 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -254,7 +254,11 @@ == aliases Aliases for commands. -Default: +pass:[{"w": "session-save", "q": "quit", "wq": "quit --save"}]+ +Default: + +- +pass:[q]+: +pass:[quit]+ +- +pass:[w]+: +pass:[session-save]+ +- +pass:[wq]+: +pass:[quit --save]+ [[auto_save.config]] == auto_save.config @@ -343,6 +347,256 @@ Default keybindings. If you want to add bindings, modify `bindings.commands` ins The main purpose of this setting is that you can set it to an empty dictionary if you want to load no default keybindings at all. If you want to preserve default bindings (and get new bindings when there is an update), add new bindings to `bindings.commands` (or use `:bind`) and leave this setting alone. +Default: + +- +pass:[caret]+: + +* +pass:[$]+: +pass:[move-to-end-of-line]+ +* +pass:[0]+: +pass:[move-to-start-of-line]+ +* +pass:[<Ctrl-Space>]+: +pass:[drop-selection]+ +* +pass:[<Escape>]+: +pass:[leave-mode]+ +* +pass:[<Return>]+: +pass:[yank selection]+ +* +pass:[<Space>]+: +pass:[toggle-selection]+ +* +pass:[G]+: +pass:[move-to-end-of-document]+ +* +pass:[H]+: +pass:[scroll left]+ +* +pass:[J]+: +pass:[scroll down]+ +* +pass:[K]+: +pass:[scroll up]+ +* +pass:[L]+: +pass:[scroll right]+ +* +pass:[Y]+: +pass:[yank selection -s]+ +* +pass:[[]+: +pass:[move-to-start-of-prev-block]+ +* +pass:[]]+: +pass:[move-to-start-of-next-block]+ +* +pass:[b]+: +pass:[move-to-prev-word]+ +* +pass:[c]+: +pass:[enter-mode normal]+ +* +pass:[e]+: +pass:[move-to-end-of-word]+ +* +pass:[gg]+: +pass:[move-to-start-of-document]+ +* +pass:[h]+: +pass:[move-to-prev-char]+ +* +pass:[j]+: +pass:[move-to-next-line]+ +* +pass:[k]+: +pass:[move-to-prev-line]+ +* +pass:[l]+: +pass:[move-to-next-char]+ +* +pass:[v]+: +pass:[toggle-selection]+ +* +pass:[w]+: +pass:[move-to-next-word]+ +* +pass:[y]+: +pass:[yank selection]+ +* +pass:[{]+: +pass:[move-to-end-of-prev-block]+ +* +pass:[}]+: +pass:[move-to-end-of-next-block]+ +- +pass:[command]+: + +* +pass:[<Alt-B>]+: +pass:[rl-backward-word]+ +* +pass:[<Alt-Backspace>]+: +pass:[rl-backward-kill-word]+ +* +pass:[<Alt-D>]+: +pass:[rl-kill-word]+ +* +pass:[<Alt-F>]+: +pass:[rl-forward-word]+ +* +pass:[<Ctrl-?>]+: +pass:[rl-delete-char]+ +* +pass:[<Ctrl-A>]+: +pass:[rl-beginning-of-line]+ +* +pass:[<Ctrl-B>]+: +pass:[rl-backward-char]+ +* +pass:[<Ctrl-D>]+: +pass:[completion-item-del]+ +* +pass:[<Ctrl-E>]+: +pass:[rl-end-of-line]+ +* +pass:[<Ctrl-F>]+: +pass:[rl-forward-char]+ +* +pass:[<Ctrl-H>]+: +pass:[rl-backward-delete-char]+ +* +pass:[<Ctrl-K>]+: +pass:[rl-kill-line]+ +* +pass:[<Ctrl-N>]+: +pass:[command-history-next]+ +* +pass:[<Ctrl-P>]+: +pass:[command-history-prev]+ +* +pass:[<Ctrl-Shift-Tab>]+: +pass:[completion-item-focus prev-category]+ +* +pass:[<Ctrl-Tab>]+: +pass:[completion-item-focus next-category]+ +* +pass:[<Ctrl-U>]+: +pass:[rl-unix-line-discard]+ +* +pass:[<Ctrl-W>]+: +pass:[rl-unix-word-rubout]+ +* +pass:[<Ctrl-Y>]+: +pass:[rl-yank]+ +* +pass:[<Down>]+: +pass:[completion-item-focus next]+ +* +pass:[<Escape>]+: +pass:[leave-mode]+ +* +pass:[<Return>]+: +pass:[command-accept]+ +* +pass:[<Shift-Delete>]+: +pass:[completion-item-del]+ +* +pass:[<Shift-Tab>]+: +pass:[completion-item-focus prev]+ +* +pass:[<Tab>]+: +pass:[completion-item-focus next]+ +* +pass:[<Up>]+: +pass:[completion-item-focus prev]+ +- +pass:[hint]+: + +* +pass:[<Ctrl-B>]+: +pass:[hint all tab-bg]+ +* +pass:[<Ctrl-F>]+: +pass:[hint links]+ +* +pass:[<Ctrl-R>]+: +pass:[hint --rapid links tab-bg]+ +* +pass:[<Escape>]+: +pass:[leave-mode]+ +* +pass:[<Return>]+: +pass:[follow-hint]+ +- +pass:[insert]+: + +* +pass:[<Ctrl-E>]+: +pass:[open-editor]+ +* +pass:[<Escape>]+: +pass:[leave-mode]+ +* +pass:[<Shift-Ins>]+: +pass:[insert-text {primary}]+ +- +pass:[normal]+: + +* +pass:[']+: +pass:[enter-mode jump_mark]+ +* +pass:[+]+: +pass:[zoom-in]+ +* +pass:[-]+: +pass:[zoom-out]+ +* +pass:[.]+: +pass:[repeat-command]+ +* +pass:[/]+: +pass:[set-cmd-text /]+ +* +pass:[:]+: +pass:[set-cmd-text :]+ +* +pass:[;I]+: +pass:[hint images tab]+ +* +pass:[;O]+: +pass:[hint links fill :open -t -i {hint-url}]+ +* +pass:[;R]+: +pass:[hint --rapid links window]+ +* +pass:[;Y]+: +pass:[hint links yank-primary]+ +* +pass:[;b]+: +pass:[hint all tab-bg]+ +* +pass:[;d]+: +pass:[hint links download]+ +* +pass:[;f]+: +pass:[hint all tab-fg]+ +* +pass:[;h]+: +pass:[hint all hover]+ +* +pass:[;i]+: +pass:[hint images]+ +* +pass:[;o]+: +pass:[hint links fill :open {hint-url}]+ +* +pass:[;r]+: +pass:[hint --rapid links tab-bg]+ +* +pass:[;t]+: +pass:[hint inputs]+ +* +pass:[;y]+: +pass:[hint links yank]+ +* +pass:[<Alt-1>]+: +pass:[tab-focus 1]+ +* +pass:[<Alt-2>]+: +pass:[tab-focus 2]+ +* +pass:[<Alt-3>]+: +pass:[tab-focus 3]+ +* +pass:[<Alt-4>]+: +pass:[tab-focus 4]+ +* +pass:[<Alt-5>]+: +pass:[tab-focus 5]+ +* +pass:[<Alt-6>]+: +pass:[tab-focus 6]+ +* +pass:[<Alt-7>]+: +pass:[tab-focus 7]+ +* +pass:[<Alt-8>]+: +pass:[tab-focus 8]+ +* +pass:[<Alt-9>]+: +pass:[tab-focus -1]+ +* +pass:[<Ctrl-A>]+: +pass:[navigate increment]+ +* +pass:[<Ctrl-Alt-p>]+: +pass:[print]+ +* +pass:[<Ctrl-B>]+: +pass:[scroll-page 0 -1]+ +* +pass:[<Ctrl-D>]+: +pass:[scroll-page 0 0.5]+ +* +pass:[<Ctrl-F5>]+: +pass:[reload -f]+ +* +pass:[<Ctrl-F>]+: +pass:[scroll-page 0 1]+ +* +pass:[<Ctrl-N>]+: +pass:[open -w]+ +* +pass:[<Ctrl-PgDown>]+: +pass:[tab-next]+ +* +pass:[<Ctrl-PgUp>]+: +pass:[tab-prev]+ +* +pass:[<Ctrl-Q>]+: +pass:[quit]+ +* +pass:[<Ctrl-Return>]+: +pass:[follow-selected -t]+ +* +pass:[<Ctrl-Shift-T>]+: +pass:[undo]+ +* +pass:[<Ctrl-T>]+: +pass:[open -t]+ +* +pass:[<Ctrl-Tab>]+: +pass:[tab-focus last]+ +* +pass:[<Ctrl-U>]+: +pass:[scroll-page 0 -0.5]+ +* +pass:[<Ctrl-V>]+: +pass:[enter-mode passthrough]+ +* +pass:[<Ctrl-W>]+: +pass:[tab-close]+ +* +pass:[<Ctrl-X>]+: +pass:[navigate decrement]+ +* +pass:[<Ctrl-^>]+: +pass:[tab-focus last]+ +* +pass:[<Ctrl-h>]+: +pass:[home]+ +* +pass:[<Ctrl-p>]+: +pass:[tab-pin]+ +* +pass:[<Ctrl-s>]+: +pass:[stop]+ +* +pass:[<Escape>]+: +pass:[clear-keychain ;; search ;; fullscreen --leave]+ +* +pass:[<F11>]+: +pass:[fullscreen]+ +* +pass:[<F5>]+: +pass:[reload]+ +* +pass:[<Return>]+: +pass:[follow-selected]+ +* +pass:[<back>]+: +pass:[back]+ +* +pass:[<forward>]+: +pass:[forward]+ +* +pass:[=]+: +pass:[zoom]+ +* +pass:[?]+: +pass:[set-cmd-text ?]+ +* +pass:[@]+: +pass:[run-macro]+ +* +pass:[B]+: +pass:[set-cmd-text -s :quickmark-load -t]+ +* +pass:[D]+: +pass:[tab-close -o]+ +* +pass:[F]+: +pass:[hint all tab]+ +* +pass:[G]+: +pass:[scroll-perc]+ +* +pass:[H]+: +pass:[back]+ +* +pass:[J]+: +pass:[tab-next]+ +* +pass:[K]+: +pass:[tab-prev]+ +* +pass:[L]+: +pass:[forward]+ +* +pass:[M]+: +pass:[bookmark-add]+ +* +pass:[N]+: +pass:[search-prev]+ +* +pass:[O]+: +pass:[set-cmd-text -s :open -t]+ +* +pass:[PP]+: +pass:[open -t -- {primary}]+ +* +pass:[Pp]+: +pass:[open -t -- {clipboard}]+ +* +pass:[R]+: +pass:[reload -f]+ +* +pass:[Ss]+: +pass:[open qute://settings]+ +* +pass:[T]+: +pass:[tab-focus]+ +* +pass:[ZQ]+: +pass:[quit]+ +* +pass:[ZZ]+: +pass:[wq]+ +* +pass:[[[]+: +pass:[navigate prev]+ +* +pass:[]]]+: +pass:[navigate next]+ +* +pass:[`]+: +pass:[enter-mode set_mark]+ +* +pass:[ad]+: +pass:[download-cancel]+ +* +pass:[b]+: +pass:[set-cmd-text -s :quickmark-load]+ +* +pass:[cd]+: +pass:[download-clear]+ +* +pass:[co]+: +pass:[tab-only]+ +* +pass:[d]+: +pass:[tab-close]+ +* +pass:[f]+: +pass:[hint]+ +* +pass:[g$]+: +pass:[tab-focus -1]+ +* +pass:[g0]+: +pass:[tab-focus 1]+ +* +pass:[gB]+: +pass:[set-cmd-text -s :bookmark-load -t]+ +* +pass:[gC]+: +pass:[tab-clone]+ +* +pass:[gO]+: +pass:[set-cmd-text :open -t -i {url:pretty}]+ +* +pass:[gU]+: +pass:[navigate up -t]+ +* +pass:[g^]+: +pass:[tab-focus 1]+ +* +pass:[ga]+: +pass:[open -t]+ +* +pass:[gb]+: +pass:[set-cmd-text -s :bookmark-load]+ +* +pass:[gd]+: +pass:[download]+ +* +pass:[gf]+: +pass:[view-source]+ +* +pass:[gg]+: +pass:[scroll-perc 0]+ +* +pass:[gl]+: +pass:[tab-move -]+ +* +pass:[gm]+: +pass:[tab-move]+ +* +pass:[go]+: +pass:[set-cmd-text :open {url:pretty}]+ +* +pass:[gr]+: +pass:[tab-move +]+ +* +pass:[gt]+: +pass:[set-cmd-text -s :buffer]+ +* +pass:[gu]+: +pass:[navigate up]+ +* +pass:[h]+: +pass:[scroll left]+ +* +pass:[i]+: +pass:[enter-mode insert]+ +* +pass:[j]+: +pass:[scroll down]+ +* +pass:[k]+: +pass:[scroll up]+ +* +pass:[l]+: +pass:[scroll right]+ +* +pass:[m]+: +pass:[quickmark-save]+ +* +pass:[n]+: +pass:[search-next]+ +* +pass:[o]+: +pass:[set-cmd-text -s :open]+ +* +pass:[pP]+: +pass:[open -- {primary}]+ +* +pass:[pp]+: +pass:[open -- {clipboard}]+ +* +pass:[q]+: +pass:[record-macro]+ +* +pass:[r]+: +pass:[reload]+ +* +pass:[sf]+: +pass:[save]+ +* +pass:[sk]+: +pass:[set-cmd-text -s :bind]+ +* +pass:[sl]+: +pass:[set-cmd-text -s :set -t]+ +* +pass:[ss]+: +pass:[set-cmd-text -s :set]+ +* +pass:[th]+: +pass:[back -t]+ +* +pass:[tl]+: +pass:[forward -t]+ +* +pass:[u]+: +pass:[undo]+ +* +pass:[v]+: +pass:[enter-mode caret]+ +* +pass:[wB]+: +pass:[set-cmd-text -s :bookmark-load -w]+ +* +pass:[wO]+: +pass:[set-cmd-text :open -w {url:pretty}]+ +* +pass:[wP]+: +pass:[open -w -- {primary}]+ +* +pass:[wb]+: +pass:[set-cmd-text -s :quickmark-load -w]+ +* +pass:[wf]+: +pass:[hint all window]+ +* +pass:[wh]+: +pass:[back -w]+ +* +pass:[wi]+: +pass:[inspector]+ +* +pass:[wl]+: +pass:[forward -w]+ +* +pass:[wo]+: +pass:[set-cmd-text -s :open -w]+ +* +pass:[wp]+: +pass:[open -w -- {clipboard}]+ +* +pass:[xO]+: +pass:[set-cmd-text :open -b -i {url:pretty}]+ +* +pass:[xo]+: +pass:[set-cmd-text -s :open -b]+ +* +pass:[yD]+: +pass:[yank domain -s]+ +* +pass:[yP]+: +pass:[yank pretty-url -s]+ +* +pass:[yT]+: +pass:[yank title -s]+ +* +pass:[yY]+: +pass:[yank -s]+ +* +pass:[yd]+: +pass:[yank domain]+ +* +pass:[yp]+: +pass:[yank pretty-url]+ +* +pass:[yt]+: +pass:[yank title]+ +* +pass:[yy]+: +pass:[yank]+ +* +pass:[{{]+: +pass:[navigate prev -t]+ +* +pass:[}}]+: +pass:[navigate next -t]+ +- +pass:[passthrough]+: + +* +pass:[<Ctrl-V>]+: +pass:[leave-mode]+ +- +pass:[prompt]+: + +* +pass:[<Alt-B>]+: +pass:[rl-backward-word]+ +* +pass:[<Alt-Backspace>]+: +pass:[rl-backward-kill-word]+ +* +pass:[<Alt-D>]+: +pass:[rl-kill-word]+ +* +pass:[<Alt-F>]+: +pass:[rl-forward-word]+ +* +pass:[<Ctrl-?>]+: +pass:[rl-delete-char]+ +* +pass:[<Ctrl-A>]+: +pass:[rl-beginning-of-line]+ +* +pass:[<Ctrl-B>]+: +pass:[rl-backward-char]+ +* +pass:[<Ctrl-E>]+: +pass:[rl-end-of-line]+ +* +pass:[<Ctrl-F>]+: +pass:[rl-forward-char]+ +* +pass:[<Ctrl-H>]+: +pass:[rl-backward-delete-char]+ +* +pass:[<Ctrl-K>]+: +pass:[rl-kill-line]+ +* +pass:[<Ctrl-U>]+: +pass:[rl-unix-line-discard]+ +* +pass:[<Ctrl-W>]+: +pass:[rl-unix-word-rubout]+ +* +pass:[<Ctrl-X>]+: +pass:[prompt-open-download]+ +* +pass:[<Ctrl-Y>]+: +pass:[rl-yank]+ +* +pass:[<Down>]+: +pass:[prompt-item-focus next]+ +* +pass:[<Escape>]+: +pass:[leave-mode]+ +* +pass:[<Return>]+: +pass:[prompt-accept]+ +* +pass:[<Shift-Tab>]+: +pass:[prompt-item-focus prev]+ +* +pass:[<Tab>]+: +pass:[prompt-item-focus next]+ +* +pass:[<Up>]+: +pass:[prompt-item-focus prev]+ +* +pass:[n]+: +pass:[prompt-accept no]+ +* +pass:[y]+: +pass:[prompt-accept yes]+ +- +pass:[register]+: + +* +pass:[<Escape>]+: +pass:[leave-mode]+ [[bindings.key_mappings]] == bindings.key_mappings @@ -350,7 +604,16 @@ This setting can be used to map keys to other keys. When the key used as dictionary-key is pressed, the binding for the key used as dictionary-value is invoked instead. This is useful for global remappings of keys, for example to map Ctrl-[ to Escape. -Default: +pass:[{"<Ctrl-[>": "<Escape>", "<Ctrl-6>": "<Ctrl-^>", "<Ctrl-M>": "<Return>", "<Ctrl-J>": "<Return>", "<Shift-Return>": "<Return>", "<Enter>": "<Return>", "<Shift-Enter>": "<Return>", "<Ctrl-Enter>": "<Ctrl-Return>"}]+ +Default: + +- +pass:[<Ctrl-6>]+: +pass:[<Ctrl-^>]+ +- +pass:[<Ctrl-Enter>]+: +pass:[<Ctrl-Return>]+ +- +pass:[<Ctrl-J>]+: +pass:[<Return>]+ +- +pass:[<Ctrl-M>]+: +pass:[<Return>]+ +- +pass:[<Ctrl-[>]+: +pass:[<Escape>]+ +- +pass:[<Enter>]+: +pass:[<Return>]+ +- +pass:[<Shift-Enter>]+: +pass:[<Return>]+ +- +pass:[<Shift-Return>]+: +pass:[<Return>]+ [[colors.completion.category.bg]] == colors.completion.category.bg @@ -913,7 +1176,9 @@ Valid values: * +downloads+: Show a confirmation if downloads are running * +never+: Never show a confirmation. -Default: +pass:[["never"]]+ +Default: + +- +pass:[never]+ [[content.cache.appcache]] == content.cache.appcache @@ -1100,7 +1365,13 @@ The file can be in one of the following formats: `hosts` (with any extension). -Default: +pass:[["https://www.malwaredomainlist.com/hostslist/hosts.txt", "http://someonewhocares.org/hosts/hosts", "http://winhelp2002.mvps.org/hosts.zip", "http://malwaredomains.lehigh.edu/files/justdomains.zip", "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext"]]+ +Default: + +- +pass:[https://www.malwaredomainlist.com/hostslist/hosts.txt]+ +- +pass:[http://someonewhocares.org/hosts/hosts]+ +- +pass:[http://winhelp2002.mvps.org/hosts.zip]+ +- +pass:[http://malwaredomains.lehigh.edu/files/justdomains.zip]+ +- +pass:[https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext]+ [[content.host_blocking.whitelist]] == content.host_blocking.whitelist @@ -1108,7 +1379,9 @@ List of domains that should always be loaded, despite being ad-blocked. Domains may contain * and ? wildcards and are otherwise required to exactly match the requested domain. Local domains are always exempt from hostblocking. -Default: +pass:[["piwik.org"]]+ +Default: + +- +pass:[piwik.org]+ [[content.hyperlink_auditing]] == content.hyperlink_auditing @@ -1478,7 +1751,11 @@ Default: +pass:[-1]+ The editor (and arguments) to use for the `open-editor` command. `{}` gets replaced by the filename of the file to be edited. -Default: +pass:[["gvim", "-f", "{}"]]+ +Default: + +- +pass:[gvim]+ +- +pass:[-f]+ +- +pass:[{}]+ [[editor.encoding]] == editor.encoding @@ -1706,13 +1983,26 @@ Default: +pass:[letter]+ == hints.next_regexes A comma-separated list of regexes to use for 'next' links. -Default: +pass:[["\\bnext\\b", "\\bmore\\b", "\\bnewer\\b", "\\b[>\u2192\u226b]\\b", "\\b(>>|\u00bb)\\b", "\\bcontinue\\b"]]+ +Default: + +- +pass:[\bnext\b]+ +- +pass:[\bmore\b]+ +- +pass:[\bnewer\b]+ +- +pass:[\b[>→≫]\b]+ +- +pass:[\b(>>|»)\b]+ +- +pass:[\bcontinue\b]+ [[hints.prev_regexes]] == hints.prev_regexes A comma-separated list of regexes to use for 'prev' links. -Default: +pass:[["\\bprev(ious)?\\b", "\\bback\\b", "\\bolder\\b", "\\b[<\u2190\u226a]\\b", "\\b(<<|\u00ab)\\b"]]+ +Default: + +- +pass:[\bprev(ious)?\b]+ +- +pass:[\bback\b]+ +- +pass:[\bolder\b]+ +- +pass:[\b[<←≪]\b]+ +- +pass:[\b(<<|«)\b]+ [[hints.scatter]] == hints.scatter @@ -1973,7 +2263,12 @@ Default: empty == statusbar.padding Padding for the statusbar. -Default: +pass:[{"top": 1, "bottom": 1, "left": 0, "right": 0}]+ +Default: + +- +pass:[bottom]+: +pass:[1]+ +- +pass:[left]+: empty +- +pass:[right]+: empty +- +pass:[top]+: +pass:[1]+ [[statusbar.position]] == statusbar.position @@ -2031,7 +2326,12 @@ Default: +pass:[true]+ == tabs.indicator_padding Padding for tab indicators -Default: +pass:[{"top": 2, "bottom": 2, "left": 0, "right": 4}]+ +Default: + +- +pass:[bottom]+: +pass:[2]+ +- +pass:[left]+: empty +- +pass:[right]+: +pass:[4]+ +- +pass:[top]+: +pass:[2]+ [[tabs.last_close]] == tabs.last_close @@ -2088,7 +2388,12 @@ Default: +pass:[last]+ == tabs.padding Padding around text for tabs -Default: +pass:[{"top": 0, "bottom": 0, "left": 5, "right": 5}]+ +Default: + +- +pass:[bottom]+: empty +- +pass:[left]+: +pass:[5]+ +- +pass:[right]+: +pass:[5]+ +- +pass:[top]+: empty [[tabs.position]] == tabs.position @@ -2241,26 +2546,40 @@ Valid values: * +query+ * +anchor+ -Default: +pass:[["path", "query"]]+ +Default: + +- +pass:[path]+ +- +pass:[query]+ [[url.searchengines]] == url.searchengines Definitions of search engines which can be used via the address bar. The searchengine named `DEFAULT` is used when `url.auto_search` is turned on and something else than a URL was entered to be opened. Other search engines can be used by prepending the search engine name to the search term, e.g. `:open google qutebrowser`. The string `{}` will be replaced by the search term, use `{{` and `}}` for literal `{`/`}` signs. -Default: +pass:[{"DEFAULT": "https://duckduckgo.com/?q={}"}]+ +Default: + +- +pass:[DEFAULT]+: +pass:[https://duckduckgo.com/?q={}]+ [[url.start_pages]] == url.start_pages The page(s) to open at the start. -Default: +pass:[["https://start.duckduckgo.com"]]+ +Default: + +- +pass:[https://start.duckduckgo.com]+ [[url.yank_ignored_parameters]] == url.yank_ignored_parameters The URL parameters to strip with `:yank url`. -Default: +pass:[["ref", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"]]+ +Default: + +- +pass:[ref]+ +- +pass:[utm_source]+ +- +pass:[utm_medium]+ +- +pass:[utm_campaign]+ +- +pass:[utm_term]+ +- +pass:[utm_content]+ [[window.hide_wayland_decoration]] == window.hide_wayland_decoration @@ -2301,7 +2620,24 @@ Default: +pass:[100%]+ == zoom.levels The available zoom levels. -Default: +pass:[["25%", "33%", "50%", "67%", "75%", "90%", "100%", "110%", "125%", "150%", "175%", "200%", "250%", "300%", "400%", "500%"]]+ +Default: + +- +pass:[25%]+ +- +pass:[33%]+ +- +pass:[50%]+ +- +pass:[67%]+ +- +pass:[75%]+ +- +pass:[90%]+ +- +pass:[100%]+ +- +pass:[110%]+ +- +pass:[125%]+ +- +pass:[150%]+ +- +pass:[175%]+ +- +pass:[200%]+ +- +pass:[250%]+ +- +pass:[300%]+ +- +pass:[400%]+ +- +pass:[500%]+ [[zoom.mouse_divider]] == zoom.mouse_divider diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index ca01cfd60..e82fe8f26 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -45,6 +45,7 @@ Config types can do different conversations: # FIXME:conf show the type docstrings in the documentation import re +import html import shlex import codecs import os.path @@ -250,6 +251,15 @@ class BaseType: assert isinstance(value, str), value return value + def to_doc(self, value, indent=0): + """Get a string with the given value for the documentation. + + This currently uses asciidoc syntax. + """ + if not value: + return 'empty' + return '+pass:[{}]+'.format(html.escape(self.to_str(value))) + def complete(self): """Return a list of possible values for completion. @@ -443,6 +453,21 @@ class List(BaseType): return '' return json.dumps(value) + def to_doc(self, value, indent=0): + if not value: + return 'empty' + + # Might work, but untested + assert not isinstance(self.valtype, (Dict, List)), self.valtype + + lines = ['\n'] + prefix = '-' if not indent else '*' * indent + for elem in value: + lines.append('{} {}'.format( + prefix, + self.valtype.to_doc(elem, indent=indent+1))) + return '\n'.join(lines) + class FlagList(List): @@ -1117,6 +1142,19 @@ class Dict(BaseType): return '' return json.dumps(value) + def to_doc(self, value, indent=0): + if not value: + return 'empty' + lines = ['\n'] + prefix = '-' if not indent else '*' * indent + for key, val in sorted(value.items()): + lines += ('{} {}: {}'.format( + prefix, + self.keytype.to_doc(key), + self.valtype.to_doc(val, indent=indent+1), + )).splitlines() + return '\n'.join(line.rstrip(' ') for line in lines) + class File(BaseType): diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index 09e083e79..9217f7efb 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -401,15 +401,7 @@ def _generate_setting_option(f, opt): f.write(" * +{}+".format(val) + "\n") f.write("\n") - if opt.name == 'bindings.default': - # FIXME:conf - pass - elif opt.default: - f.write("Default: +pass:[{}]+\n".format(html.escape( - opt.typ.to_str(opt.default)))) - else: - f.write("Default: empty\n") - + f.write("Default: {}\n".format(opt.typ.to_doc(opt.default))) _generate_setting_backend_info(f, opt) diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 677045a60..ae850d0dd 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -353,6 +353,14 @@ class TestBaseType: basetype.valid_values = configtypes.ValidValues('foo') assert basetype.get_valid_values() is basetype.valid_values + @pytest.mark.parametrize('value, expected', [ + ('hello', '+pass:[hello]+'), + ('', 'empty'), + ('<', '+pass:[<]+'), + ]) + def test_to_doc(self, klass, value, expected): + assert klass().to_doc(value) == expected + class MappingSubclass(configtypes.MappingType): @@ -599,6 +607,24 @@ class TestList: expected = '' if not val else text assert typ.to_str(converted) == expected + @pytest.mark.parametrize('val, expected', [ + # simple list + (['foo', 'bar'], '\n\n- +pass:[foo]+\n- +pass:[bar]+'), + # empty + ([], 'empty'), + ]) + def test_to_doc(self, klass, val, expected): + doc = klass().to_doc(val) + print(doc) + assert doc == expected + + def test_to_doc_unimplemented(self): + """List.to_doc with another Dict/List is not implemented.""" + valtype = configtypes.List(valtype=configtypes.String()) + typ = configtypes.List(valtype=valtype) + with pytest.raises(AssertionError): + typ.to_doc([['foo']]) + class TestFlagList: @@ -687,6 +713,9 @@ class TestBool: def test_to_str(self, klass, val, expected): assert klass().to_str(val) == expected + def test_to_doc(self, klass): + assert klass().to_doc(True) == '+pass:[true]+' + class TestBoolAsk: @@ -1503,6 +1532,24 @@ class TestDict: assert d.to_str(converted) == '' if not val else text + @pytest.mark.parametrize('valtype, val, expected', [ + # simple dict + (configtypes.String(), {'foo': 'bar'}, + '\n\n- +pass:[foo]+: +pass:[bar]+'), + # dict as value + (configtypes.Dict(keytype=configtypes.String(), + valtype=configtypes.String()), + {'foo': {'bar': 'baz'}}, + '\n\n- +pass:[foo]+:\n\n* +pass:[bar]+: +pass:[baz]+'), + # empty + (configtypes.String(), {}, 'empty'), + ]) + def test_to_doc(self, klass, valtype, val, expected): + typ = klass(keytype=configtypes.String(), valtype=valtype) + doc = typ.to_doc(val) + print(doc) + assert doc == expected + def unrequired_class(**kwargs): return configtypes.File(required=False, **kwargs)