.\" Automatically generated by Pandoc 3.9.0.2 .\" .TH "CHA-CONFIG" "5" .SH 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: .IP \(bu 2 Regular tables (\f[CR][table]\f[R]) and inline tables (\f[CR]table = {}\f[R]) have different semantics. The first is additive, meaning default values are not removed. The second is destructive, and clears all default definitions in the table specified. .IP \(bu 2 \f[CR][[table\-array]]\f[R] is sugar for \f[CR][table\-array.n]\f[R], where \f[CR]n\f[R] is the number of declared table arrays. For example, you can declare anonymous siteconfs using the syntax \f[CR][[siteconf]]\f[R]. .PP The canonical configuration file path is \(ti/.chawan/config.toml, but the search path accommodates XDG basedirs as well: .IP "1." 3 config file specified through \-C switch \-> use that .IP "2." 3 \f[CR]$CHA_DIR\f[R] is set \-> use \f[CR]$CHA_DIR/config.toml\f[R] .IP "3." 3 \f[CR]${XDG_CONFIG_HOME:\-\(ti/.config}/chawan/config.toml\f[R] exists \-> use that .IP "4." 3 \f[CR]\(ti/.chawan/config.toml\f[R] exists \-> use that .PP See the \f[I]Path handling\f[R] section for details on how the config directory can be accessed. .PP For a configuration template, see bonus/config.toml in the source distribution. .SS Start Start\-up options are to be placed in the \f[CR][start]\f[R] section. .PP Following is a list of start\-up options: .TP visual\-home = \(lqabout:chawan\(rq \f[B]URL\f[R] .RS Page opened when Chawan is called with the \-V option and no other pages are passed as arguments. .RE .TP startup\-script = \(lq\(rq \f[B]JavaScript code\f[R] .RS 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.) .RE .TP headless = false \f[B]boolean\f[R] / \f[B]\(lqdump\(rq\f[R] .RS When set to true or \(lqdump\(rq, the browser does not take input; instead, it prints a rendered version of all buffers in order, then exits. The difference between \f[CR]true\f[R] and \(lqdump\(rq is that \f[CR]true\f[R] first waits for all scripts and network requests to run to completion, while \(lqdump\(rq does not. This means that \f[CR]true\f[R] may never exit when scripting is enabled (e.g.\ if a script sets \f[CR]setInterval\f[R].) Piping \f[CR]cha\f[R] to an external program or passing the \f[CR]\-d\f[R] switch has the same effect as setting this option to \(lqdump\(rq. .RE .TP console\-buffer = true \f[B]boolean\f[R] .RS 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. .RE .SS Buffer Buffer options are to be placed in the \f[CR][buffer]\f[R] section. .PP These options are global to all buffers. For more granular filtering, use \f[CR][[siteconf]]\f[R]. .PP Example: .IP .EX \f[B][buffer]\f[R] \f[I]# show images on all websites\f[R] images = true \f[I]# disable website CSS\f[R] styling = false \f[I]# Specify user styles.\f[R] user\-style = \(aq\(aq\(aq /* you can import external UA styles like this: */ \(atimport \(aquser.css\(aq; /* or just insert the style inline as follows. */ /* enforce the default text\-decoration for links (i.e. underline). */ a[href] { text\-decoration: revert !important } \(atmedia (monochrome) { /* only in color\-mode \(dqmonochrome\(dq (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\(aqt want websites to * override the value. */ a[href]:hover { font\-style: italic !important } } \(aq\(aq\(aq \f[I]# You *can* set scripting to true here, but I strongly recommend using\f[R] \f[I]# [[siteconf]] to enable it on a per\-site basis instead.\f[R] .EE .PP Following is a list of buffer options: .TP styling = true \f[B]boolean\f[R] .RS Enable/disable author style sheets. Note that disabling this does not affect user styles. .RE .TP scripting = false \f[B]boolean\f[R] / \f[B]\(lqapp\(rq\f[R] .RS Enable/disable JavaScript in \f[I]all\f[R] buffers. \f[CR]\(dqapp\(dq\f[R] also enables JavaScript APIs that can be used to fingerprint users (e.g.\ querying the window\(cqs size). This may achieve better compatibility with websites that behave like applications, at the cost of reduced privacy. For security and performance reasons, users are encouraged to selectively enable JavaScript with \f[CR][[siteconf]]\f[R] instead of using this setting. .RE .TP images = false \f[B]boolean\f[R] .RS Enable/disable inline image display. .RE .TP cookie = false \f[B]boolean\f[R] / \f[B]\(lqsave\(rq\f[R] .RS Enable/disable cookies on sites. If the string \(lqsave\(rq is specified, then cookies are also saved to \f[CR]external.cookie\-file\f[R]. \f[CR]true\f[R] still reads cookies.txt, but does not modify it. 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 \f[CR][[siteconf]]\f[R] \f[CR]\(dqshare\-cookie\-jar\(dq\f[R] setting to adjust this behavior for specific sites. .RE .TP referer\-from = false \f[B]boolean\f[R] .RS Enable/disable the \(lqReferer\(rq header. Defaults to false. For privacy reasons, users are encouraged to leave this option disabled, only enabling it for specific sites in \f[CR][[siteconf]]\f[R]. .RE .TP autofocus = false \f[B]boolean\f[R] .RS When set to true, elements with an \(lqautofocus\(rq attribute are focused on automatically after the buffer is loaded. If scripting is enabled, this also allows scripts to focus on elements. .RE .TP meta\-refresh = \(lqask\(rq \f[B]\(lqnever\(rq\f[R] / \f[B]\(lqalways\(rq\f[R] / \f[B]\(lqask\(rq\f[R] .RS Whether or not \f[CR]http\-equiv=refresh\f[R] meta tags should be respected. \(lqnever\(rq completely disables them, \(lqalways\(rq automatically accepts all of them, \(lqask\(rq brings up a pop\-up menu. .RE .TP history = true \f[B]boolean\f[R] .RS Whether or not browsing history should be saved to the disk. .RE .TP mark\-links = false \f[B]boolean\f[R] .RS Add numeric markers before links. In headless/dump mode, this also prints a list of URLs after the page. .RE .TP user\-style = \(lq\(rq \f[B]CSS stylesheet\f[R] .RS A user stylesheet applied to all buffers. External stylesheets can be imported using the \f[CR]\(atimport \(aqfile.css\(aq;\f[R] syntax. Paths are relative to the configuration directory. Nested \f[CR]\(atimport\f[R] is not supported yet. .RE .SS Search Search options are to be placed in the \f[CR][search]\f[R] section. .PP Following is a list of search options: .TP wrap = true \f[B]boolean\f[R] .RS Whether on\-page searches should wrap around the document. .RE .TP ignore\-case = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]boolean\f[R] .RS When set to true, document\-wide searches are case\-insensitive by default. When set to \(lqauto\(rq, 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 \f[CR]\(rsc\f[R] (ignore case) and \f[CR]\(rsC\f[R] (strict case). See search mode for details. .RE .SS Encoding Encoding options are to be placed in the \f[CR][encoding]\f[R] section. .PP Following is a list of encoding options: .TP document\-charset = [\(lqutf\-8\(rq, \(lqsjis\(rq, \(lqeuc\-jp\(rq, \(lqlatin2\(rq] \f[B]array of charset label strings\f[R] .RS 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. .RE .TP display\-charset = \(lqauto\(rq \f[B]charset label string\f[R] / \f[B]\(lqauto\(rq\f[R] .RS Character set for keyboard input and displaying documents. Used in dump mode as well. (This means that e.g.\ \f[CR]cha \-I EUC\-JP \-O UTF\-8 a > b\f[R] is roughly equivalent to \f[CR]iconv \-f EUC\-JP \-t UTF\-8\f[R].) .RE .SS External External options are to be placed in the \f[CR][external]\f[R] section. .PP Following is a list of external options: .TP tmpdir = {usually \(lq/tmp/cha\-tmp\-user\(rq} \f[B]path\f[R] .RS Directory used to save temporary files. .RE .TP editor = \(lq${VISUAL:\-${EDITOR:\-vi}}\(rq \f[B]shell command\f[R] .RS External editor command. %s is substituted for the file name, %d for the line number. .RE .TP mailcap = [\(lq\(ti/.mailcap\(rq, \(lq/etc/mailcap\(rq, \(lq/usr/etc/mailcap\(rq, \(lq/usr/local/etc/mailcap\(rq] \f[B]array of paths\f[R] .RS Search path for mailcap files. See \f[B]cha\-mailcap\f[R](5) for details. Directories specified first have higher precedence. .RE .TP mime\-types = [\(lq\(ti/.mime.types\(rq, \(lq/etc/mime.types\(rq, \(lq/usr/etc/mime.types\(rq, \(lq/usr/local/etc/mime.types\(rq] \f[B]array of paths\f[R] .RS Search path for mime.types files. See \f[B]cha\-mime.types\f[R](5) for details. .RE .TP auto\-mailcap = \(lq$CHA_DIR/mailcap\(rq \f[B]path\f[R] .RS Mailcap file for entries that are automatically executed. The \(lqOpen as\(rq prompt also saves entries in this file. For backwards\-compatibility, if this is \(lqmailcap\(rq and the file does not exist, Chawan will also check \(lqauto.mailcap\(rq. .RE .TP cgi\-dir = [\(lq$CHA_DIR/cgi\-bin\(rq, \(lq$CHA_LIBEXEC_DIR/cgi\-bin\(rq] \f[B]array of paths\f[R] .RS Search path for local CGI scripts. See \f[B]cha\-cgi\f[R](5) for details. .RE .TP urimethodmap = [\(lq$CHA_DIR/urimethodmap\(rq, \(lq\(ti/.urimethodmap\(rq, \(lq/etc/urimethodmap\(rq] \f[B]array of paths\f[R] .RS Search path for urimethodmap files. See \f[B]cha\-urimethodmap\f[R](5) for details. .RE .TP w3m\-cgi\-compat = false \f[B]boolean\f[R] .RS Enable local CGI compatibility with w3m. In short, it redirects \f[CR]file:///cgi\-bin/*\f[R] and \f[CR]file:///$LIB/cgi\-bin/*\f[R] to \f[CR]cgi\-bin:*\f[R]. See \f[B]cha\-cgi\f[R](5) for details. .RE .TP download\-dir = \(lq${TMPDIR:\-/tmp}/\(rq \f[B]path\f[R] .RS Path to pre\-fill for \(lqSave to:\(rq prompts. .RE .TP show\-download\-panel = true \f[B]boolean\f[R] .RS Whether \f[CR]about:downloads\f[R] should be opened after starting a download. .RE .TP copy\-cmd = \(lqxsel \-bi\(rq \f[B]shell command\f[R] .RS Command to use for \(lqcopy to clipboard\(rq operations. When \f[CR]input.osc52\-copy\f[R] is set to \(lqauto\(rq (the default), \f[CR]copy\-cmd\f[R] is ignored if support for OSC 52 is detected. .RE .TP paste\-cmd = \(lqxsel \-bo\(rq \f[B]shell command\f[R] .RS Command to use for \(lqread from clipboard\(rq operations. .RE .TP bookmark = \(lq$CHA_DATA_DIR/bookmark.md\(rq \f[B]path\f[R] .RS Path to the bookmark.md file. (The file it points to should have a .md extension, so that its type can be correctly deduced.) .RE .TP history\-file = \(lq$CHA_DATA_DIR/history.uri\(rq \f[B]path\f[R] .RS Path to the history file. .RE .TP history\-size = 100 \f[B]number\f[R] .RS Maximum length of the history file. .RE .TP cookie\-file = \(lq$CHA_DATA_DIR/cookies.txt\(rq \f[B]path\f[R] .RS Path to the cookie file. The format is equivalent to curl\(cqs \(lqcookies.txt\(rq format, except that a \(lqjar\(at\(rq part is prepended for cookies that belong in a different jar than the domain. Cookies from this file are used if \(lqbuffer.cookie\(rq (or its equivalent siteconf override) is set to \f[CR]true\f[R] or \f[CR]\(dqsave\(dq\f[R]. This means that \f[CR]true\f[R] sets the cookie\-file to a \(lqread\-only\(rq mode. .RE .SS Input Input options are to be placed in the \f[CR][input]\f[R] section. .TP vi\-numeric\-prefix = true \f[B]boolean\f[R] .RS Whether vi\-style numeric prefixes to commands should be accepted. Only applies for keybindings defined in \f[CR][page]\f[R]. .RE .TP use\-mouse = \(lqauto\(rq \f[B]boolean\f[R] / \f[B]\(lqauto\(rq\f[R] .RS Whether Chawan is allowed to intercept mouse clicks. The current implementation imitates w3m. When set to \(lqauto\(rq (the default), Chawan tries to detect whether mouse support is available. .RE .TP osc52\-copy = \(lqauto\(rq \f[B]boolean\f[R] / \f[B]\(lqauto\(rq\f[R] .RS Whether Chawan should use the OSC 52 escape sequence for copying to the clipboard directly through the terminal. When available, OSC 52 overrides \f[CR]external.copy\-cmd\f[R]. When set to \(lqauto\(rq (the default), Chawan tries to detect whether OSC 52 is available on launch. .RE .TP osc52\-primary = \(lqauto\(rq \f[B]boolean\f[R] / \f[B]\(lqauto\(rq\f[R] .RS Whether Chawan should try to set the primary selection through OSC 52. This happens automatically on mouse selection, and also on all clipboard copies. When set to \(lqauto\(rq (the default), Chawan tries to detect whether the terminal is capable of setting the primary selection. Note that very few terminals actually implement OSC 52 correctly (to my knowledge, only XTerm and Kitty), and on other terminals this might even break copying to the clipboard selection. .RE .TP bracketed\-paste = \(lqauto\(rq \f[B]boolean\f[R] / \f[B]\(lqauto\(rq\f[R] .RS 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\(cqs URL bar. When set to \(lqauto\(rq (the default), Chawan tries to only enable bracketed paste if the terminal is known not to misbehave when trying to do so. .RE .TP wheel\-scroll = 5 \f[B]number\f[R] .RS Number of lines to scroll for a mouse wheel event. .RE .TP side\-wheel\-scroll = 5 \f[B]number\f[R] .RS Number of columns to scroll for a mouse side\-wheel event. .RE .TP link\-hint\-chars = \(lqabcdefghijklmnoprstuvxyz\(rq \f[B]string\f[R] .RS A string of characters to use in \f[CR]toggleLinkHints\f[R]. Any Unicode codepoint is accepted, and they are ordered as specified in this option. .RE .PP Examples: .IP .EX [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 = \(aqn => n ? pager.gotoLine(n) : pager.cursorLastLine()\(aq .EE .SS Network Network options are to be placed in the \f[CR][network]\f[R] section. .TP max\-redirect = 10 \f[B]number\f[R] .RS Maximum number of redirections to follow. .RE .TP max\-net\-connections = 12 \f[B]number\f[R] .RS Maximum number of simultaneous network connections allowed in one buffer. Further connections are held back until the number returns below the threshold. .RE .TP prepend\-scheme = \(lqhttps://\(rq \f[B]string\f[R] .RS Prepend this to URLs passed to Chawan (or typed into the URL bar) without a scheme. Note that local files (\f[CR]file:\f[R] scheme) will always be checked first; only if this fails, Chawan will retry the request with \f[CR]prepend\-scheme\f[R] set as the scheme. .RE .TP proxy = \(lq\(rq \f[B]URL\f[R] .RS Specify a proxy for all network requests Chawan makes. Currently, the formats \f[CR]http://user:pass\(atdomain\f[R] and \f[CR]socks5://user:pass\(atdomain\f[R] are accepted. Unlike in curl, \f[CR]socks5h\f[R] is an alias of \f[CR]socks5\f[R], and DNS requests are always tunneled. Can be overridden by siteconf. .RE .TP default\-headers = {see bonus/config.toml} \f[B]table\f[R] .RS Specify a table of default headers for all HTTP(S) network requests. Can be overridden by siteconf. .RE .TP allow\-http\-from\-file = false \f[B]boolean\f[R] .RS \f[B]WARNING: think twice before enabling this.\f[R] Allows HTTP and HTTPS requests from the \f[CR]file:\f[R] and \f[CR]stream:\f[R] schemes. This is a bad idea in general, because it allows local files to ping remote servers (a functionality commonly abused by HTML e\-mails to track your mailbox activity). On the other hand, it allows loading images in HTML e\-mails if you don\(cqt care about the privacy implications. .RE .SS Display Display options are to be placed in the \f[CR][display]\f[R] section. .PP Following is a list of display options: .TP color\-mode = \(lqauto\(rq \f[B]\(lqmonochrome\(rq\f[R] / \f[B]\(lqansi\(rq\f[R] / \f[B]\(lqeight\-bit\(rq\f[R] / \f[B]\(lqtrue\-color\(rq\f[R] / \f[B]\(lqauto\(rq\f[R] .RS Set the color mode. \(lqauto\(rq for automatic detection, \(lqmonochrome\(rq for black on white, \(lqansi\(rq for eight ANSI plus eight aixterm colors, \(lqeight\-bit\(rq for 256\-color mode, and \(lqtrue\-color\(rq for 24\-bit colors. .RE .TP format\-mode = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B][\(lqbold\(rq, \(lqitalic\(rq, \(lqunderline\(rq, \(lqreverse\(rq, \(lqstrike\(rq, \(lqoverline\(rq, \(lqblink\(rq]\f[R] .RS Specifies allowed output formatting modes. Accepts the string \(lqauto\(rq or an array of specific attributes. \(lqauto\(rq (the default) tries to detect supported formatting modes when launched visually, and omits all formatting modes in dump mode. An empty array (\f[CR][]\f[R]) disables formatting even in visual mode. .RE .TP no\-format\-mode = [\(lqoverline\(rq] \f[B][\(lqbold\(rq, \(lqitalic\(rq, \(lqunderline\(rq, \(lqreverse\(rq, \(lqstrike\(rq, \(lqoverline\(rq, \(lqblink\(rq]\f[R] .RS Disable specific formatting modes. .RE .TP image\-mode = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]\(lqnone\(rq\f[R] / \f[B]\(lqsixel\(rq\f[R] / \f[B]\(lqkitty\(rq\f[R] .RS Specifies the image output mode. \(lqsixel\(rq uses sixels for output, \(lqkitty\(rq uses the Kitty image display protocol, \(lqnone\(rq disables image display completely. \(lqauto\(rq (the default) detects sixel or kitty support automatically, and falls back to \(lqnone\(rq when neither are available. This is expected to work on all known terminals with functional image support. Note that \f[CR]buffer.images\f[R] must be enabled for images to load at all. .RE .TP sixel\-colors = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]2..65535\f[R] .RS Only applies when \f[CR]display.image\-mode=\(dqsixel\(dq\f[R]. Setting this to a number overrides the number of sixel color registers reported by the terminal. .RE .TP alt\-screen = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]boolean\f[R] .RS Enable/disable the alternative screen. \(lqauto\(rq (the default) tries to detect support for this feature. (However, since Chawan does not link to terminfo, you should not expect hacks which remove the respective terminfo description to work.) .RE .TP highlight\-color = \(lq\-cha\-ansi(bright\-cyan)\(rq \f[B]CSS color\f[R] .RS Set the highlight color for incremental search and marks. CSS color names, hex values, and color functions are all accepted. In monochrome mode, this setting is ignored; instead, reverse video is used. .RE .TP highlight\-marks = true \f[B]boolean\f[R] .RS Enable/disable highlighting of marks. .RE .TP double\-width\-ambiguous = false \f[B]boolean\f[R] .RS Assume the terminal displays characters in the East Asian Ambiguous category as double\-width characters. Useful when e.g.\ ○ occupies two cells. .RE .TP minimum\-contrast = 100 \f[B]0..235\f[R] .RS Specify the minimum difference between the luminance (Y) of the default terminal background and the foreground as represented in YUV. 0 disables this function (i.e.\ allows black letters on black background, etc). Note: in the past, this option used to apply to all colors, but since v0.3 Chawan only performs color contrast correction when either the foreground or background color is the terminal default. Also, the contrast correction algorithm is still not perfect, so future changes are to be expected. .RE .TP set\-title = true \f[B]boolean\f[R] .RS Set the terminal emulator\(cqs window title to that of the current page. .RE .TP default\-background\-color = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]RGB color\f[R] .RS Overrides the assumed background color of the terminal. \(lqauto\(rq leaves background color detection to Chawan. .RE .TP default\-foreground\-color = \(lqauto\(rq \f[B]\(lqauto\(rq\f[R] / \f[B]RGB color\f[R] .RS Sets the assumed foreground color of the terminal. \(lqauto\(rq leaves foreground color detection to Chawan. .RE .TP columns = 80, lines = 24, pixels\-per\-column = 9, pixels\-per\-line = 18 \f[B]number\f[R] .RS 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.) .RE .TP force\-columns = false, force\-lines = false, force\-pixels\-per\-column = false, force\-pixels\-per\-line = false \f[B]boolean\f[R] .RS Force\-set columns, lines, pixels per column, or pixels per line to the fallback values provided above. .RE .SS Status Options concerning the status bar (last line on the screen) are to be placed in the \f[CR][status]\f[R] section. .PP Following is a list of status options: .TP show\-cursor\-position = true \f[B]boolean\f[R] .RS Whether or not the current line number should be displayed. .RE .TP show\-hover\-link = true \f[B]boolean\f[R] .RS Whether or not the link under the cursor should be displayed. .RE .TP format\-mode = \(lqreverse\(rq \f[B]{see [display] section}\f[R] .RS Formatting of the status bar. .RE .SS 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 \f[CR][omnirule]\f[R]. (The sub\-key itself is ignored; you can use anything as long it doesn\(cqt conflict with other keys.) .PP Examples: .IP .EX # Search using DuckDuckGo Lite. # (This rule is included in the default config, although C\-k invokes # Brave search.) [omnirule.ddg] match = \(aq\(haddg:\(aq substitute\-url = \(aq(x) => \(dqhttps://lite.duckduckgo.com/lite/?kp=\-1&kd=\-1&q=\(dq + encodeURIComponent(x.split(\(dq:\(dq).slice(1).join(\(dq:\(dq))\(aq # 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] \(aqC\-k\(aq = \(aq() => pager.load(\(dqddg:\(dq)\(aq # Search using Wikipedia, Firefox\-style. # The [[omnirule]] syntax introduces an anonymous omnirule; it is # equivalent to the named one. [[omnirule]] match = \(aq\(ha\(atwikipedia\(aq substitute\-url = \(aq(x) => \(dqhttps://en.wikipedia.org/wiki/Special:Search?search=\(dq + encodeURIComponent(x.replace(/\(atwikipedia/, \(dq\(dq))\(aq .EE .PP As noted above, the default config includes some built\-in rules, selected according to the maintainer\(cqs preference and the minimum criterion that they must work without cookies and JavaScript. Currently, these are: .IP \(bu 2 \f[CR]ddg:\f[R] \- DuckDuckGo Lite. .IP \(bu 2 \f[CR]br:\f[R] \- Brave Search. .IP \(bu 2 \f[CR]wk:\f[R] \- English Wikipedia. .IP \(bu 2 \f[CR]wd:\f[R] \- English Wikitionary. .IP \(bu 2 \f[CR]mo:\f[R] \- Mojeek. .PP Omnirule options: .TP match \f[B]regex\f[R] .RS 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. .RE .TP substitute\-url \f[B]JavaScript function\f[R] .RS 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. .RE .SS Siteconf Configuration options can be specified for individual sites. Entries are to be specified as sub\-keys to table \f[CR][siteconf]\f[R]. (The sub\-key itself is ignored; you can use anything as long it doesn\(cqt conflict with other keys.) .PP Most siteconf options can also be specified globally; see the \(lqoverrides\(rq field. .PP Examples: .IP .EX # Enable cookies on the orange website for log\-in. [siteconf.hn] url = \(aqhttps://news\(rs.ycombinator\(rs.com/.*\(aq cookie = true # Redirect npr.org to text.npr.org. [siteconf.npr] host = \(aq(www\(rs.)?npr\(rs.org\(aq rewrite\-url = \(aq\(aq\(aq (x) => { x.host = \(dqtext.npr.org\(dq; const s = x.pathname.split(\(aq/\(aq); x.pathname = s.at(s.length > 2 ? \-2 : 1); /* No need to return; URL objects are passed by reference. */ } \(aq\(aq\(aq # Allow cookie sharing on *sr.ht domains. [siteconf.sr\-ht] host = \(aq(.*\(rs.)?sr\(rs.ht\(aq # either \(aqsomething.sr.ht\(aq or \(aqsr.ht\(aq cookie = true # enable cookies (read\-only; use \(dqsave\(dq to persist them) share\-cookie\-jar = \(aqsr.ht\(aq # use the cookie jar of \(aqsr.ht\(aq for all matched hosts # Use the \(dqvector\(dq skin on Wikipedia. # The [[siteconf]] syntax introduces an anonymous siteconf; it is # equivalent to the above ones. [[siteconf]] url = \(aq\(hahttps?://[a\-z]+\(rs.wikipedia\(rs.org/wiki/(?!.*useskin=.*)\(aq rewrite\-url = \(aqx => x.searchParams.append(\(dquseskin\(dq, \(dqvector\(dq)\(aq # Make imgur send us images. [siteconf.imgur] host = \(aq(i\(rs.)?imgur\(rs.com\(aq default\-headers = { User\-Agent = \(dqMozilla/5.0 chawan\(dq, Accept = \(dq*/*\(dq, Accept\-Encoding = \(dqgzip, deflate\(dq, Accept\-Language = \(dqen;q=1.0\(dq, Pragma = \(dqno\-cache\(dq, Cache\-Control = \(dqno\-cache\(dq } .EE .PP Siteconf options: .TP url \f[B]regex\f[R] .RS Regular expression used to match the URL. Either this or the \f[CR]host\f[R] option must be specified. Note: regexes are handled according to the match mode regex handling rules. .RE .TP host \f[B]regex\f[R] .RS Regular expression used to match the host part of the URL (i.e.\ domain name/ip address). Either this or the \f[CR]url\f[R] option (but not both) must be specified. Note: regexes are handled according to the match mode regex handling rules. .RE .TP rewrite\-url \f[B]JavaScript function\f[R] .RS A JavaScript function Chawan will pass the site\(cqs 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. .RE .TP cookie = buffer.cookie \f[B]boolean\f[R] / \f[B]\(lqsave\(rq\f[R] .RS Whether loading (with \(lqsave\(rq, also saving) cookies should be allowed for this URL. .RE .TP share\-cookie\-jar \f[B]host string\f[R] .RS Cookie jar to use for this domain. Useful for e.g.\ sharing cookies with subdomains. .RE .TP referer\-from = buffer.referer\-from \f[B]boolean\f[R] .RS Whether or not Chawan 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 \(lqa.com\(rq as the Referer header. .RE .TP scripting = buffer.scripting \f[B]boolean\f[R] / \f[B]\(lqapp\(rq\f[R] .RS Enable/disable JavaScript execution on this site. See \f[CR]buffer.scripting\f[R] for details. .RE .TP styling = buffer.styling \f[B]boolean\f[R] .RS Enable/disable author styles (CSS) on this site. .RE .TP images = buffer.images \f[B]boolean\f[R] .RS Enable/disable loading of images on this site. .RE .TP document\-charset = encoding.document\-charset \f[B]charset label string\f[R] .RS Specify the default encoding for this site. .RE .TP proxy = network.proxy \f[B]URL string\f[R] .RS Specify a proxy for network requests fetching contents of this buffer. .RE .TP default\-headers = network.default\-headers \f[B]table\f[R] .RS Specify a list of default headers for HTTP(S) network requests to this buffer. .RE .TP insecure\-ssl\-no\-verify = false \f[B]boolean\f[R] .RS When set to true, this disables peer and hostname verification for SSL keys on this site, like \f[CR]curl \-\-insecure\f[R] would. Please do not use this unless you are absolutely sure you know what you are doing. .RE .TP autofocus = buffer.autofocus \f[B]boolean\f[R] .RS When set to true, elements with an \(lqautofocus\(rq attribute are focused on automatically after the buffer is loaded. If scripting is enabled, this also allows scripts to focus on elements. .RE .TP meta\-refresh = buffer.meta\-refresh \f[B]\(lqnever\(rq\f[R] / \f[B]\(lqalways\(rq\f[R] / \f[B]\(lqask\(rq\f[R] .RS Whether or not \f[CR]http\-equiv=refresh\f[R] meta tags and headers should be respected. \(lqnever\(rq completely disables them, \(lqalways\(rq automatically accepts all of them, \(lqask\(rq brings up a pop\-up menu. .RE .TP history = buffer.history \f[B]boolean\f[R] .RS Whether or not browsing history should be saved to the disk for this URL. .RE .TP mark\-links = buffer.mark\-links \f[B]boolean\f[R] .RS Add numeric markers before links. .RE .TP user\-style = buffer.user\-style \f[B]string\f[R] .RS Specify a user style sheet specific to the site. Refer to \f[CR]buffer.user\-style\f[R] for details. .RE .SS Keybindings Keybindings are to be placed in these sections: .IP \(bu 2 for pager interaction: \f[CR][page]\f[R] .IP \(bu 2 for line editing: \f[CR][line]\f[R] .PP Keybindings are configured using the syntax .IP .EX \(aq\(aq = \(aq\(aq .EE .PP Where \f[CR]\f[R] is a combination of unicode characters using the syntax described below. .PP \f[CR]\f[R] is either a command defined in the \f[CR][cmd]\f[R] section, or a JavaScript expression. This document only describes the pre\-defined actions in the default config; for a description of the API, see \f[B]cha\-api\f[R](7). .PP Examples: .IP .EX \f[I]# show change URL when Control, Escape and j are pressed\f[R] \(aqC\-M\-j\(aq = \(aqload\(aq \f[I]# go to the first line of the page when g is pressed twice without a preceding\f[R] \f[I]# number, or to the line when a preceding number is given.\f[R] \(aqg g\(aq = \(aqgotoLineOrStart\(aq \f[I]# JS functions and expressions are accepted too. Following replaces the\f[R] \f[I]# default search engine with DuckDuckGo Lite.\f[R] \f[I]# (See api.md for a list of available functions, and a discussion on how\f[R] \f[I]# to add your own \(dqnamespaced\(dq commands like above.)\f[R] \(aqC\-k\(aq = \(aq() => pager.load(\(dqddg:\(dq)\(aq .EE .SS Keybinding format A keybinding is a space\-separated list of keys, optionally prefixed by modifiers \f[CR]S\-\f[R] (shift), \f[CR]C\-\f[R] (control), or \f[CR]M\-\f[R] (meta). .PP In general, ASCII/Unicode keys can be written as\-is. The exception is space, which is written as \f[CR]SPC\f[R]. .PP Other supported named keys are: \f[CR]TAB\f[R], \f[CR]ESC\f[R], \f[CR]RET\f[R] (return key), \f[CR]LF\f[R] (enter key/line feed), \f[CR]Left\f[R], \f[CR]Up\f[R], \f[CR]Down\f[R], \f[CR]Right\f[R] (cursor keys), \f[CR]PageUp\f[R], \f[CR]PageDown\f[R] (page up/down), \f[CR]Home\f[R], \f[CR]End\f[R], and function keys \f[CR]F1\f[R] through \f[CR]F20\f[R]. .PP For backwards\-compatibility, spaces can be omitted from key sequences that do not start with an upper\-case letter. For example, \f[CR]\(aqgg\(aq\f[R] and \f[CR]\(aqg g\(aq\f[R] are equivalent. However, components that start with an upper\-case letter (e.g.\ \f[CR]\(aqGg\(aq\f[R]) are reserved for key names, so those must be space\-separated (e.g.\ \f[CR]\(aqG g\(aq\f[R]) to avoid ambiguous parsing. .PP Also, for backwards\-compatibility, spaces at the beginning/end of the keybinding are translated to \f[CR]SPC\f[R]. .SS Pager actions Default keybindings are highlighted in \f[B]bold\f[R]. .TP quit \f[B]q\f[R] .RS Exit the browser. .RE .TP suspend \f[B]C\-z\f[R] .RS 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. .RE .TP load \f[B]C\-l\f[R] .RS Open the current address in the URL bar. .RE .TP loadCursor \f[B]M\-l\f[R] .RS 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. .RE .TP loadEmpty Open an empty address bar. .TP webSearch \f[B]C\-k\f[R] .RS Open the URL bar with an arbitrary search engine. At the moment, this is Brave Search, but this may change in the future. .RE .TP dupeBuffer \f[B]M\-u\f[R] .RS Duplicate the current buffer. This is a shallow clone, so modifications to one buffer will affect the other. .RE .TP reloadBuffer \f[B]U\f[R] .RS Open a new buffer with the current buffer\(cqs URL, replacing the current buffer. .RE .TP lineInfo \f[B]C\-g\f[R] .RS Display information about the current line on the status line. .RE .TP toggleSource \f[B]\(rs\f[R] .RS If viewing an HTML buffer, open a new buffer with its source. Otherwise, open the current buffer\(cqs contents as HTML. .RE .TP saveScreen \f[B]s s\f[R] .RS Save the rendered buffer to a file. .RE .TP saveSource \f[B]s S\f[R] .RS Save the buffer\(cqs source to a file. .RE .TP editScreen \f[B]s e\f[R] .RS Open the rendered buffer in an editor. .RE .TP editSource \f[B]s E\f[R] .RS Open the buffer\(cqs source in an editor. .RE .TP discardBuffer \f[B]D\f[R] .RS Discard the current buffer, and move back to the previous/next buffer depending on what the previously viewed buffer was. .RE .TP discardBufferPrev, discardBufferNext \f[B]d ,\f[R], \f[B]d .\f[R] .RS Discard the current buffer, and move back to the previous/next buffer, or open the link under the cursor. .RE .TP discardTree \f[B]M\-d\f[R] .RS Discard all child buffers of the current buffer. .RE .TP nextBuffer, prevBuffer \f[B].\f[R], \f[B],\f[R] .RS Switch to the next or previous buffer respectively. .RE .TP enterCommand \f[B]M\-c\f[R] .RS Directly enter a JavaScript command. Note that this interacts with the pager, not the website being displayed. .RE .TP searchForward, searchBackward Search for a string in the current buffer, forwards or backwards. .TP isearchForward, searchBackward \f[B]/\f[R], \f[B]?\f[R] .RS Incremental\-search for a string, highlighting the first result, forwards or backwards. .RE .TP searchNext, searchPrev \f[B]n\f[R], \f[B]N\f[R] .RS Jump to the nth (or if unspecified, first) next/previous search result. .RE .TP peek Display a message of the current buffer\(cqs URL on the status line. .TP peekCursor \f[B]u\f[R] .RS 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) .RE .TP showFullAlert \f[B]s u\f[R] .RS Show the last alert inside the line editor. You can also view previous ones using C\-p or C\-n. .RE .TP copyURL \f[B]M\-y\f[R] .RS Copy the current buffer\(cqs URL to the system clipboard. .RE .TP copyCursorLink \f[B]y u\f[R] .RS Copy the link under the cursor to the system clipboard. .RE .TP copyCursorImage \f[B]y I\f[R] .RS Copy the URL of the image under the cursor to the system clipboard. .RE .TP gotoClipboardURL \f[B]M\-p\f[R] .RS Go to the URL currently on the clipboard. .RE .TP openBookmarks \f[B]M\-b\f[R] .RS Open the bookmark file. .RE .TP addBookmark \f[B]M\-a\f[R] .RS Add the current page to your bookmarks. .RE .TP toggleLinkHints \f[B]f\f[R] .RS 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 \f[CR]input.link\-hint\-chars\f[R]. .RE .TP toggleLinkHintsAutoClick Same as \f[CR]toggleLinkHints\f[R], but also click the selected link. .SS Buffer actions \f[CR]n\f[R] refers to a number preceding the action. e.g.\ in \f[CR]10gg\f[R], \f[CR]n\f[R] is 10. If no preceding number is input, then it is left unspecified. .PP Default keybindings are highlighted in \f[B]bold\f[R]. .TP cursorUp, cursorDown \f[B]j\f[R]/\f[B]C\-p\f[R]/\f[B]Up\f[R], \f[B]k\f[R]/\f[B]C\-n\f[R]/\f[B]Down\f[R] .RS Move the cursor upwards/downwards by \f[CR]n\f[R] lines, or if \f[CR]n\f[R] is unspecified, by 1. .RE .TP cursorLeft, cursorRight \f[B]h\f[R]/\f[B]Left\f[R], \f[B]l\f[R]/\f[B]Right\f[R] .RS Move the cursor to the left/right by \f[CR]n\f[R] cells, or if \f[CR]n\f[R] is unspecified, by 1. .RE .TP cursorLineBegin \f[B]0\f[R]/\f[B]Home\f[R] .RS Move the cursor to the first cell of the line. .RE .TP cursorLineTextStart \f[B]\(ha\f[R] .RS Move the cursor to the first non\-blank character of the line. .RE .TP cursorLineEnd \f[B]$\f[R]/\f[B]End\f[R] .RS Move the cursor to the last cell of the line. .RE .TP cursorNextWord, cursorNextViWord, cursorNextBigWord \f[B]w\f[R], \f[B]W\f[R] .RS Move the cursor to the beginning of the nth next word. .RE .TP cursorPrevWord, cursorPrevViWord, cursorPrevBigWord Move the cursor to the end of the nth previous word. .TP cursorWordEnd, cursorViWordEnd, cursorBigWordEnd \f[B]e\f[R], \f[B]E\f[R] .RS Move the cursor to the end of the current word, or if already there, to the end of the nth next word. .RE .TP cursorWordBegin, cursorViWordBegin, cursorBigWordBegin \f[B]b\f[R], \f[B]B\f[R] .RS Move the cursor to the beginning of the current word, or if already there, to the end of the nth previous word. .RE .TP cursorPrevLink, cursorNextLink \f[B][\f[R], \f[B]]\f[R] .RS Move the cursor to the end/beginning of the previous/next clickable element (e.g.\ link, input field, etc). .RE .TP cursorPrevParagraph, cursorNextParagraph \f[B]{\f[R], \f[B]}\f[R] .RS Move the cursor to the end/beginning of the nth previous/next paragraph. .RE .TP cursorRevNthLink Move the cursor to the nth link of the document, counting backwards from the document\(cqs last line. .TP cursorNthLink Move the cursor to the nth link of the document. .TP pageUp, pageDown, pageLeft, pageRight \f[B]C\-b\f[R]/\f[B]PageUp\f[R], \f[B]C\-f\f[R]/\f[B]PageDown\f[R], \f[B]z H\f[R], \f[B]z L\f[R] .RS Scroll up/down/left/right by \f[CR]n\f[R] pages, or if \f[CR]n\f[R] is unspecified, by one page. .RE .TP halfPageUp, halfPageDown, halfPageLeft, halfPageUp \f[B]C\-u\f[R], \f[B]C\-d\f[R] .RS Scroll up/down/left/right by \f[CR]n\f[R] half pages, or if \f[CR]n\f[R] is unspecified, by one page. .RE .TP scrollUp, scrollDown, scrollLeft, scrollRight \f[B]K\f[R]/\f[B]C\-y\f[R], \f[B]J\f[R]/\f[B]C\-e\f[R], \f[B]z h\f[R], \f[B]z l\f[R] .RS Scroll up/down/left/right by \f[CR]n\f[R] lines, or if \f[CR]n\f[R] is unspecified, by one line. .RE .TP click \f[B]RET\f[R]/\f[B]LF\f[R] .RS Click the HTML element currently under the cursor. \f[CR]n\f[R] specifies the number of clicks in JS events. .RE .TP rightClick \f[B]c\f[R] .RS Send a right click to the buffer. If it doesn\(cqt catch the event (i.e.\ no JS context menu is shown), toggle the menu instead. .RE .TP toggleMenu \f[B]C\f[R] .RS Toggle the menu. .RE .TP viewImage \f[B]I\f[R] .RS View the image currently under the cursor in an external viewer. .RE .TP reshape \f[B]R\f[R] .RS Reshape the current buffer (=render the current page anew). Useful if the layout is not updating even though it should have. .RE .TP redraw \f[B]r\f[R] .RS Redraw screen contents. Useful if something messed up the display. .RE .TP cursorFirstLine, cursorLastLine Move to the beginning/end in the buffer. .TP cursorTop, cursorMiddle, cursorBottom \f[B]H\f[R], \f[B]M\f[R], \f[B]L\f[R] .RS Move to the first line/line in the middle of/last line on the screen. (Equivalent to \f[CR]H\f[R], \f[CR]M\f[R], \f[CR]L\f[R] in vi.) .RE .TP raisePage, raisePageBegin, centerLine, centerLineBegin, lowerPage, lowerPageBegin \f[B]z t\f[R], \f[B]z RET\f[R], \f[B]z z\f[R], \f[B]z .\f[R], \f[B]z b\f[R], \f[B]z \-\f[R] .RS If \f[CR]n\f[R] is specified, move cursor to line \f[CR]n\f[R]. Then, .IP \(bu 2 \f[CR]raisePage\f[R] scrolls down so that the cursor is on the top line of the screen. (vi \f[CR]z RET\f[R], vim \f[CR]z t\f[R].) .IP \(bu 2 \f[CR]centerLine\f[R] shifts the screen so that the cursor is in the middle of the screen. (vi \f[CR]z .\f[R], vim \f[CR]z z\f[R].) .IP \(bu 2 \f[CR]lowerPage\f[R] scrolls up so that the cursor is on the bottom line of the screen. (vi \f[CR]z \-\f[R], vim \f[CR]z b\f[R].) The \-Begin variants also move the cursor to the line\(cqs first non\-blank character, as the original keybindings in vi do. .RE .TP nextPageBegin \f[B]z +\f[R] .RS If \f[CR]n\f[R] is specified, move to the screen before the nth line and raise the page. Otherwise, go to the next screen\(cqs first line and raise the page. .RE .TP previousPageBegin \f[B]z \(ha\f[R] .RS If \f[CR]n\f[R] is specified, move to the screen before the nth line and lower the page. Otherwise, go to the previous screen\(cqs last line and lower the page. .RE .TP cursorLeftEdge, cursorMiddleColumn, cursorRightEdge \f[B]g 0\f[R], \f[B]g c\f[R], \f[B]g $\f[R] .RS Move to the first/middle/last column on the screen. .RE .TP centerColumn Center screen around the current column. (w3m \f[CR]Z\f[R].) .TP gotoLineOrStart, gotoLineOrEnd \f[B]g g\f[R], \f[B]G\f[R] .RS If \f[CR]n\f[R] is specified, jump to line \f[CR]n\f[R]. Otherwise, jump to the first/last line of the buffer. .RE .TP gotoColumnOrBegin, gotoColumnOrEnd \f[B]|\f[R] .RS If \f[CR]n\f[R] is specified, jump to column \f[CR]n\f[R] of the current line. Otherwise, jump to the first/last column. .RE .TP mark \f[B]m\f[R] .RS Wait for a character \f[CR]x\f[R] and then set a mark with the ID \f[CR]x\f[R]. .RE .TP gotoMark, gotoMarkY \f[B]\(ga\f[R], \f[B]\(cq\f[R] .RS Wait for a character \f[CR]x\f[R] and then jump to the mark with the ID \f[CR]x\f[R] (if it exists on the page). \f[CR]gotoMark\f[R] sets both the X and Y positions; gotoMarkY only sets the Y position. .RE .TP markURL \f[B]:\f[R] .RS Convert URL\-like strings to anchors on the current page. .RE .TP saveLink \f[B]s RET\f[R] .RS Save resource from the URL pointed to by the cursor to the disk. .RE .TP saveSource \f[B]s S\f[R] .RS Save the source of the current buffer to the disk. .RE .TP saveImage \f[B]s I\f[R] .RS Save the image currently under the cursor. .RE .TP toggleImages \f[B]M\-i\f[R] .RS Toggle display of images in the current buffer. .RE .TP toggleScripting \f[B]M\-j\f[R] .RS Reload the current buffer with scripting enabled/disabled. .RE .TP toggleCookie \f[B]M\-k\f[R] .RS Reload the current buffer with cookies enabled/disabled. .RE .TP cursorSearchWordForward \f[B]C\-a\f[R], \f[B]*\f[R] .RS Search for the word currently under the cursor. .RE .TP cursorSearchWordBackward \f[B]#\f[R] .RS Search for the word currently under the cursor, backwards. .RE .SS Line\-editing actions .TP line.submit \f[B]RET\f[R], \f[B]LF\f[R] .RS Submit the currently entered text. .RE .TP line.cancel \f[B]C\-g\f[R] .RS Close the editor and cancel the operation it was opened for. .RE .TP line.copyOrCancel \f[B]C\-c\f[R] .RS If there is an active selection, copy it. Otherwise, it\(cqs the same as \f[CR]line.cancel\f[R]. .RE .TP line.backspace, line.delete \f[B]C\-h\f[R], \f[B]C\-d\f[R] .RS Delete character before (backspace)/after (delete) the cursor. .RE .TP line.clear, line.kill \f[B]C\-u\f[R]/\f[B]C\-x C\-?\f[R], \f[B]C\-k\f[R] .RS Delete text before (clear)/after (kill) the cursor. .RE .TP line.openEditor \f[B]C\-x C\-e\f[R] .RS Open the line editor\(cqs contents in $EDITOR. .RE .TP line.clearWord, line.killWord \f[B]C\-w\f[R], \f[B]M\-d\f[R] .RS Delete word before (clear)/after (kill) the cursor. .RE .TP line.backward, line.forward \f[B]C\-b\f[R], \f[B]C\-f\f[R] .RS Move cursor backward/forward by one character. .RE .TP line.prevWord, line.nextWord \f[B]M\-b\f[R], \f[B]M\-f\f[R] .RS Move cursor to the previous/next word by one character .RE .TP line.begin, line.end \f[B]C\-a\f[R]/\f[B]Home\f[R], \f[B]C\-e\f[R]/\f[B]End\f[R] .RS Move cursor to the beginning/end of the line. .RE .TP line.escape \f[B]C\-v\f[R] .RS Ignore keybindings for next character. .RE .TP line.prevHist, line.nextHist \f[B]C\-p\f[R], \f[B]C\-n\f[R] .RS Jump to the previous/next history entry .RE .PP 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.\ \f[CR]https://\f[R] consists of four words: \f[CR]https\f[R], \f[CR]:\f[R], \f[CR]/\f[R] and \f[CR]/\f[R].) .IP .EX # Control+A moves the cursor to the beginning of the line. \(aqC\-a\(aq = \(aqline.begin\(aq # Escape+D deletes everything after the cursor until it reaches a word\-breaking # character. \(aqM\-d\(aq = \(aqline.killWord\(aq .EE .SS Appendix .SS Regex handling Regular expressions are currently handled using the libregexp library from QuickJS. This means that all regular expressions work as in JavaScript. .PP There are two different modes of regex preprocessing in Chawan: \(lqsearch\(rq mode and \(lqmatch\(rq mode. Match mode is used for configurations (meaning in all values in this document described as \(lqregex\(rq). Search mode is used for the on\-page search function (using searchForward/isearchForward etc.) .SS Match mode Regular expressions are assumed to be exact matches, except when they start with a caret (\(ha) sign or end with an unescaped dollar ($) sign. .PP In other words, the following transformations occur: .IP .EX \(haabcd \-> \(haabcd (no change, only beginning is matched) efgh$ \-> efgh$ (no change, only end is matched) \(haijkl$ \-> \(haijkl$ (no change, the entire line is matched) mnop \-> \(hamnop$ (changed to exact match, the entire line is matched) .EE .PP Match mode has no way to toggle JavaScript regex flags like \f[CR]i\f[R]. .SS Search mode For on\-page search, the above transformations do not apply; the search \f[CR]/abcd\f[R] searches for the string \f[CR]abcd\f[R] inside all lines. .PP Search mode also has some other convenience transformations (these do not work in match mode): .IP \(bu 2 The string \f[CR]\(rsc\f[R] (backslash + lower\-case c) inside a search\-mode regex enables case\-insensitive matching. .IP \(bu 2 Conversely, \f[CR]\(rsC\f[R] (backslash + capital C) disables case\-insensitive matching. (Useful if you have \f[CR]ignore\-case\f[R] set to true, which is the default.) .IP \(bu 2 \f[CR]\(rs<\f[R] and \f[CR]\(rs>\f[R] is converted to \f[CR]\(rsb\f[R] (as in vi, grep, etc.) .PP Like match mode, search mode operates on individual lines. This means that search patterns do not match text wrapped over multiple lines. .SS Path handling Rules for path handling are similar to how the shell handles strings. .IP \(bu 2 Tilde\-expansion is used to determine the user\(cqs home directory. So e.g.\ \f[CR]\(ti/whatever\f[R] works. .IP \(bu 2 Environment variables can be used like \f[CR]$ENV_VAR\f[R]. .IP \(bu 2 Relative paths are relative to the Chawan configuration directory (i.e.\ \f[CR]$CHA_DIR\f[R]). .PP Some environment variables are also exported by Chawan: .IP \(bu 2 \f[CR]$CHA_BIN_DIR\f[R]: the directory which the \f[CR]cha\f[R] binary resides in. Symbolic links are automatically resolved to determine this path. .IP \(bu 2 \f[CR]$CHA_LIBEXEC_DIR\f[R]: the directory for all executables Chawan uses for operation. By default, this is \f[CR]$CHA_BIN_DIR/../libexec/chawan\f[R]. .IP \(bu 2 \f[CR]$CHA_DIR\f[R]: the configuration directory. (This can also be set by the user; see the top section for details.) .IP \(bu 2 \f[CR]$CHA_DATA_DIR\f[R]: if the configuration file uses XDG base directories, this is \f[CR]${XDG_DATA_HOME:\-$HOME/.local/share}/chawan\f[R]. Otherwise, it is the same as \f[CR]$CHA_DIR\f[R]. .RS 2 .IP \(bu 2 Exception: if \f[CR]$CHA_DIR\f[R] is set before \f[CR]cha\f[R] is invoked, then \f[CR]$CHA_DATA_DIR\f[R] is also read. This is to make nested invocations work in configurations with XDG basedirs. .RE .SS Word types Word\-based pager commands can operate with different definitions of words. Currently, these are: .IP \(bu 2 w3m words .IP \(bu 2 vi words .IP \(bu 2 Big words .SS w3m word A w3m word is a sequence of alphanumeric characters. Symbols are treated in the same way as whitespace. .SS 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. .PP 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: .IP .EX hello[]+{}\(at\(ga! .EE .SS Big word A big word is a sequence of non\-whitespace characters. .PP It is essentially the same as a w3m word, but with symbols being defined as non\-whitespace. .SS See also \f[B]cha\f[R](1) \f[B]cha\-api\f[R](7)