about summary refs log tree commit diff stats
path: root/bonus/w3m.toml
blob: a8ab54e059e52cb3e4f116c19f0af56059901be9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# 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.discardBuffer'
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.