diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-09 20:45:59 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-09 20:46:52 +0100 |
commit | 4ee1a937fad792654277a1eedd35bd0c4f8389c6 (patch) | |
tree | 902128394320b4c666d5bac73df64aa89092f5d6 /bonus | |
parent | 4aa3e24199f0aac97d5541adcbf1ae137f7b64f0 (diff) | |
download | chawan-4ee1a937fad792654277a1eedd35bd0c4f8389c6.tar.gz |
pager: add marks
Default is vi-style, but w3m-style marks work as well; see bonus/w3m.toml.
Diffstat (limited to 'bonus')
-rw-r--r-- | bonus/w3m.toml | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/bonus/w3m.toml b/bonus/w3m.toml index 29ef9e5a..63b07ecc 100644 --- a/bonus/w3m.toml +++ b/bonus/w3m.toml @@ -59,7 +59,35 @@ C-l = 'pager.redraw()' R = 'pager.reload()' #TODO save, save source, view in editor #TODO buffer selection mode -#TODO mark +'C-@' = ''' +() => { + /* id is always the current position; this way we can clear by + setting a mark twice at the same position. */ + const id = pager.buffer.cursorx + " " + pager.buffer.cursory; + if (!pager.getMarkPos(id)) + pager.setMark(id); + else + pager.clearMark(id); +} +''' +M-p = ''' +() => { + const next = pager.findPrevMark(); + if (next) + pager.gotoMark(next); + else + pager.alert("No mark exists before here"); +} +''' +M-n = ''' +() => { + const next = pager.findNextMark(); + if (next) + pager.gotoMark(next); + else + pager.alert("No mark exists after here"); +} +''' # Search '/' = 'pager.searchForward()' C-s = 'pager.searchForward()' |