about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-20 16:01:58 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-20 16:01:58 +0100
commite9c202f29224f6e83abeed161263298237618145 (patch)
tree1849d6118a28f77bd6f5be416f1fa37adfeea460 /res
parent4b7149a68e70737ea05514bda26cd64dc8d5909a (diff)
downloadchawan-e9c202f29224f6e83abeed161263298237618145.tar.gz
pager: add "save link", "save source"; change & document some keybindings
* `s{Enter}' now saves link, and `sS' saves source.
* Changed ;, +, @ to g0, g$, gc so that it's somewhat consistent with
  vim (and won't conflict with ; for "repeat jump to char")
* Changed (, ) to -, + so that it doesn't conflict with vi's
  "previous/next sentence" (once we have it...)
* Add previously missing keybindings to about:chawan
Diffstat (limited to 'res')
-rw-r--r--res/chawan.html11
-rw-r--r--res/config.toml16
2 files changed, 18 insertions, 9 deletions
diff --git a/res/chawan.html b/res/chawan.html
index 69c45986..169c6800 100644
--- a/res/chawan.html
+++ b/res/chawan.html
@@ -57,7 +57,7 @@ up/down by one row
 <li><kbd>y</kbd>: yank (copy) current selection to system clipboard (needs xsel)
 <li><kbd>U</kbd>: reload page
 <li><kbd>,</kbd> (comma), <kbd>.</kbd> (period): previous/next buffer
-<li><kbd>D</kbd>: discard current buffer
+<li><kbd>D</kbd>: discard (delete) current buffer
 <li><kbd>M-y</kbd>: copy current buffer's URL to clipboard (needs xsel)
 <li><kbd>yu</kbd>: copy the link currently under the cursor to clipboard (needs
 <li><kbd>yI</kbd>: copy the image link currently under the cursor to clipboard
@@ -67,9 +67,14 @@ up/down by one row
 <li><kbd>C-d</kbd>, <kbd>C-u</kbd>: scroll up/down by half a page
 <li><kbd>C-f</kbd>, <kbd>C-b</kbd> (or <kbd>PgDn</kbd>, <kbd>PgUp</kbd>)</kbd>:
 scroll up/down by an entire page
+<li><kbd>{number}G<kbd> (or <kbd>{number}gg</kbd>): jump to {number}'th line
+<li><kbd>g0<kbd>: jump to first character of the current line's visible part
+<li><kbd>gc<kbd>: jump to center of the current line's visible part
+<li><kbd>g$<kbd>: jump to last character of the current line's visible part
 <li><kbd>{</kbd>, <kbd>}</kbd>: move cursor to the previous/next paragraph
-<li><kbd>(</kbd>, <kbd>)</kbd> (or <kbd>zh</kbd>, <kbd>zl</kbd>): shift
+<li><kbd>-</kbd>, <kbd>+</kbd> (or <kbd>zh</kbd>, <kbd>zl</kbd>): shift
 screen to the left/right by one cell
+<li><kbd>
 <li><kbd>&lt;</kbd>, <kbd>&gt;</kbd>: shift screen to the left/right by one page
 <li><kbd>/</kbd>, <kbd>?</kbd>: on-page search (or search backwards)
 <li><kbd>n</kbd>, <kbd>N</kbd>: next/previous match
@@ -86,6 +91,8 @@ beginning)
 <li><kbd>w</kbd>, <kbd>b</kbd>: move cursor to next/previous word
 <li><kbd>\</kbd>: toggle page source view
 <li><kbd>sE</kbd>: see source in editor
+<li><kbd>sS</kbd>: save current page's source
+<li><kbd>s{return/enter key}</kbd>: save page that anchor (link) points to
 <li><kbd>0</kbd>: cursor to first cell on line
 <li><kbd>^</kbd>: cursor to first non-whitespace on line
 <li><kbd>$</kbd>: cursor to last character on line
diff --git a/res/config.toml b/res/config.toml
index 962d5e22..d7186c24 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -106,9 +106,9 @@ W = 'pager.cursorNextBigWord()'
 H = 'n => pager.cursorTop(n)'
 M = '() => pager.cursorMiddle()'
 L = 'n => pager.cursorBottom(n)'
-';' = 'pager.cursorLeftEdge()'
-'+' = 'pager.cursorMiddleColumn()'
-'@' = 'pager.cursorRightEdge()'
+g0 = 'pager.cursorLeftEdge()'
+gc = 'pager.cursorMiddleColumn()'
+'g$' = 'pager.cursorRightEdge()'
 C-d = 'n => pager.halfPageDown(n)'
 C-u = 'n => pager.halfPageUp(n)'
 C-f = 'n => pager.pageDown(n)'
@@ -129,6 +129,9 @@ sE = '''
 		pager.cacheFile));
 }
 '''
+sC-m = 'pager.saveLink()'
+sC-j = 'pager.saveLink()'
+sS = 'pager.saveSource()'
 m = '''
 async () => {
 	const c = await pager.askChar("m");
@@ -154,8 +157,8 @@ async () => {
 'zl' = 'n => pager.scrollRight(n)'
 J = 'n => pager.scrollDown(n)'
 K = 'n => pager.scrollUp(n)'
-'('= 'n => pager.scrollLeft(n)'
-')' = 'n => pager.scrollRight(n)'
+'-'= 'n => pager.scrollLeft(n)'
+'+' = 'n => pager.scrollRight(n)'
 C-m = 'pager.click()'
 C-j = 'pager.click()'
 I = 'pager.gotoURL(pager.hoverImage)'
@@ -218,8 +221,7 @@ pager.alert("Wrap search " + (config.search.wrap ? "on" : "off"));
 '''
 M-y = '''
 () => {
-	if (pager.extern('printf \'%s\' "$CHA_URL" | xsel -bi',
-			{suspend: false, setenv: true}))
+	if (pager.externInto('xsel -bi', pager.url))
 		pager.alert("Copied URL to clipboard.");
 	else
 		pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)");