# w3m-like keybindings for Chawan. # Copy-paste this into your config file, or just include it (place it in # ~/.config/chawan/w3m.toml, then at the beginning of # ~/.config/chawan/chawan.toml, include = "w3m.toml".) [cmd.w3m.buffer] pageDown = 'n => pager.scrollDown(pager.height * (n ?? 1))' pageUp = 'n => pager.scrollUp(pager.height * (n ?? 1))' mark = ''' () => { /* 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); } ''' gotoLine = 'n => pager.gotoLine(n)' centerColumn = '() => pager.centerColumn()' centerLine = '() => pager.centerLine()' prevMark = ''' () => { const next = pager.findPrevMark(); if (next) pager.gotoMark(next); else pager.alert("No mark exists before here"); } ''' nextMark = ''' () => { const next = pager.findNextMark(); if (next) pager.gotoMark(next); else pager.alert("No mark exists before here"); } ''' [cmd.w3m.pager] saveFile = ''' () => { if (pager.url.protocol == "file:") pager.extern(pager.getEditorCommand(pager.url.pathname)) else pager.alert("Can't edit other than local file"); } ''' askQuit = ''' () => pager.ask("Do you want to exit Chawan?").then(x => x ? quit() : void(0)) ''' [page] # Page/cursor movement ' ' = 'cmd.w3m.buffer.pageDown' C-v = 'cmd.w3m.buffer.pageDown' b = 'cmd.w3m.buffer.pageUp' M-v = 'cmd.w3m.buffer.pageUp' 'M-[6~' = 'cmd.w3m.buffer.pageDown' 'M-[5~' = 'cmd.w3m.buffer.pageUp' C-f = 'cmd.buffer.cursorRight' C-b = 'cmd.buffer.cursorLeft' C-n = 'cmd.buffer.cursorDown' C-p = 'cmd.buffer.cursorUp' J = 'cmd.buffer.scrollUp' K = 'cmd.buffer.scrollDown' '^' = 'cmd.buffer.cursorLineBegin' C-a = 'cmd.buffer.cursorLineBegin' '$' = 'cmd.buffer.cursorLineEnd' C-e = 'cmd.buffer.cursorLineEnd' w = 'cmd.buffer.cursorNextWord' W = 'cmd.buffer.cursorWordBegin' '<' = 'cmd.buffer.pageLeft' '>' = 'cmd.buffer.pageRight' '.' = 'cmd.buffer.scrollLeft' ',' = 'cmd.buffer.scrollRight' g = 'cmd.buffer.gotoLineOrStart' 'M-<' = 'cmd.buffer.cursorFirstLine' G = 'cmd.buffer.gotoLineOrEnd' 'M->' = 'cmd.buffer.cursorLastLine' M-g = 'cmd.w3m.buffer.gotoLine' Z = 'cmd.w3m.buffer.centerColumn' z = 'cmd.w3m.buffer.centerLine' C-i = 'cmd.buffer.cursorNextLink' C-u = 'cmd.buffer.cursorPrevLink' M-C-i = 'cmd.buffer.cursorPrevLink' '[' = 'cmd.buffer.cursorNthLink' ']' = 'cmd.buffer.cursorRevNthLink' # Hyperlink selection C-j = 'cmd.buffer.click' C-m = 'cmd.buffer.click' c = 'cmd.pager.peek' u = 'cmd.pager.peekCursor' a = 'cmd.pager.saveLink' M-C-j = 'cmd.buffer.saveLink' M-C-m = 'cmd.buffer.saveLink' I = 'cmd.buffer.viewImage' #TODO save image # File and URL-related actions U = 'cmd.pager.load' V = 'cmd.pager.load' #TODO file only #TODO exec shell # Buffer operations B = 'cmd.pager.discardBufferPrev' v = 'cmd.pager.toggleSource' #TODO edit C-l = 'cmd.buffer.redraw' R = 'cmd.pager.reload' E = 'cmd.pager.editFile' M-s = 'cmd.pager.saveSource' #TODO save screen, edit screen #TODO buffer selection mode 'C-@' = 'cmd.w3m.buffer.mark' M-p = 'cmd.w3m.buffer.prevMark' M-n = 'cmd.w3m.buffer.nextMark' # Search '/' = 'cmd.pager.searchForward' C-s = 'cmd.pager.searchForward' '?' = 'cmd.pager.searchBackward' C-r = 'cmd.pager.searchBackward' n = 'cmd.pager.searchNext' N = 'cmd.pager.searchPrev' C-w = 'cmd.pager.toggleWrap' # Misc #TODO shell out, help file, options, cookies C-c = 'cmd.pager.cancel' q = 'cmd.w3m.pager.askQuit' Q = 'cmd.pager.quit' C-d = '' # w3m line editing is equivalent to Chawan's defaults.