about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-14 20:41:08 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-14 20:41:57 +0100
commita8f05f18fdd64485c26b453e62e8073b50e271ef (patch)
tree855b2ba978707197c69338bd5ae6a937d05332a4 /res
parentb5c7a63a3dccf0ea7490d635ee5a8d56d3d49ce1 (diff)
downloadchawan-a8f05f18fdd64485c26b453e62e8073b50e271ef.tar.gz
pager: add "open in editor" keybinding (sE)
only for source for now, rendered document is a bit more complicated

(also, get rid of useless extern/editor module)
Diffstat (limited to 'res')
-rw-r--r--res/chawan.html1
-rw-r--r--res/config.toml8
2 files changed, 9 insertions, 0 deletions
diff --git a/res/chawan.html b/res/chawan.html
index 33f57ae4..402a46fe 100644
--- a/res/chawan.html
+++ b/res/chawan.html
@@ -85,6 +85,7 @@ beginning)
 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>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 5b130762..618a3847 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -122,6 +122,14 @@ C-b = 'n => pager.pageUp(n)'
 '>' = 'n => pager.pageRight(n)'
 C-e = 'n => pager.scrollDown(n)'
 C-y = 'n => pager.scrollUp(n)'
+sE = '''
+() => {
+	const url = url.pathname;
+	pager.extern(pager.getEditorCommand(url.protocol == "file:" ?
+		url.pathname :
+		pager.cacheFile));
+}
+'''
 m = '''
 async () => {
 	const c = await pager.askChar("m");