# Configuration of Chawan Chawan supports configuration of various options like keybindings, user stylesheets, site preferences, etc. The configuration format is very similar to toml, with the following exceptions: * Inline tables may span across multiple lines. * Table arrays can be cleared by setting a variable by the same to the empty array. This allows users to disable default table array rules. Example: ``` omnirule = [] # note: this must be placed at the beginning of the file. [[omnirule]] # this is legal. all default omni-rules are now disabled. ``` Chawan will look for a config file in the $XDG_CONFIG_HOME/chawan/ directory called `config.toml`. (Chawan defaults to ~/.config if the XDG_CONFIG_HOME environment variable is not set.) See the default configuration file in the res/ folder, and bonus configuration files in the bonus/ folder for further examples. **Table of contents** * [Start](#start) * [Search](#search) * [Buffer](#buffer) * [Encoding](#encoding) * [External](#external) * [Network](#network) * [Display](#display) * [Protocol](#protocol) * [Omnirule](#omnirule) * [Siteconf](#siteconf) * [Stylesheets](#stylesheets) * [Keybindings](#keybindings) * [Pager actions](#pager-actions) * [Line-editing actions](#line-editing-actions) * [Appendix](#appendix) * [Regex handling](#regex-handling) * [Match mode](#match-mode) * [Search mode](#search-mode) * [Path handling](#path-handling) * [Word types](#word-types) * [w3m word](#w3m-word) * [vi word](#vi-word) * [Big word](#big-word) ## Start Start-up options are to be placed in the `[start]` section. Following is a list of start-up options:
Name | Value | Function |
---|---|---|
visual-home | url | Page opened when Chawan is called with the -V option (and no other pages are passed as arguments.) |
startup-script | JavaScript code | Script Chawan runs on start-up. Pages will not be loaded until this function exits. (Note however that asynchronous functions like setTimeout do not block loading.) |
headless | boolean | Whether Chawan should always start in headless mode. Automatically enabled when Chawan is called with -r. |
console-buffer | boolean | Whether Chawan should open a console buffer in non-headless mode. Defaults
to true. Warning: this is only useful for debugging. Disabling this option without manually redirecting standard error will result in error messages randomly appearing on your screen. |
Name | Value | Function |
---|---|---|
styling | boolean | Enable/disable author style sheets. Note that disabling this does not affect
user styles set in `[css]`. Defaults to true (i.e. enabled). |
scripting | boolean | Enable/disable JavaScript in *all* buffers. Defaults to false. For security reasons, users are encouraged to selectively enable JavaScript with `[[siteconf]]` instead of using this setting. |
images | boolean | Enable/disable experimental image support. Defaults to false. |
cookie | boolean | Enable/disable cookies on sites. Defaults to false. Note: in Chawan, each website gets a separate cookie jar, so websites relying on cross-site cookies may not work as expected. You may use the `[[siteconf]]` "cookie-jar" and "third-party-cookie" settings to adjust this behavior for specific sites. |
referer-from | boolean | Enable/disable the "Referer" header. Defaults to false. For security reasons, users are encouraged to leave this option disabled, only enabling it for specific sites in `[[siteconf]]`. |
autofocus | boolean | When set to true, elements with an "autofocus" attribute are focused on
automatically after the buffer is loaded. Defaults to false. |
meta-refresh | "never" / "always" / "ask" | Whether or not `http-equiv=refresh` meta tags should be respected. "never"
completely disables them, "always" automatically accepts all of them, "ask"
brings up a pop-up menu. Defaults to "ask". |
Name | Value | Function |
---|---|---|
wrap | boolean | When set to true, searchNext/searchPrev wraps around the document. |
ignore-case | "auto" / boolean | When set to true, document-wide searches are case-insensitive by
default. When set to "auto", searches are only case-sensitive when the search
term includes a capital letter. Defaults to "auto". Note: this can also be overridden inline in the search bar (vim-style), with the escape sequences `\c` (ignore case) and `\C` (strict case). See [search mode](#search-mode) for details.) |
Name | Value | Function |
---|---|---|
document-charset | array of charset label strings | List of character sets for loading documents. All listed character sets are enumerated until the document has been decoded without errors. In HTML, meta tags and the BOM may override this with a different charset, so long as the specified charset can decode the document correctly. |
display-charset | string | Character set for keyboard input and displaying documents. Used in dump mode as well. (This means that e.g. `cha -I EUC-JP -O UTF-8 a > b` is equivalent to `iconv -f EUC-JP -t UTF-8`.) |
Name | Value | Function |
---|---|---|
tmpdir | path | Directory used to save temporary files. |
sockdir | path | Directory used to store UNIX domain sockets used for inter-process communication. |
editor | shell command | External editor command. %s is substituted for the file name, %d for the line number. |
mailcap | array of paths | Search path for [mailcap](mailcap.md) files. |
mime-types | array of paths | Search path for [mime.types](mime.types.md) files. |
cgi-dir | array of paths | Search path for [local CGI](localcgi.md) scripts. |
urimethodmap | array of paths | Search path for [urimethodmap](urimethodmap.md) files. |
w3m-cgi-compat | boolean | Enable local CGI compatibility with w3m. In short, it redirects `file:///cgi-bin/*` and `file:///$LIB/cgi-bin/*` to `cgi-bin:*`. For further details, see [localcgi.md](localcgi.md). |
download-dir | string | Path to pre-fill for "Save to:" prompts. This is not validated, you can set it to whatever you find useful. |
Name | Value | Function |
---|---|---|
vi-numeric-prefix | boolean | Whether vi-style numeric prefixes to commands should be accepted. When set to true, commands that return a function will be called with the numeric prefix as their first argument. Note: this only applies for keybindings defined in [page]. |
use-mouse | boolean | Whether Chawan is allowed to use the mouse. Currently, the default behavior imitates that of w3m. |
Name | Value | Function |
---|---|---|
max-redirect | number | Maximum number of redirections to follow. |
prepend-scheme | string | Prepend this to URLs passed to Chawan without a scheme. Note that local files (`file:` scheme) will always be checked first; only if this fails, Chawan will retry the request with `prepend-scheme` set as the scheme. By default, this is set to "https://". Note that the "://" part is mandatory. |
prepend-https | boolean | Deprecated: use prepend-scheme instead. When set to false, Chawan will act as if prepend-scheme were set to "". |
proxy | URL | Specify a proxy for all network requests Chawan makes. All proxies supported by cURL may be used. Can be overridden by siteconf. |
default-headers | table | Specify a list of default headers for all HTTP(S) network requests. Can be overridden by siteconf. |
Name | Value | Function |
---|---|---|
color-mode | "monochrome" / "ansi" / "eight-bit" / "true-color" / "auto" | Set the color mode. "auto" for automatic detection, "monochrome"
for black on white, "ansi" for ansi colors, "eight-bit" for 256-color mode, and
"true-color" for true colors. "8bit" is accepted as a legacy alias of "eight-bit". "24bit" is accepted as a legacy alias of "true-color". |
format-mode | "auto" / ["bold", "italic", "underline", "reverse", "strike", "overline", "blink"] | Specifies output formatting modes. Accepts the string "auto" or an array of specific attributes. An empty array (`[]`) disables formatting completely. |
no-format-mode | ["bold", "italic", "underline", "reverse", "strike", "overline", "blink"] | Disable specified formatting modes. |
image-mode | "auto" / "none" / "sixel" / "kitty" | Specifies the image output mode. "sixel" uses sixels for output, "kitty"
uses the Kitty image display protocol, "none" disables image display
completely. "auto" tries to detect sixel or kitty support, and falls back to "none" when neither are available. Defaults to "auto". However, images are still disabled by default, unless you also enable `buffer.images` which allows the browser to actually download images. |
sixel-colors | "auto" / 2..65535 | Only applies when `display.image-mode="sixel"`. Setting a number
overrides the number of sixel color registers reported by the terminal,
while "auto" leaves color detection to Chawan. Defaults to "auto". |
alt-screen | "auto" / boolean | Enable/disable the alternative screen. |
highlight-color | color | Set the highlight color. Both hex values and CSS color names are accepted. |
highlight-marks | boolean | Enable/disable highlighting of marks. |
double-width-ambiguous | boolean | Assume the terminal displays characters in the East Asian Ambiguous category as double-width characters. Useful when e.g. ○ occupies two cells. |
minimum-contrast | number | Specify the minimum difference between the luminance (Y) of the background and the foreground. -1 disables this function (i.e. allows black letters on black background, etc). |
force-clear | boolean | Force the screen to be completely cleared every time it is redrawn. |
set-title | boolean | Set the terminal emulator's window title to that of the current page. |
default-background-color | "auto" / color | Overrides the assumed background color of the terminal. "auto" leaves background color detection to Chawan. |
default-foreground-color | "auto" / color | Sets the assumed foreground color of the terminal. "auto" leaves foreground color detection to Chawan. |
query-da1 | bool | Enable/disable querying Primary Device Attributes, and with it, all
"dynamic" terminal querying. It is highly recommended not to alter the default value (which is true), or the output will most likely look horrible. (Except, obviously, if your terminal does not support Primary Device Attributes.) |
columns, lines, pixels-per-column, pixels-per-line | number | Fallback values for the number of columns, lines, pixels per column, and pixels per line for the cases where it cannot be determined automatically. (For example, these values are used in dump mode.) |
force-columns, force-lines, force-pixels-per-column, force-pixels-per-line | boolean | Force-set columns, lines, pixels per column, or pixels per line to the fallback values provided above. |
Name | Value | Function |
---|---|---|
form-request | http, ftp, data, mailto | Specify which protocol to imitate when submitting forms to this
protocol. Defaults to HTTP. |
Name | Value | Function |
---|---|---|
match | regex | Regular expression used to match the input string. Note that websites
passed as arguments are matched as well. Note: regexes are handled according to the [match mode](#match-mode) regex handling rules. |
substitute-url | JavaScript function | A JavaScript function Chawan will pass the input string to. If a new string is returned, it will be parsed instead of the old one. |
Name | Value | Function |
---|---|---|
url | regex | Regular expression used to match the URL. Either this or the `host` option
must be specified. Note: regexes are handled according to the [match mode](#match-mode) regex handling rules. |
host | regex | Regular expression used to match the host part of the URL (i.e. domain
name/ip address.) Either this or the `url` option must be specified. Note: regexes are handled according to the [match mode](#match-mode) regex handling rules. |
rewrite-url | JavaScript function | A JavaScript function Chawan will pass the URL to. If a new URL is returned, it will replace the old one. |
cookie | boolean | Whether loading cookies should be allowed for this URL. By default, this is
false for all websites. Overrides `buffer.cookie`. |
third-party-cookie | array of regexes | Domains for which third-party cookies are allowed on this domain. Note:
this only works for buffers which share the same cookie jar. Note: regexes are handled according to the [match mode](#match-mode) regex handling rules. |
share-cookie-jar | host | Cookie jar to use for this domain. Useful for e.g. sharing cookies with subdomains. |
referer-from | boolean | Whether or not we should send a Referer header when opening requests
originating from this domain. Simplified example: if you click a link on a.com
that refers to b.com, and referer-from is true, b.com is sent "a.com" as the
Referer header. Overrides `buffer.referer-from`. |
scripting | boolean | Enable/disable JavaScript execution on this site. Overrides `buffer.scripting`. |
styling | boolean | Enable/disable author styles (CSS) on this site. Overrides `buffer.styling`. |
images | boolean | Enable/disable image display on this site. Overrides `buffer.images`. |
document-charset | charset label string | Specify the default encoding for this site. Overrides `encoding.document-charset`. |
stylesheet | CSS stylesheet | Specify an additional user-stylesheet for this site. Note: other user-stylesheets (specified under [css] or additional matching siteconfs) are not overridden. (In other words, they will be concatenated with this stylesheet to get the final user stylesheet.) |
proxy | URL | Specify a proxy for network requests fetching contents of this buffer. Overrides `network.proxy`. |
default-headers | table | Specify a list of default headers for HTTP(S) network requests to this buffer. Overrides `network.default-headers`. |
insecure-ssl-no-verify | boolean | Defaults to false. When set to true, this disables peer and hostname
verification for SSL keys on this site, like `curl --insecure` would. WARNING: this is insecure, and opens up your connections to man-in-the-middle attacks. Please do not use this unless you are absolutely sure you know what you are doing. |
autofocus | boolean | When set to true, elements with an "autofocus" attribute are focused on automatically after the buffer is loaded. Overrides `buffer.autofocus`. |
meta-refresh | "never" / "always" / "ask" | Whether or not `http-equiv=refresh` meta tags should be respected. "never"
completely disables them, "always" automatically accepts all of them, "ask"
brings up a pop-up menu. Overrides `buffer.meta-refresh`. |
Default key | Name | Function |
---|---|---|
q | `cmd.pager.quit` | Exit the browser. |
C-z | `cmd.pager.suspend` | Temporarily suspend the browser Note: this also suspends e.g. buffer processes or CGI scripts. So if you are downloading something, that will be delayed until you restart the process. |
C-l | `cmd.pager.load` | Open the current address in the URL bar. |
C-k | `cmd.pager.webSearch` | Open the URL bar with an arbitrary search engine. At the moment, this is DuckDuckGo Lite, but this may change in the future. |
M-u | `cmd.pager.dupeBuffer` | Duplicate the current buffer by loading its source to a new buffer. |
U | `cmd.pager.reloadBuffer` | Open a new buffer with the current buffer's URL, replacing the current buffer. |
C-g | `cmd.pager.lineInfo` | Display information about the current line on the status line. |
\ | `cmd.pager.toggleSource` | If viewing an HTML buffer, open a new buffer with its source. Otherwise, open the current buffer's contents as HTML. |
D | `cmd.pager.discardBuffer` | Discard the current buffer, and move back to the previous/next buffer depending on what the previously viewed buffer was. |
d,, d. | `cmd.pager.discardBufferPrev`, `cmd.pager.discardBufferNext` | Discard the current buffer, and move back to the previous/next buffer, or open the link under the cursor. |
M-d | `cmd.pager.discardTree` | Discard all child buffers of the current buffer. |
., ,, M-,, M-., M-/ | `cmd.pager.nextBuffer`, `cmd.pager.prevBuffer`, `cmd.pager.prevSiblingBuffer`, `cmd.pager.nextSiblingBufer`, `cmd.pager.parentBuffer` | Traverse the buffer tree. `nextBuffer` and `prevBuffer` are the most intuitive, traversing the tree as if it were a linked list. `prevSiblingBuffer` and `nextSiblingBuffer` cycle through the buffers opened from the same buffer. Finally, `parentBuffer` always returns to the buffer the current buffer was opened from, even if e.g. the user returns and opens another page "in between". |
M-c | `cmd.pager.enterCommand` | Directly enter a JavaScript command. Note that this interacts with the pager, not the website being displayed. |
None | `cmd.pager.searchForward`, `cmd.pager.searchBackward` | Search for a string in the current buffer, forwards or backwards. |
/, ? | `cmd.pager.isearchForward`, `cmd.pager.searchBackward` | Incremental-search for a string, highlighting the first result, forwards or backwards. |
n, N | `cmd.pager.searchNext`, `cmd.pager.searchPrev` | Jump to the nth (or if unspecified, first) next/previous search result. |
c | `cmd.pager.peek` | Display a message of the current buffer's URL on the status line. |
u | `cmd.pager.peekCursor` | Display a message of the URL or title under the cursor on the status line. Multiple calls allow cycling through the two. (i.e. by default, press u once -> title, press again -> URL) |
su | `cmd.pager.showFullAlert` | Show the last alert inside the line editor. You can also view previous ones using C-p or C-n. |
M-y | `cmd.pager.copyURL` | Copy the current buffer's URL to the system clipboard. |
yu | `cmd.pager.copyCursorLink` | Copy the link under the cursor to the system clipboard. |
yI | `cmd.pager.copyCursorImage` | Copy the URL of the image under the cursor to the system clipboard. |
M-p | `cmd.pager.gotoClipboardURL` | Go to the URL currently on the clipboard. |
Default key | Name | Function |
---|---|---|
j, k | `cmd.buffer.cursorUp`, `cmd.buffer.cursorDown` | Move the cursor upwards/downwards by n lines, or if n is unspecified, by 1. |
h, l | `cmd.buffer.cursorLeft`, `cmd.buffer.cursorRight` | Move the cursor to the left/right by n cells, or if n is unspecified, by 1. |
0 | `cmd.buffer.cursorLineBegin` | Move the cursor to the first cell of the line. |
^ | `cmd.buffer.cursorLineTextStart` | Move the cursor to the first non-blank character of the line. |
$ | `cmd.buffer.cursorLineEnd` | Move the cursor to the last cell of the line. |
w, W | `cmd.buffer.cursorNextWord`, `cmd.buffer.cursorNextViWord`, `cmd.buffer.cursorNextBigWord` | Move the cursor to the beginning of the next [word](#word-types). |
None | `cmd.buffer.cursorPrevWord`, `cmd.buffer.cursorPrevViWord`, `cmd.buffer.cursorPrevBigWord` | Move the cursor to the end of the previous [word](#word-types). |
e, E | `cmd.buffer.cursorWordEnd`, `cmd.buffer.cursorViWordEnd`, `cmd.buffer.cursorBigWordEnd` | Move the cursor to the end of the current [word](#word-types), or if already there, to the end of the next word. |
b, B | `cmd.buffer.cursorWordBegin`, `cmd.buffer.cursorViWordBegin`, `cmd.buffer.cursorBigWordBegin` | Move the cursor to the beginning of the current [word](#word-types), or if already there, to the end of the previous word. |
[, ] | `cmd.buffer.cursorPrevLink`, `cmd.buffer.cursorNextLink` | Move the cursor to the end/beginning of the previous/next clickable element (e.g. link, input field, etc). |
{, } | `cmd.buffer.cursorPrevParagraph`, `cmd.buffer.cursorNextParagraph` | Move the cursor to the end/beginning of the nth previous/next paragraph. |
None | `cmd.buffer.cursorRevNthLink` | Move the cursor to the nth link of the document, counting backwards from the document's last line. |
None | `cmd.buffer.cursorNthLink` | Move the cursor to the nth link of the document. |
C-b, C-f, zH, zL | `cmd.buffer.pageUp`, `cmd.buffer.pageDown`, `cmd.buffer.pageLeft`, `cmd.buffer.pageRight` | Scroll up/down/left/right by n pages, or if n is unspecified, by one page. |
C-u, C-d | `cmd.buffer.halfPageUp`, `cmd.buffer.halfPageDown`, `cmd.buffer.halfPageLeft`, `cmd.buffer.halfPageUp` | Scroll up/down/left/right by n half pages, or if n is unspecified, by one page. |
K/C-y, J/C-e, zh, zl | `cmd.buffer.scrollUp`, `cmd.buffer.scrollDown`, `cmd.buffer.scrollLeft`, `cmd.buffer.scrollRight` | Scroll up/down/left/right by n lines, or if n is unspecified, by one line. |
Enter/Return | `cmd.buffer.click` | Click the HTML element currently under the cursor. |
R | `cmd.buffer.reshape` | Reshape the current buffer (=render the current page anew.) Useful if the layout is not updating even though it should have. |
r | `cmd.buffer.redraw` | Redraw screen contents. Useful if something messed up the display. |
None (see gotoLineOrStart/End instead) | `cmd.buffer.cursorFirstLine`, `cmd.buffer.cursorLastLine` | Move to the beginning/end in the buffer. |
H | `cmd.buffer.cursorTop` | Move to the first line on the screen. (Equivalent to H in vi.) |
M | `cmd.buffer.cursorMiddle` | Move to the line in the middle of the screen. (Equivalent to M in vi.) |
L | `cmd.buffer.cursorBottom` | Move to the last line on the screen. (Equivalent to L in vi.) |
zt, z Return, zz, z., zb, z- | `cmd.buffer.raisePage`, `cmd.buffer.raisePageBegin`, `cmd.buffer.centerLine`, `cmd.buffer.centerLineBegin`, `cmd.buffer.lowerPage`, `cmd.buffer.lowerPageBegin` | If n is specified, move cursor to line n. Then,
* `raisePage` scrolls down so that the cursor is on the top line of the screen.
(vi `z |
z+ | `cmd.buffer.nextPageBegin` | If n is specified, move to the screen before the nth line and raise the page. Otherwise, go to the previous screen's last line and raise the page. |
z^ | `cmd.buffer.previousPageBegin` | If n is specified, move to the screen before the nth line and raise the page. Otherwise, go to the previous screen's last line and raise the page. |
g0, gc, g$ | `cmd.buffer.cursorLeftEdge`, `cmd.buffer.cursorMiddleColumn`, `cmd.buffer.cursorRightEdge` | Move to the first/middle/last column on the screen. |
None | `cmd.buffer.centerColumn` | Center screen around the current column. (w3m `Z`.) |
gg, G | `cmd.buffer.gotoLineOrStart`, `cmd.buffer.gotoLineOrEnd` | If n is specified, jump to line n. Otherwise, jump to the start/end of the page. |
m | `cmd.buffer.mark` | Wait for a character `x` and then set a mark with the ID `x`. |
`, ' | `cmd.buffer.gotoMark`, `cmd.buffer.gotoMarkY` | Wait for a character `x` and then jump to the mark with the ID `x` (if it
exists on the page). `gotoMark` sets both the X and Y positions; gotoMarkY only sets the Y position. |
: | `cmd.buffer.markURL` | Convert URL-like strings to anchors on the current page. |
s Return | `cmd.buffer.saveLink` | Save resource from the URL pointed to by the cursor to the disk. |
sS | `cmd.buffer.saveSource` | Save the source of the current buffer to the disk. |
Default key | Name | Function |
---|---|---|
Return | `cmd.line.submit` | Submit the line. |
C-c | `cmd.line.cancel` | Cancel the current operation. |
C-h, C-d | `cmd.line.backspace`, `cmd.line.delete` | Delete character before (backspace)/after (delete) the cursor. |
C-u, C-k | `cmd.line.clear`, `cmd.line.kill` | Delete text before (clear)/after (kill) the cursor. |
C-w, M-d | `cmd.line.clearWord`, `cmd.line.killWord` | Delete word before (clear)/after (kill) the cursor. |
C-b, C-f | `cmd.line.backward`, `cmd.line.forward` | Move cursor backward/forward by one character. |
M-b, M-f | `cmd.line.prevWord`, `cmd.line.nextWord` | Move cursor to the previous/next word by one character |
C-a, C-e | `cmd.line.begin`, `cmd.line.end` | Move cursor to the beginning/end of the line. |
C-v | `cmd.line.escape` | Ignore keybindings for next character. |
C-p, C-n | `cmd.line.prevHist`, `cmd.line.nextHist` | Jump to the previous/next history entry |