diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-19 15:02:40 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-19 15:02:46 +0100 |
commit | 8292d21bc9c786e5e4cb2ef5531b29d0858a8b7e (patch) | |
tree | db9b30d102e41ddfbc4059403421019c4003bca2 /doc/config.md | |
parent | a6bbcd0dd3f77b0e98527c1fa9e510a40acd954e (diff) | |
download | chawan-8292d21bc9c786e5e4cb2ef5531b29d0858a8b7e.tar.gz |
Update docs
Diffstat (limited to 'doc/config.md')
-rw-r--r-- | doc/config.md | 159 |
1 files changed, 89 insertions, 70 deletions
diff --git a/doc/config.md b/doc/config.md index b076de5a..bfb1ee7c 100644 --- a/doc/config.md +++ b/doc/config.md @@ -1,10 +1,11 @@ # Configuration -Currently keybindings and a user stylesheet can be configured. The -configuration format for chawan is toml. +Chawan supports custom keybindings and user stylesheets, defined in a toml +configuration file. Chawan will look for a config file in the ~/.config/chawan/ directory called -`config.toml`. For an example see the default configuration in the res/ folder. +`config.toml`. See the default configuration in the res/ folder for the default +configuration. A list of configurable options follows. @@ -16,7 +17,10 @@ Following is a list of general options: <table> <tr><th>**Name**<th>**Value**<th>**Function** -<tr><td>double-width-ambiguous<td>boolean<td>Assume the terminal displays characters in the East Asian Ambiguous category as double-width characters +<tr><td>double-width-ambiguous<td>boolean +<td>Assume the terminal displays characters in the East Asian Ambiguous +category as double-width characters. If you don't know what this means, you +probably won't need to enable it. </table> ## Display @@ -27,7 +31,9 @@ Following is a list of display options: <table> <tr><th>**Name**<th>**Value**<th>**Function** -<tr><td>mark-color<td>color<td>Set the marker's color. Valid options are "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "terminal". +<tr><td>mark-color<td>color<td>Set the marker's color. Valid options are +"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", +"terminal". </table> ## Stylesheets @@ -63,80 +69,93 @@ escape to the keybinding respectively (essentially making `M-` the same as (Note: it is highly recommended to use single quotes here; escaping can get quite ugly with double quotes.) -```Example: -'C-M-j' = 'CHANGE_LOCATION' # change URL when Control, Escape and j are pressed -'gg' = 'CURSOR_FIRST_LINE' # go to the first line of the page when g is pressed twice +```Examples: +'C-M-j' = 'pager.changeLocation()' # change URL when Control, Escape and j are pressed +'gg' = 'pager.cursorFirstLine()' # go to the first line of the page when g is pressed twice ``` +An action is a JavaScript function called by chawan every time the keybinding +is typed in. A list of built-in pager functions can be found below. -`<action>` is a valid normal or line-edit mode action. A detailed -description of these follows. - -### Normal mode actions +### Pager actions <table> <tr><th>**Name**<th>**Function** -<tr><td>`NULL`<td>Do nothing (used for disabling default keybindings) -<tr><td>`QUIT`<td>Exit the browser -<tr><td>`CURSOR_UP`<td>Move the cursor to the previous line -<tr><td>`CURSOR_DOWN`<td>Move cursor to the next line -<tr><td>`CURSOR_LEFT`<td>Move cursor to the previous cell -<tr><td>`CURSOR_RIGHT`<td>Move cursor to the next cell -<tr><td>`CURSOR_LEFT`<td>Move cursor to the previous cell -<tr><td>`CURSOR_LINEBEGIN`<td>Move cursor to the first cell of the line -<tr><td>`CURSOR_LINEEND`<td>Move cursor to the last cell of the line -<tr><td>`CURSOR_NEXT_WORD`<td>Move cursor to the beginning of the next word -<tr><td>`CURSOR_PREV_WORD`<td>Move cursor to the end of the previous word -<tr><td>`CURSOR_NEXT_LINK`<td>Move cursor to the beginning of the next clickable element -<tr><td>`CURSOR_PREV_LINK`<td>Move cursor to the beginning of the previous clickable element -<tr><td>`PAGE_DOWN`<td>Move screen down by one page -<tr><td>`PAGE_UP`<td>Move screen up by one page -<tr><td>`PAGE_LEFT`<td>Move screen to the left by one page -<tr><td>`PAGE_RIGHT`<td>Move screen to the right by one page -<tr><td>`HALF_PAGE_DOWN`<td>Move screen down by half a page -<tr><td>`HALF_PAGE_UP`<td>Move screen up by half a page -<tr><td>`SCROLL_DOWN`<td>Move screen down by one line -<tr><td>`SCROLL_UP`<td>Move screen up by one line -<tr><td>`SCROLL_LEFT`<td>Move screen to the left by one line -<tr><td>`SCROLL_RIGHT`<td>Move screen to the right by one line -<tr><td>`CLICK`<td>Click element currently under cursor -<tr><td>`CHANGE_LOCATION`<td>Go to URL -<tr><td>`DUPE_BUFFER`<td>Duplicate the current buffer -<tr><td>`RELOAD`<td>Reload page -<tr><td>`RESHAPE`<td>Reshape buffer (=render page anew) -<tr><td>`REDRAW`<td>Redraw buffer (=redraw screen) -<tr><td>`TOGGLE_SOURCE`<td>Source view -<tr><td>`CURSOR_FIRST_LINE`<td>Move cursor to the first line of the buffer -<tr><td>`CURSOR_LAST_LINE`<td>Move cursor to the last line of the buffer -<tr><td>`CURSOR_TOP`<td>Move cursor to the first line of the page -<tr><td>`CURSOR_MIDDLE`<td>Move cursor to the middle of the page -<tr><td>`CURSOR_BOTTOM`<td>Move cursor to the last line of the page -<tr><td>`CENTER_LINE`<td>Center screen around line -<tr><td>`LINE_INFO`<td>Display information about line -<tr><td>`SEARCH`<td>Search for a string in the current buffer -<tr><td>`SEARCH_BACK`<td>Search for a string, backwards -<tr><td>`ISEARCH`<td>Search for a string and highlight the first result -<tr><td>`ISEARCH_BACK`<td>Search and highlight the first result, backwards -<tr><td>`SEARCH_NEXT`<td>Jump to the next search result -<tr><td>`SEARCH_PREV`<td>Jump to the previous search result +<tr><td>`pager.quit()`<td>Exit the browser +<tr><td>`pager.cursorUp()`<td>Move the cursor to the previous line +<tr><td>`pager.cursorDown()`<td>Move cursor to the next line +<tr><td>`pager.cursorLeft()`<td>Move cursor to the previous cell +<tr><td>`pager.cursorRight()`<td>Move cursor to the next cell +<tr><td>`pager.cursorLineBegin()`<td>Move cursor to the first cell of the line +<tr><td>`pager.cursorLineEnd()`<td>Move cursor to the last cell of the line +<tr><td>`pager.cursorNextWord()`<td>Move cursor to the beginning of the next word +<tr><td>`pager.cursorPrevWord()`<td>Move cursor to the end of the previous word +<tr><td>`pager.cursorNextLink()`<td>Move cursor to the beginning of the next clickable element +<tr><td>`pager.cursorPrevLink()`<td>Move cursor to the beginning of the previous clickable element +<tr><td>`pager.pageDown()`<td>Move screen down by one page +<tr><td>`pager.pageUp()`<td>Move screen up by one page +<tr><td>`pager.pageLeft()`<td>Move screen to the left by one page +<tr><td>`pager.pageRight()`<td>Move screen to the right by one page +<tr><td>`pager.halfPageDown()`<td>Move screen down by half a page +<tr><td>`pager.halfPageUp()`<td>Move screen up by half a page +<tr><td>`pager.scrollDown()`<td>Move screen down by one line +<tr><td>`pager.scrollUp()`<td>Move screen up by one line +<tr><td>`pager.scrollLeft()`<td>Move screen to the left by one line +<tr><td>`pager.scrollRight()`<td>Move screen to the right by one line +<tr><td>`pager.click()`<td>Click element currently under cursor +<tr><td>`pager.changeLocation()`<td>Go to URL +<tr><td>`pager.dupeBuffer()`<td>Duplicate the current buffer +<tr><td>`pager.reload()`<td>Reload page +<tr><td>`pager.reshape()`<td>Reshape buffer (=render page anew) +<tr><td>`pager.redraw()`<td>Redraw buffer (=redraw screen) +<tr><td>`pager.toggleSource()`<td>Source view +<tr><td>`pager.cursorFirstLine()`<td>Move cursor to the first line of the buffer +<tr><td>`pager.cursorLastLine()`<td>Move cursor to the last line of the buffer +<tr><td>`pager.cursorTop()`<td>Move cursor to the first line of the page +<tr><td>`pager.cursorMiddle()`<td>Move cursor to the middle of the page +<tr><td>`pager.cursorBottom()`<td>Move cursor to the last line of the page +<tr><td>`pager.centerLine()`<td>Center screen around line +<tr><td>`pager.lineInfo()`<td>Display information about line +<tr><td>`pager.searchForward()`<td>Search for a string in the current buffer +<tr><td>`pager.searchBackward()`<td>Search for a string, backwards +<tr><td>`pager.isearchForward()`<td>Search for a string and highlight the first result +<tr><td>`pager.isearchBackward()`<td>Search and highlight the first result, backwards +<tr><td>`pager.searchPrev()`<td>Jump to the next search result +<tr><td>`pager.searchNext()`<td>Jump to the previous search result </table> ### Line-editing actions <table> <tr><th>**Name**<th>**Function** -<tr><td>`NULL`<td>Do nothing -<tr><td>`SUBMIT`<td>Submit line -<tr><td>`CANCEL`<td>Cancel operation -<tr><td>`BACKSPACE`<td>Delete character before cursor -<tr><td>`DELETE`<td>Delete character after cursor -<tr><td>`CLEAR`<td>Clear text before cursor -<tr><td>`KILL`<td>Clear text after cursor -<tr><td>`KILL_WORD`<td>Delete previous word -<tr><td>`BACK`<td>Move cursor back by one character -<tr><td>`FORWARD`<td>Move cursor forward by one character -<tr><td>`PREV_WORD`<td>Move cursor to the previous word by one character -<tr><td>`NEXT_WORD`<td>Move cursor to the previous word by one character -<tr><td>`BEGIN`<td>Move cursor to the previous word by one character -<tr><td>`END`<td>Move cursor to the previous word by one character -<tr><td>`ESC`<td>Ignore keybindings for next character +<tr><td>`line.submit()`<td>Submit line +<tr><td>`line.cancel()`<td>Cancel operation +<tr><td>`line.backspace()`<td>Delete character before cursor +<tr><td>`line.delete()`<td>Delete character after cursor +<tr><td>`line.clear()`<td>Clear text before cursor +<tr><td>`line.kill()`<td>Clear text after cursor +<tr><td>`line.clearWord(bounds)`<td>Delete word before cursor[^a] +<tr><td>`line.killWord(bounds)`<td>Delete word after cursor[^a] +<tr><td>`line.backward()`<td>Move cursor back by one character +<tr><td>`line.forward()`<td>Move cursor forward by one character +<tr><td>`line.prevWord(bounds)`<td>Move cursor to the previous word by one character[^a] +<tr><td>`line.nextWord(bounds)`<td>Move cursor to the previous word by one character[^a] +<tr><td>`line.begin()`<td>Move cursor to the previous word by one character +<tr><td>`line.end()`<td>Move cursor to the previous word by one character +<tr><td>`line.escape()`<td>Ignore keybindings for next character </table> + +Some entries have an optional `bounds` parameter. If passed, this must be a +JavaScript function with one parameter (the current unicode character), and +must return true if the passed character should count as a word boundary. + +```Examples: +# 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()' + +# Control+W deletes everything before the cursor until it reaches a space. +'C-w' = 'line.clearWord(x => x == " ")' +``` |