# Configuration Chawan supports custom keybindings and user stylesheets. The configuration format is very similar to the toml format, with the following exceptions: * Table arrays can be cleared like this: ``` omnirule = [] [[omnirule]] # this is accepted ``` This allows users to disable default table array rules. Note that these declarations must be placed at the beginning of the file. * Inline tables may span across multiple lines. Rationale: the toml specified behavior is counter-intuitive. Chawan will look for a config file in the ~/.config/chawan/ directory called `config.toml`. See the default configuration in the res/ folder for the default configuration. **Table of contents** * [Start](#start) * [External](#external) * [Network](#network) * [Display](#display) * [Omnirule](#omnirule) * [Siteconf](#siteconf) * [Stylesheets](#stylesheets) * [Keybindings](#keybindings) * [Pager actions](#pager-actions) * [Line-editing actions](#line-editing-actions) ## 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 cha is called with the -V option (and no other pages are passed as arguments.) |
run-script | JavaScript code | Script cha runs on start. Pages will not be loaded until this function exits. (setTimeout & friends do not block loading, though.) |
headless | boolean | Whether cha should always start in headless mode. Enabled when cha is called with -r. |
**Name** | **Value** | **Function** |
---|---|---|
tmpdir | path | Directory used to save temporary files. |
editor | shell command | External editor command. %s is substituted for the file name, %d for the line number. |
**Name** | **Value** | **Function** |
---|---|---|
max-redirect | number | Maximum number of redirections to follow. |
prepend-https | boolean | Whether or not cha should attempt loading "raw" URLs without a scheme as https (e.g. wikipedia.org as https://wikipedia.org.) |
**Name** | **Value** | **Function** |
---|---|---|
color-mode | "monochrome"/"ansi"/"8bit"/"24bit"/"auto" | Set the color mode. "auto" for automatic detection, "monochrome" for black on white, "ansi" for ansi colors, "24bit" for true colors. "8bit" is currently unimplemented (and falls back to ansi). |
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. |
emulate-overline | boolean | When set to true and the overline formatting attribute is not enabled, overlines are substituted by underlines on the previous line. |
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. |
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. |
**Name** | **Value** | **Function** |
---|---|---|
match | regex | Regular expression used to match the input string. Note that websites passed as arguments are matched as well. |
substitute | JavaScript function | A JavaScript function cha 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. |
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. |
rewrite-url | JavaScript function | A JavaScript function cha 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. |
third-party-cookie | regex/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. |
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. Defaults to false. |
**Name** | **Function** |
---|---|
`pager.quit()` | Exit the browser |
`pager.cursorUp()` | Move the cursor to the previous line |
`pager.cursorDown()` | Move cursor to the next line |
`pager.cursorLeft()` | Move cursor to the previous cell |
`pager.cursorRight()` | Move cursor to the next cell |
`pager.cursorLineBegin()` | Move cursor to the first cell of the line |
`pager.cursorLineEnd()` | Move cursor to the last cell of the line |
`pager.cursorNextWord()` | Move cursor to the beginning of the next word |
`pager.cursorPrevWord()` | Move cursor to the end of the previous word |
`pager.cursorNextLink()` | Move cursor to the beginning of the next clickable element |
`pager.cursorPrevLink()` | Move cursor to the beginning of the previous clickable element |
`pager.pageDown()` | Move screen down by one page |
`pager.pageUp()` | Move screen up by one page |
`pager.pageLeft()` | Move screen to the left by one page |
`pager.pageRight()` | Move screen to the right by one page |
`pager.halfPageDown()` | Move screen down by half a page |
`pager.halfPageUp()` | Move screen up by half a page |
`pager.scrollDown()` | Move screen down by one line |
`pager.scrollUp()` | Move screen up by one line |
`pager.scrollLeft()` | Move screen to the left by one line |
`pager.scrollRight()` | Move screen to the right by one line |
`pager.click()` | Click element currently under cursor |
`pager.changeLocation()` | Go to URL |
`pager.dupeBuffer()` | Duplicate the current buffer |
`pager.reload()` | Reload page |
`pager.reshape()` | Reshape buffer (=render page anew) |
`pager.redraw()` | Redraw buffer (=redraw screen) |
`pager.toggleSource()` | Source view |
`pager.cursorFirstLine()` | Move cursor to the first line of the buffer |
`pager.cursorLastLine()` | Move cursor to the last line of the buffer |
`pager.cursorTop()` | Move cursor to the first line of the page |
`pager.cursorMiddle()` | Move cursor to the middle of the page |
`pager.cursorBottom()` | Move cursor to the last line of the page |
`pager.centerLine()` | Center screen around line |
`pager.lineInfo()` | Display information about line |
`pager.searchForward()` | Search for a string in the current buffer |
`pager.searchBackward()` | Search for a string, backwards |
`pager.isearchForward()` | Search for a string and highlight the first result |
`pager.isearchBackward()` | Search and highlight the first result, backwards |
`pager.searchPrev()` | Jump to the next search result |
`pager.searchNext()` | Jump to the previous search result |
`pager.peek()` | Display an alert of the current URL |
`pager.peekCursor()` | Display an alert of the URL under the cursor |
**Name** | **Function** |
---|---|
`line.submit()` | Submit line |
`line.cancel()` | Cancel operation |
`line.backspace()` | Delete character before cursor |
`line.delete()` | Delete character after cursor |
`line.clear()` | Clear text before cursor |
`line.kill()` | Clear text after cursor |
`line.clearWord(bounds)` | Delete word before cursor |
`line.killWord(bounds)` | Delete word after cursor |
`line.backward()` | Move cursor back by one character |
`line.forward()` | Move cursor forward by one character |
`line.prevWord(bounds)` | Move cursor to the previous word by one character |
`line.nextWord(bounds)` | Move cursor to the previous word by one character |
`line.begin()` | Move cursor to the previous word by one character |
`line.end()` | Move cursor to the previous word by one character |
`line.escape()` | Ignore keybindings for next character |
`line.prevHist()` | Jump to the previous history entry |
`line.nextHist()` | Jump to the next history entry |