Configuration of Chawan
Chawan supports configuration of various options like keybindings, user stylesheets, site preferences, etc. The configuration format is similar to toml, with the following exceptions:
- Inline tables may span across multiple lines.
- Regular tables (
[table]) and inline tables (table = {}) have different semantics. The first is additive, meaning old values are not removed. The second is destructive, and clears all definitions in the table specified. [[table-array]]is sugar for[table-array.n], wherenis the number of declared table arrays. For example, you can declare anonymous siteconfs using the syntax[[siteconf]].
The canonical configuration file path is ~/.chawan/config.toml, but the search path accommodates XDG basedirs as well:
- config file specified through -C switch -> use that
$CHA_DIRis set -> use$CHA_DIR/config.toml${XDG_CONFIG_HOME:-~/.config}/chawan/config.tomlexists -> use that~/.chawan/config.tomlexists -> use that
See the path handling section for details on how the config directory can be accessed.
Table of contents
- Start
- Search
- Buffer
- Encoding
- External
- Input
- Network
- Display
- Status
- Omnirule
- Siteconf
- Keybindings
- Appendix
Start
Start-up options are to be placed in the [start]
section.
Following is a list of start-up options:
| Name | Value | Default | Function |
|---|---|---|---|
| visual-home | url | “about:chawan” | 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 / “dump” | false |
When set to true or “dump”, the browser does not take input; instead, it
prints a rendered version of all buffers in order, then exits.
The difference between
Piping |
| console-buffer | boolean | true |
Whether Chawan should open a console buffer in non-headless mode.
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. |
Buffer
Buffer options are to be placed in the [buffer]
section.
These options are global to all buffers. For more granular filtering,
use [[siteconf]].
Example:
[buffer]
# show images on all websites
images = true
# disable website CSS
styling = false
# Specify user styles.
user-style = '''
/* you can import external UA styles like this: */
@import 'user.css';
/* or just insert the style inline as follows. */
/* enforce the default text-decoration for links (i.e. underline). */
a[href] { text-decoration: revert !important }
@media (monochrome) { /* only in color-mode "monochrome" (or -M) */
/* disable UA style of bold font (no need for important here) */
a[href]:hover { font-weight: initial }
/* ...and italicize the font on hover instead.
* here we use important because we don't want websites to
* override the value. */
a[href]:hover { font-style: italic !important }
}
'''
# You *can* set scripting to true here, but I strongly recommend using
# [[siteconf]] to enable it on a per-site basis instead.Following is a list of buffer options:
| Name | Value | Default | Function |
|---|---|---|---|
| styling | boolean | true | Enable/disable author style sheets. Note that disabling this does not affect user styles. |
| scripting | boolean / “app” | false |
Enable/disable JavaScript in all buffers.
For security reasons, users are encouraged to selectively enable
JavaScript with |
| images | boolean | false | Enable/disable inline image display. |
| cookie | boolean / “save” | false |
Enable/disable cookies on sites.
If the string “save” is specified, then cookies are also saved to
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
|
| referer-from | boolean | false |
Enable/disable the “Referer” header.
Defaults to false. For privacy reasons, users are encouraged to leave
this option disabled, only enabling it for specific sites in
|
| autofocus | boolean | false |
When set to true, elements with an “autofocus” attribute are focused on
automatically after the buffer is loaded.
If scripting is enabled, this also allows scripts to focus on elements. |
| meta-refresh | “never” / “always” / “ask” | “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.
|
| history | boolean | true | Whether or not browsing history should be saved to the disk. |
| mark-links | boolean | false | Add numeric markers before links. In headless/dump mode, this also prints a list of URLs after the page. |
| user-style | string | ““ |
A user stylesheet applied to all buffers.
External stylesheets can be imported using the
Nested @import is not supported yet. |
Search
Search options are to be placed in the [search]
section.
Following is a list of search options:
| Name | Value | Default | Function |
|---|---|---|---|
| wrap | boolean | true | Whether on-page searches should wrap around the document. |
| ignore-case | “auto” / boolean | “auto” |
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.
Note: this can also be overridden inline in the search bar (vim-style),
with the escape sequences |
Encoding
Encoding options are to be placed in the [encoding]
section.
Following is a list of encoding options:
| Name | Value | Default | Function |
|---|---|---|---|
| document-charset | array of charset label strings | [“utf-8”, “sjis”, “euc-jp”, “latin2”] |
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 | “auto” |
Character set for keyboard input and displaying documents.
Used in dump mode as well.
(This means that e.g. |
External
External options are to be placed in the [external]
section.
Following is a list of external options:
| Name | Value | Default | Function |
|---|---|---|---|
| tmpdir | path | {usually /tmp/cha-tmp-user} | Directory used to save temporary files. |
| editor | shell command |
{usually $EDITOR}
|
External editor command. %s is substituted for the file name, %d for the line number. |
| mailcap | array of paths | {see mailcap docs} | Search path for mailcap files. Directories specified first have higher precedence. |
| mime-types | array of paths | {see mime.types docs} | Search path for mime.types files. |
| auto-mailcap | path | “auto.mailcap” |
Mailcap file for entries that are automatically executed.
The “Open as” prompt also saves entries in this file. |
| cgi-dir | array of paths | {see local CGI docs} | Search path for local CGI scripts. |
| urimethodmap | array of paths | {see urimethodmap docs} | Search path for urimethodmap files. |
| w3m-cgi-compat | boolean | false |
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.
|
| download-dir | path | {same as tmpdir} | Path to pre-fill for “Save to:” prompts. |
| show-download-panel | boolean | true |
Whether the about:downloads should be shown after starting
a download.
|
| copy-cmd | shell command | “xsel -bi” | Command to use for “copy to clipboard” operations. |
| paste-cmd | shell command | “xsel -bo” | Command to use for “read from clipboard” operations. |
| bookmark | path | “bookmark.md” | Path to the bookmark.md file. (The file it points to should have a .md extension, so that its type can be correctly deduced.) |
| history-file | path | “history.uri” | Path to the history file. |
| history-size | number | 100 | Maximum length of the history file. |
| cookie-file | path | “cookies.txt” |
Path to the cookie file.
The format is equivalent to curl’s “cookies.txt” format, except that a “jar@” part is prepended for cookies that belong in a different jar than the domain.
Cookies from this file are used if “buffer.cookie” (or its equivalent
siteconf override) is set to |
Input
Input options are to be placed in the [input]
section.
| Name | Value | Default | Function |
|---|---|---|---|
| vi-numeric-prefix | boolean | true |
Whether vi-style numeric prefixes to commands should be accepted.
Only applies for keybindings defined in |
| use-mouse | boolean | true |
Whether Chawan is allowed to intercept mouse clicks.
The current implementation imitates w3m. |
| osc52-copy | boolean / “auto” | auto |
Whether Chawan should use the OSC 52 escape sequence for copying to the
clipboard directly through the terminal. When available, OSC 52
overrides external.copy-cmd.
When set to “auto” (the default), Chawan tries to detect whether OSC 52 is available on launch. |
| bracketed-paste | boolean | true |
Whether Chawan should ask for bracketed paste.
When true, the terminal will (hopefully) mark pasted text with escape sequences, which a) ensures that pasting a newline character into the line editor does not submit the editor, b) allows Chawan to intercept text pasted into the pager, automatically loading it into the browser’s URL bar. |
| wheel-scroll | number | 5 | Number of lines to scroll for a mouse wheel event. |
| side-wheel-scroll | number | 5 | Number of columns to scroll for a mouse side-wheel event. |
| link-hint-chars | string | abcdefghijklmnoprstuvxyz |
A string of characters to use in toggleLinkHints. Any
Unicode codepoint is accepted, and they are ordered as specified in this
option.
|
Examples:
[input]
vi-numeric-prefix = true
[page]
# Here, the arrow function will be called with the vi numbered prefix if
# one was input, and with no argument otherwise.
# The numeric prefix can never be zero, so it is safe to test for undefined
# using the ternary operator.
G = 'n => n ? pager.gotoLine(n) : pager.cursorLastLine()'
Network
Network options are to be placed in the [network]
section.
| Name | Value | Default | Function |
|---|---|---|---|
| max-redirect | number | 10 | Maximum number of redirections to follow. |
| max-net-connections | number | 12 | Maximum number of simultaneous network connections allowed in one buffer. Further connections are held back until the number returns below the threshold. |
| prepend-scheme | string | “https://” |
Prepend this to URLs passed to Chawan without a scheme.
Note that local files ( |
| proxy | URL | unset |
Specify a proxy for all network requests Chawan makes. Currently, the
formats http://user:pass@domain and
socks5://user:pass@domain are accepted. (Unlike in curl,
socks5h is an alias of socks5, and DNS
requests are always tunneled.)
Can be overridden by siteconf. |
| default-headers | table | {omitted} | Specify a list of default headers for all HTTP(S) network requests. Can be overridden by siteconf. |
| allow-http-from-file | boolean | false |
WARNING: think twice before enabling this.
Allows HTTP and HTTPS requests from the On the other hand, it allows loading images in HTML e-mails if you don’t care about the privacy implications. |
Display
Display options are to be placed in the [display]
section.
Following is a list of display options:
| Name | Value | Default | Function |
|---|---|---|---|
| color-mode | “monochrome” / “ansi” / “eight-bit” / “true-color” / “auto” | “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. |
| format-mode | “auto” / [“bold”, “italic”, “underline”, “reverse”, “strike”, “overline”, “blink”] | “auto” |
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”] | “overline” | Disable specific formatting modes. |
| image-mode | “auto” / “none” / “sixel” / “kitty” | “auto” |
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. This is the default setting, but you must
also enable |
| sixel-colors | “auto” / 2..65535 | “auto” |
Only applies when display.image-mode="sixel". Setting a
number overrides the number of sixel color registers reported by the
terminal.
|
| alt-screen | “auto” / boolean | “auto” | Enable/disable the alternative screen. |
| highlight-color | color | “cyan” |
Set the highlight color for incremental search and marks. Both hex
values and CSS color names are accepted.
In monochrome mode, this setting is ignored; instead, reverse video is used. |
| highlight-marks | boolean | true | Enable/disable highlighting of marks. |
| double-width-ambiguous | boolean | false | 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 | 100 | 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 | false | Force the screen to be completely cleared every time it is redrawn. |
| set-title | boolean | true | Set the terminal emulator’s window title to that of the current page. |
| default-background-color | “auto” / color | “auto” | Overrides the assumed background color of the terminal. “auto” leaves background color detection to Chawan. |
| default-foreground-color | “auto” / color | “auto” | Sets the assumed foreground color of the terminal. “auto” leaves foreground color detection to Chawan. |
| query-da1 | bool | true |
Enable/disable querying Primary Device Attributes, and with it, all
“dynamic” terminal querying.
Do not alter this value unless Chawan told you so; the output will look awful. |
| columns, lines, pixels-per-column, pixels-per-line | number | 80, 24, 9, 18 | 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 | false | Force-set columns, lines, pixels per column, or pixels per line to the fallback values provided above. |
Status
Options concerning the status bar (last line on the screen) are to be
placed in the [status] section.
Following is a list of status options:
| Name | Value | Default | Function |
|---|---|---|---|
| show-cursor-position | boolean | true | Whether or not the current line number should be displayed. |
| show-hover-link | boolean | true | Whether or not the link under the cursor should be displayed. |
Omnirule
The omni-bar (by default opened with C-l) can be used to perform
searches using omni-rules. These are to be specified as sub-keys to
table [omnirule]. (The sub-key itself is ignored; you can
use anything as long it doesn’t conflict with other keys.)
Examples:
# Search using DuckDuckGo Lite.
# (This rule is included in the default config, although C-k invokes
# Brave search.)
[omnirule.ddg]
match = '^ddg:'
substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + encodeURIComponent(x.split(":").slice(1).join(":"))'
# To use the above rule, open the URL bar with C-k, clear it with
# C-u, and type ddg:keyword.
# Alternatively, you can also redefine C-k like:
[page]
'C-k' = '() => pager.load("ddg:")'
# Search using Wikipedia, Firefox-style.
# The [[omnirule]] syntax introduces an anonymous omnirule; it is
# equivalent to the named one.
[[omnirule]]
match = '^@wikipedia'
substitute-url = '(x) => "https://en.wikipedia.org/wiki/Special:Search?search=" + encodeURIComponent(x.replace(/@wikipedia/, ""))'
As noted above, the default config includes some built-in rules, selected according to the maintainer’s preference and the minimum criterion that they must work without cookies and JavaScript. Currently, these are:
ddg:- DuckDuckGo Lite.br:- Brave Search.wk:- English Wikipedia.wd:- English Wikitionary.mo:- Mojeek.
Omnirule options:
| 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 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. |
Siteconf
Configuration options can be specified for individual sites. Entries
are to be specified as sub-keys to table [siteconf]. (The
sub-key itself is ignored; you can use anything as long it doesn’t
conflict with other keys.)
Most siteconf options can also be specified globally; see the “overrides” field.
Examples:
# Enable cookies on the orange website for log-in.
[siteconf.hn]
url = 'https://news\.ycombinator\.com/.*'
cookie = true
# Redirect npr.org to text.npr.org.
[siteconf.npr]
host = '(www\.)?npr\.org'
rewrite-url = '''
(x) => {
x.host = "text.npr.org";
const s = x.pathname.split('/');
x.pathname = s.at(s.length > 2 ? -2 : 1);
/* No need to return; URL objects are passed by reference. */
}
'''
# Allow cookie sharing on *sr.ht domains.
[siteconf.sr-ht]
host = '(.*\.)?sr\.ht' # either 'something.sr.ht' or 'sr.ht'
cookie = true # enable cookies (read-only; use "save" to persist them)
share-cookie-jar = 'sr.ht' # use the cookie jar of 'sr.ht' for all matched hosts
# Use the "vector" skin on Wikipedia.
# The [[siteconf]] syntax introduces an anonymous siteconf; it is
# equivalent to the above ones.
[[siteconf]]
url = '^https?://[a-z]+\.wikipedia\.org/wiki/(?!.*useskin=.*)'
rewrite-url = 'x => x.searchParams.append("useskin", "vector")'
# Make imgur send us images.
[siteconf.imgur]
host = '(i\.)?imgur\.com'
default-headers = {
User-Agent = "Mozilla/5.0 chawan",
Accept = "*/*",
Accept-Encoding = "gzip, deflate",
Accept-Language = "en;q=1.0",
Pragma = "no-cache",
Cache-Control = "no-cache"
}
Siteconf options:
| Name | Value | Overrides | Function |
|---|---|---|---|
| url | regex | n/a |
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 regex handling rules. |
| host | regex | n/a |
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 regex handling rules. |
| rewrite-url | JavaScript function | n/a | A JavaScript function Chawan will pass the site’s URL object to. If a new URL is returned, or the URL object is modified in any way, Chawan will transparently redirect the user to this new URL. |
| cookie | boolean / “save” |
buffer.cookie
|
Whether loading (with “save”, also saving) cookies should be allowed for this URL. |
| share-cookie-jar | host | n/a | Cookie jar to use for this domain. Useful for e.g. sharing cookies with subdomains. |
| referer-from | boolean |
buffer.referer-from
|
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. |
| scripting | boolean / “app” |
buffer.scripting
|
Enable/disable JavaScript execution on this site. See
buffer.scripting for details.
|
| styling | boolean |
buffer.styling
|
Enable/disable author styles (CSS) on this site. |
| images | boolean |
buffer.images
|
Enable/disable image display on this site. |
| document-charset | charset label string |
encoding.document-charset
|
Specify the default encoding for this site. |
| proxy | URL |
network.proxy
|
Specify a proxy for network requests fetching contents of this buffer. |
| default-headers | table |
network.default-headers
|
Specify a list of default headers for HTTP(S) network requests to this buffer. |
| insecure-ssl-no-verify | boolean | n/a |
Defaults to false. When set to true, this disables peer and hostname
verification for SSL keys on this site, like
curl --insecure would.
Please do not use this unless you are absolutely sure you know what you are doing. |
| autofocus | boolean |
buffer.autofocus
|
When set to true, elements with an “autofocus” attribute are focused on
automatically after the buffer is loaded.
If scripting is enabled, this also allows scripts to focus on elements. |
| meta-refresh | “never” / “always” / “ask” |
buffer.meta-refresh
|
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.
|
| history | boolean |
buffer.history
|
Whether or not browsing history should be saved to the disk for this URL. |
| mark-links | boolean |
buffer.mark-links
|
Add numeric markers before links. |
| user-style | string |
buffer.user-style
|
Specify a user style sheet specific to the site.
Please refer to |
Keybindings
Keybindings are to be placed in these sections:
- for pager interaction:
[page] - for line editing:
[line]
Keybindings are configured using the syntax
'<keybinding>' = '<action>'Where <keybinding> is a combination of unicode
characters with or without modifiers. Modifiers are the prefixes
C- and M-, which add control or escape to the
keybinding respectively (essentially making M- the same as
C-[). Modifiers can be escaped with the \
sign.
<action> is either a command defined in the
[cmd] section, or a JavaScript expression. Here we only
describe the pre-defined actions in the default config; for a
description of the API, please see:
Examples:
# show change URL when Control, Escape and j are pressed
'C-M-j' = 'load'
# go to the first line of the page when g is pressed twice without a preceding
# number, or to the line when a preceding number is given.
'gg' = 'gotoLineOrStart'
# JS functions and expressions are accepted too. Following replaces the
# default search engine with DuckDuckGo Lite.
# (See api.md for a list of available functions, and a discussion on how
# to add your own "namespaced" commands like above.)
'C-k' = '() => pager.load("ddg:")'Pager actions
| Default key | Name | Function |
|---|---|---|
| q |
quit
|
Exit the browser. |
| C-z |
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 |
load
|
Open the current address in the URL bar. |
| M-l |
loadCursor
|
Open the address of the link or image being hovered in the URL bar.
If no link/image is under the cursor, an empty URL bar is opened. |
| None |
loadEmpty
|
Open an empty address bar. |
| C-k |
webSearch
|
Open the URL bar with an arbitrary search engine. At the moment, this is Brave Search, but this may change in the future. |
| M-u |
dupeBuffer
|
Duplicate the current buffer by forking its content process. |
| U |
reloadBuffer
|
Open a new buffer with the current buffer’s URL, replacing the current buffer. |
| C-g |
lineInfo
|
Display information about the current line on the status line. |
| \ |
toggleSource
|
If viewing an HTML buffer, open a new buffer with its source. Otherwise, open the current buffer’s contents as HTML. |
| D |
discardBuffer
|
Discard the current buffer, and move back to the previous/next buffer depending on what the previously viewed buffer was. |
| d,, d. |
discardBufferPrev, discardBufferNext
|
Discard the current buffer, and move back to the previous/next buffer, or open the link under the cursor. |
| M-d |
discardTree
|
Discard all child buffers of the current buffer. |
| ., ,, M-,, M-., M-/ |
nextBuffer, prevBuffer,
prevSiblingBuffer, nextSiblingBuffer,
parentBuffer
|
Traverse the buffer list.
|
| M-c |
enterCommand
|
Directly enter a JavaScript command. Note that this interacts with the pager, not the website being displayed. |
| None |
searchForward, searchBackward
|
Search for a string in the current buffer, forwards or backwards. |
| /, ? |
isearchForward, searchBackward
|
Incremental-search for a string, highlighting the first result, forwards or backwards. |
| n, N |
searchNext, searchPrev
|
Jump to the nth (or if unspecified, first) next/previous search result. |
| None |
peek
|
Display a message of the current buffer’s URL on the status line. |
| u |
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 |
showFullAlert
|
Show the last alert inside the line editor. You can also view previous ones using C-p or C-n. |
| M-y |
copyURL
|
Copy the current buffer’s URL to the system clipboard. |
| yu |
copyCursorLink
|
Copy the link under the cursor to the system clipboard. |
| yI |
copyCursorImage
|
Copy the URL of the image under the cursor to the system clipboard. |
| M-p |
gotoClipboardURL
|
Go to the URL currently on the clipboard. |
| M-b |
openBookmarks
|
Open the bookmark file. |
| M-a |
addBookmark
|
Add the current page to your bookmarks. |
| f |
toggleLinkHints
|
Show hints before each link (or button). After typing a hint, the cursor
is placed on the respective link.
The hint character set may be customized with
|
Buffer actions
Note: n in the following text refers to a number
preceding the action. e.g. in 10gg, n = 10. If no preceding
number is input, then it is left unspecified.
| Default key | Name | Function |
|---|---|---|
| j/C-p/Up arrow, k/C-n/Down arrow |
cursorUp, cursorDown
|
Move the cursor upwards/downwards by n lines, or if n is unspecified, by 1. |
| h/Left arrow, l/Right arrow |
cursorLeft, cursorRight
|
Move the cursor to the left/right by n cells, or if n is unspecified, by 1. |
| 0/Home |
cursorLineBegin
|
Move the cursor to the first cell of the line. |
| ^ |
cursorLineTextStart
|
Move the cursor to the first non-blank character of the line. |
| $/End |
cursorLineEnd
|
Move the cursor to the last cell of the line. |
| w, W |
cursorNextWord, cursorNextViWord,
cursorNextBigWord
|
Move the cursor to the beginning of the next word. |
| None |
cursorPrevWord, cursorPrevViWord,
cursorPrevBigWord
|
Move the cursor to the end of the previous word. |
| e, E |
cursorWordEnd, cursorViWordEnd,
cursorBigWordEnd
|
Move the cursor to the end of the current word, or if already there, to the end of the next word. |
| b, B |
cursorWordBegin, cursorViWordBegin,
cursorBigWordBegin
|
Move the cursor to the beginning of the current word, or if already there, to the end of the previous word. |
| [, ] |
cursorPrevLink, cursorNextLink
|
Move the cursor to the end/beginning of the previous/next clickable element (e.g. link, input field, etc). |
| {, } |
cursorPrevParagraph, cursorNextParagraph
|
Move the cursor to the end/beginning of the nth previous/next paragraph. |
| None |
cursorRevNthLink
|
Move the cursor to the nth link of the document, counting backwards from the document’s last line. |
| None |
cursorNthLink
|
Move the cursor to the nth link of the document. |
| C-b, C-f, zH, zL |
pageUp, pageDown, pageLeft,
pageRight
|
Scroll up/down/left/right by n pages, or if n is unspecified, by one page. |
| C-u, C-d |
halfPageUp, halfPageDown,
halfPageLeft, 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 |
scrollUp, scrollDown, scrollLeft,
scrollRight
|
Scroll up/down/left/right by n lines, or if n is unspecified, by one line. |
| Enter/Return |
click
|
Click the HTML element currently under the cursor. n specifies the number of clicks in JS events. |
| c |
rightClick
|
Send a right click to the buffer. If it doesn’t catch the event (i.e. no JS context menu is shown), toggle the menu instead. |
| C |
toggleMenu
|
Toggle the menu. |
| I |
viewImage
|
View the image currently under the cursor in an external viewer. |
| R |
reshape
|
Reshape the current buffer (=render the current page anew.) Useful if the layout is not updating even though it should have. |
| r |
redraw
|
Redraw screen contents. Useful if something messed up the display. |
| None (see gotoLineOrStart/End instead) |
cursorFirstLine, cursorLastLine
|
Move to the beginning/end in the buffer. |
| H, M, L |
cursorTop, cursorMiddle,
cursorBottom
|
Move to the first line/line in the middle of/last line on the screen.
(Equivalent to H, M, L in vi.)
|
| zt, z Return, zz, z., zb, z- |
raisePage, raisePageBegin,
centerLine, centerLineBegin,
lowerPage, lowerPageBegin
|
If n is specified, move cursor to line n. Then,
Begin variants also move the cursor to the line’s
first non-blank character, as the variants originating from vi do.
|
| z+ |
nextPageBegin
|
If n is specified, move to the screen before the nth line and raise the page. Otherwise, go to the next screen’s first line and raise the page. |
| z^ |
previousPageBegin
|
If n is specified, move to the screen before the nth line and lower the page. Otherwise, go to the previous screen’s last line and lower the page. |
| g0, gc, g$ |
cursorLeftEdge, cursorMiddleColumn,
cursorRightEdge
|
Move to the first/middle/last column on the screen. |
| None |
centerColumn
|
Center screen around the current column. (w3m Z.)
|
| gg, G |
gotoLineOrStart, gotoLineOrEnd
|
If n is specified, jump to line n. Otherwise, jump to the start/end of the page. |
| |, None |
gotoColumnOrBegin, gotoColumnOrEnd
|
If n is specified, jump to column n of the current line. Otherwise, jump to the first/last column. |
| m |
mark
|
Wait for a character x and then set a mark with the ID
x.
|
| `, ’ |
gotoMark, gotoMarkY
|
Wait for a character x and then jump to the mark with the
ID x (if it exists on the page).
|
| : |
markURL
|
Convert URL-like strings to anchors on the current page. |
| s Return |
saveLink
|
Save resource from the URL pointed to by the cursor to the disk. |
| sS |
saveSource
|
Save the source of the current buffer to the disk. |
| sI |
saveImage
|
Save the image currently under the cursor. |
| M-i |
toggleImages
|
Toggle display of images in the current buffer. |
| M-j |
toggleScripting
|
Reload the current buffer with scripting enabled/disabled. |
| M-k |
toggleCookie
|
Reload the current buffer with cookies enabled/disabled. |
Line-editing actions
| Default key | Name | Function |
|---|---|---|
| Return |
line.submit
|
Submit the line. |
| C-c |
line.cancel
|
Cancel the current operation. |
| C-h, C-d |
line.backspace, line.delete
|
Delete character before (backspace)/after (delete) the cursor. |
| C-u/C-xC-?, C-k |
line.clear, line.kill
|
Delete text before (clear)/after (kill) the cursor. |
| C-xC-e |
line.openEditor
|
Open the line editor’s contents in $EDITOR.
|
| C-w, M-d |
line.clearWord, line.killWord
|
Delete word before (clear)/after (kill) the cursor. |
| C-b, C-f |
line.backward, line.forward
|
Move cursor backward/forward by one character. |
| M-b, M-f |
line.prevWord, line.nextWord
|
Move cursor to the previous/next word by one character |
| C-a/Home, C-e/End |
line.begin, line.end
|
Move cursor to the beginning/end of the line. |
| C-v |
line.escape
|
Ignore keybindings for next character. |
| C-p, C-n |
line.prevHist, line.nextHist
|
Jump to the previous/next history entry |
Note: to facilitate URL editing, the line editor has a different
definition of what a word is than the pager. For the line editor, a word
is either a sequence of alphanumeric characters, or any single
non-alphanumeric character. (This means that e.g. https://
consists of four words: https, :,
/ and /.)
# Control+A moves the cursor to the beginning of the line.
'C-a' = 'line.begin'
# Escape+D deletes everything after the cursor until it reaches a word-breaking
# character.
'M-d' = 'line.killWord'
Appendix
Regex handling
Regular expressions are currently handled using the libregexp library from QuickJS. This means that all regular expressions work as in JavaScript.
There are two different modes of regex preprocessing in Chawan: “search” mode and “match” mode. Match mode is used for configurations (meaning in all values in this document described as “regex”). Search mode is used for the on-page search function (using searchForward/isearchForward etc.)
Match mode
Regular expressions are assumed to be exact matches, except when they start with a caret (^) sign or end with an unescaped dollar ($) sign.
In other words, the following transformations occur:
^abcd -> ^abcd (no change, only beginning is matched)
efgh$ -> efgh$ (no change, only end is matched)
^ijkl$ -> ^ijkl$ (no change, the entire line is matched)
mnop -> ^mnop$ (changed to exact match, the entire line is matched)
Match mode has no way to toggle JavaScript regex flags like
i.
Search mode
For on-page search, the above transformations do not apply; the
search /abcd searches for the string abcd
inside all lines.
Search mode also has some other convenience transformations (these do not work in match mode):
- The string
\c(backslash + lower-case c) inside a search-mode regex enables case-insensitive matching. - Conversely,
\C(backslash + capital C) disables case-insensitive matching. (Useful if you haveignore-caseset to true, which is the default.) \<and\>is converted to\b(as in vi, grep, etc.)
Like match mode, search mode operates on individual lines. This means that search patterns do not match text wrapped over multiple lines.
Path handling
Rules for path handling are similar to how the shell handles strings.
- Tilde-expansion is used to determine the user’s home directory. So
e.g.
~/whateverworks. - Environment variables can be used like
$ENV_VAR. - Relative paths are relative to the Chawan configuration directory
(i.e.
$CHA_DIR).
Some environment variables are also exported by Chawan:
$CHA_BIN_DIR: the directory which thechabinary resides in. Symbolic links are automatically resolved to determine this path.$CHA_LIBEXEC_DIR: the directory for all executables Chawan uses for operation. By default, this is$CHA_BIN_DIR/../libexec/chawan.$CHA_DIR: the configuration directory. (This can also be set by the user; see the top section for details.)$CHA_DATA_DIR: if the configuration file uses XDG base directories, this is${XDG_DATA_HOME:-$HOME/.local/share}/chawan. Otherwise, it is the same as$CHA_DIR.- Exception: if
$CHA_DIRis set beforechais invoked, then$CHA_DATA_DIRis also read. This is to make nested invocations work in configurations with XDG basedirs.
- Exception: if
Word types
Word-based pager commands can operate with different definitions of words. Currently, these are:
- w3m words
- vi words
- Big words
w3m word
A w3m word is a sequence of alphanumeric characters. Symbols are treated in the same way as whitespace.
vi word
A vi word is a sequence of characters in the same character category. Currently, character categories are alphanumeric characters, symbols, han letters, hiragana, katakana, and hangul.
vi words may be separated by whitespace; however, vi words from separate categories do not have to be whitespace-separated. e.g. the following character sequence contains two words:
hello[]+{}@`!
Big word
A big word is a sequence of non-whitespace characters.
It is essentially the same as a w3m word, but with symbols being defined as non-whitespace.