Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: 

 

# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> 

# 

# This file is part of qutebrowser. 

# 

# qutebrowser is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 3 of the License, or 

# (at your option) any later version. 

# 

# qutebrowser is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

# GNU General Public License for more details. 

# 

# You should have received a copy of the GNU General Public License 

# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. 

 

"""Code to show a diff of the legacy config format.""" 

 

import difflib 

import os.path 

 

import pygments 

import pygments.lexers 

import pygments.formatters 

 

from qutebrowser.utils import standarddir 

 

 

OLD_CONF = """ 

[general] 

ignore-case = smart 

startpage = https://start.duckduckgo.com 

yank-ignored-url-parameters = ref,utm_source,utm_medium,utm_campaign,utm_term,utm_content 

default-open-dispatcher = 

default-page = ${startpage} 

auto-search = naive 

auto-save-config = true 

auto-save-interval = 15000 

editor = gvim -f "{}" 

editor-encoding = utf-8 

private-browsing = false 

developer-extras = false 

print-element-backgrounds = true 

xss-auditing = false 

default-encoding = iso-8859-1 

new-instance-open-target = tab 

new-instance-open-target.window = last-focused 

log-javascript-console = debug 

save-session = false 

session-default-name = 

url-incdec-segments = path,query 

[ui] 

history-session-interval = 30 

zoom-levels = 25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,250%,300%,400%,500% 

default-zoom = 100% 

downloads-position = top 

status-position = bottom 

message-timeout = 2000 

message-unfocused = false 

confirm-quit = never 

zoom-text-only = false 

frame-flattening = false 

user-stylesheet = 

hide-scrollbar = true 

smooth-scrolling = false 

remove-finished-downloads = -1 

hide-statusbar = false 

statusbar-padding = 1,1,0,0 

window-title-format = {perc}{title}{title_sep}qutebrowser 

modal-js-dialog = false 

hide-wayland-decoration = false 

keyhint-blacklist = 

keyhint-delay = 500 

prompt-radius = 8 

prompt-filebrowser = true 

[network] 

do-not-track = true 

accept-language = en-US,en 

referer-header = same-domain 

user-agent = 

proxy = system 

proxy-dns-requests = true 

ssl-strict = ask 

dns-prefetch = true 

custom-headers = 

netrc-file = 

[completion] 

show = always 

download-path-suggestion = path 

timestamp-format = %Y-%m-%d 

height = 50% 

cmd-history-max-items = 100 

web-history-max-items = -1 

quick-complete = true 

shrink = false 

scrollbar-width = 12 

scrollbar-padding = 2 

[input] 

timeout = 500 

partial-timeout = 5000 

insert-mode-on-plugins = false 

auto-leave-insert-mode = true 

auto-insert-mode = false 

forward-unbound-keys = auto 

spatial-navigation = false 

links-included-in-focus-chain = true 

rocker-gestures = false 

mouse-zoom-divider = 512 

[tabs] 

background-tabs = false 

select-on-remove = next 

new-tab-position = next 

new-tab-position-explicit = last 

last-close = ignore 

show = always 

show-switching-delay = 800 

wrap = true 

movable = true 

close-mouse-button = middle 

position = top 

show-favicons = true 

favicon-scale = 1.0 

width = 20% 

pinned-width = 43 

indicator-width = 3 

tabs-are-windows = false 

title-format = {index}: {title} 

title-format-pinned = {index} 

title-alignment = left 

mousewheel-tab-switching = true 

padding = 0,0,5,5 

indicator-padding = 2,2,0,4 

[storage] 

download-directory = 

prompt-download-directory = true 

remember-download-directory = true 

maximum-pages-in-cache = 0 

offline-web-application-cache = true 

local-storage = true 

cache-size = 

[content] 

allow-images = true 

allow-javascript = true 

allow-plugins = false 

webgl = true 

hyperlink-auditing = false 

geolocation = ask 

notifications = ask 

media-capture = ask 

javascript-can-open-windows-automatically = false 

javascript-can-close-windows = false 

javascript-can-access-clipboard = false 

ignore-javascript-prompt = false 

ignore-javascript-alert = false 

local-content-can-access-remote-urls = false 

local-content-can-access-file-urls = true 

cookies-accept = no-3rdparty 

cookies-store = true 

host-block-lists = https://www.malwaredomainlist.com/hostslist/hosts.txt,http://someonewhocares.org/hosts/hosts,http://winhelp2002.mvps.org/hosts.zip,http://malwaredomains.lehigh.edu/files/justdomains.zip,https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext 

host-blocking-enabled = true 

host-blocking-whitelist = piwik.org 

enable-pdfjs = false 

[hints] 

border = 1px solid #E3BE23 

mode = letter 

chars = asdfghjkl 

min-chars = 1 

scatter = true 

uppercase = false 

dictionary = /usr/share/dict/words 

auto-follow = unique-match 

auto-follow-timeout = 0 

next-regexes = \\bnext\\b,\\bmore\\b,\\bnewer\\b,\\b[>\u2192\u226b]\\b,\\b(>>|\xbb)\\b,\\bcontinue\\b 

prev-regexes = \\bprev(ious)?\\b,\\bback\\b,\\bolder\\b,\\b[<\u2190\u226a]\\b,\\b(<<|\xab)\\b 

find-implementation = python 

hide-unmatched-rapid-hints = true 

[searchengines] 

DEFAULT = https://duckduckgo.com/?q={} 

[aliases] 

[colors] 

completion.fg = white 

completion.bg = #333333 

completion.alternate-bg = #444444 

completion.category.fg = white 

completion.category.bg = qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, stop:1 #505050) 

completion.category.border.top = black 

completion.category.border.bottom = ${completion.category.border.top} 

completion.item.selected.fg = black 

completion.item.selected.bg = #e8c000 

completion.item.selected.border.top = #bbbb00 

completion.item.selected.border.bottom = ${completion.item.selected.border.top} 

completion.match.fg = #ff4444 

completion.scrollbar.fg = ${completion.fg} 

completion.scrollbar.bg = ${completion.bg} 

statusbar.fg = white 

statusbar.bg = black 

statusbar.fg.private = ${statusbar.fg} 

statusbar.bg.private = #666666 

statusbar.fg.insert = ${statusbar.fg} 

statusbar.bg.insert = darkgreen 

statusbar.fg.command = ${statusbar.fg} 

statusbar.bg.command = ${statusbar.bg} 

statusbar.fg.command.private = ${statusbar.fg.private} 

statusbar.bg.command.private = ${statusbar.bg.private} 

statusbar.fg.caret = ${statusbar.fg} 

statusbar.bg.caret = purple 

statusbar.fg.caret-selection = ${statusbar.fg} 

statusbar.bg.caret-selection = #a12dff 

statusbar.progress.bg = white 

statusbar.url.fg = ${statusbar.fg} 

statusbar.url.fg.success = white 

statusbar.url.fg.success.https = lime 

statusbar.url.fg.error = orange 

statusbar.url.fg.warn = yellow 

statusbar.url.fg.hover = aqua 

tabs.fg.odd = white 

tabs.bg.odd = grey 

tabs.fg.even = white 

tabs.bg.even = darkgrey 

tabs.fg.selected.odd = white 

tabs.bg.selected.odd = black 

tabs.fg.selected.even = ${tabs.fg.selected.odd} 

tabs.bg.selected.even = ${tabs.bg.selected.odd} 

tabs.bg.bar = #555555 

tabs.indicator.start = #0000aa 

tabs.indicator.stop = #00aa00 

tabs.indicator.error = #ff0000 

tabs.indicator.system = rgb 

hints.fg = black 

hints.bg = qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 247, 133, 0.8), stop:1 rgba(255, 197, 66, 0.8)) 

hints.fg.match = green 

downloads.bg.bar = black 

downloads.fg.start = white 

downloads.bg.start = #0000aa 

downloads.fg.stop = ${downloads.fg.start} 

downloads.bg.stop = #00aa00 

downloads.fg.system = rgb 

downloads.bg.system = rgb 

downloads.fg.error = white 

downloads.bg.error = red 

webpage.bg = white 

keyhint.fg = #FFFFFF 

keyhint.fg.suffix = #FFFF00 

keyhint.bg = rgba(0, 0, 0, 80%) 

messages.fg.error = white 

messages.bg.error = red 

messages.border.error = #bb0000 

messages.fg.warning = white 

messages.bg.warning = darkorange 

messages.border.warning = #d47300 

messages.fg.info = white 

messages.bg.info = black 

messages.border.info = #333333 

prompts.fg = white 

prompts.bg = darkblue 

prompts.selected.bg = #308cc6 

[fonts] 

_monospace = xos4 Terminus, Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal 

completion = 8pt ${_monospace} 

completion.category = bold ${completion} 

tabbar = 8pt ${_monospace} 

statusbar = 8pt ${_monospace} 

downloads = 8pt ${_monospace} 

hints = bold 13px ${_monospace} 

debug-console = 8pt ${_monospace} 

web-family-standard = 

web-family-fixed = 

web-family-serif = 

web-family-sans-serif = 

web-family-cursive = 

web-family-fantasy = 

web-size-minimum = 0 

web-size-minimum-logical = 6 

web-size-default = 16 

web-size-default-fixed = 13 

keyhint = 8pt ${_monospace} 

messages.error = 8pt ${_monospace} 

messages.warning = 8pt ${_monospace} 

messages.info = 8pt ${_monospace} 

prompts = 8pt sans-serif 

""" 

 

OLD_KEYS_CONF = """ 

[!normal] 

leave-mode 

<escape> 

<ctrl-[> 

[normal] 

clear-keychain ;; search ;; fullscreen --leave 

<escape> 

<ctrl-[> 

set-cmd-text -s :open 

o 

set-cmd-text :open {url:pretty} 

go 

set-cmd-text -s :open -t 

O 

set-cmd-text :open -t -i {url:pretty} 

gO 

set-cmd-text -s :open -b 

xo 

set-cmd-text :open -b -i {url:pretty} 

xO 

set-cmd-text -s :open -w 

wo 

set-cmd-text :open -w {url:pretty} 

wO 

set-cmd-text / 

/ 

set-cmd-text ? 

? 

set-cmd-text : 

: 

open -t 

ga 

<ctrl-t> 

open -w 

<ctrl-n> 

tab-close 

d 

<ctrl-w> 

tab-close -o 

D 

tab-only 

co 

tab-focus 

T 

tab-move 

gm 

tab-move - 

gl 

tab-move + 

gr 

tab-next 

J 

<ctrl-pgdown> 

tab-prev 

K 

<ctrl-pgup> 

tab-clone 

gC 

reload 

r 

<f5> 

reload -f 

R 

<ctrl-f5> 

back 

H 

<back> 

back -t 

th 

back -w 

wh 

forward 

L 

<forward> 

forward -t 

tl 

forward -w 

wl 

fullscreen 

<f11> 

hint 

f 

hint all tab 

F 

hint all window 

wf 

hint all tab-bg 

;b 

hint all tab-fg 

;f 

hint all hover 

;h 

hint images 

;i 

hint images tab 

;I 

hint links fill :open {hint-url} 

;o 

hint links fill :open -t -i {hint-url} 

;O 

hint links yank 

;y 

hint links yank-primary 

;Y 

hint --rapid links tab-bg 

;r 

hint --rapid links window 

;R 

hint links download 

;d 

hint inputs 

;t 

scroll left 

h 

scroll down 

j 

scroll up 

k 

scroll right 

l 

undo 

u 

<ctrl-shift-t> 

scroll-perc 0 

gg 

scroll-perc 

G 

search-next 

n 

search-prev 

N 

enter-mode insert 

i 

enter-mode caret 

v 

enter-mode set_mark 

` 

enter-mode jump_mark 

' 

yank 

yy 

yank -s 

yY 

yank title 

yt 

yank title -s 

yT 

yank domain 

yd 

yank domain -s 

yD 

yank pretty-url 

yp 

yank pretty-url -s 

yP 

open -- {clipboard} 

pp 

open -- {primary} 

pP 

open -t -- {clipboard} 

Pp 

open -t -- {primary} 

PP 

open -w -- {clipboard} 

wp 

open -w -- {primary} 

wP 

quickmark-save 

m 

set-cmd-text -s :quickmark-load 

b 

set-cmd-text -s :quickmark-load -t 

B 

set-cmd-text -s :quickmark-load -w 

wb 

bookmark-add 

M 

set-cmd-text -s :bookmark-load 

gb 

set-cmd-text -s :bookmark-load -t 

gB 

set-cmd-text -s :bookmark-load -w 

wB 

save 

sf 

set-cmd-text -s :set 

ss 

set-cmd-text -s :set -t 

sl 

set-cmd-text -s :bind 

sk 

zoom-out 

- 

zoom-in 

+ 

zoom 

= 

navigate prev 

[[ 

navigate next 

]] 

navigate prev -t 

{{ 

navigate next -t 

}} 

navigate up 

gu 

navigate up -t 

gU 

navigate increment 

<ctrl-a> 

navigate decrement 

<ctrl-x> 

inspector 

wi 

download 

gd 

download-cancel 

ad 

download-clear 

cd 

view-source 

gf 

set-cmd-text -s :buffer 

gt 

tab-focus last 

<ctrl-tab> 

<ctrl-6> 

<ctrl-^> 

enter-mode passthrough 

<ctrl-v> 

quit 

<ctrl-q> 

ZQ 

wq 

ZZ 

scroll-page 0 1 

<ctrl-f> 

scroll-page 0 -1 

<ctrl-b> 

scroll-page 0 0.5 

<ctrl-d> 

scroll-page 0 -0.5 

<ctrl-u> 

tab-focus 1 

<alt-1> 

g0 

g^ 

tab-focus 2 

<alt-2> 

tab-focus 3 

<alt-3> 

tab-focus 4 

<alt-4> 

tab-focus 5 

<alt-5> 

tab-focus 6 

<alt-6> 

tab-focus 7 

<alt-7> 

tab-focus 8 

<alt-8> 

tab-focus -1 

<alt-9> 

g$ 

home 

<ctrl-h> 

stop 

<ctrl-s> 

print 

<ctrl-alt-p> 

open qute://settings 

Ss 

follow-selected 

<return> 

<ctrl-m> 

<ctrl-j> 

<shift-return> 

<enter> 

<shift-enter> 

follow-selected -t 

<ctrl-return> 

<ctrl-enter> 

repeat-command 

. 

tab-pin 

<ctrl-p> 

record-macro 

q 

run-macro 

@ 

[insert] 

open-editor 

<ctrl-e> 

insert-text {primary} 

<shift-ins> 

[hint] 

follow-hint 

<return> 

<ctrl-m> 

<ctrl-j> 

<shift-return> 

<enter> 

<shift-enter> 

hint --rapid links tab-bg 

<ctrl-r> 

hint links 

<ctrl-f> 

hint all tab-bg 

<ctrl-b> 

[passthrough] 

[command] 

command-history-prev 

<ctrl-p> 

command-history-next 

<ctrl-n> 

completion-item-focus prev 

<shift-tab> 

<up> 

completion-item-focus next 

<tab> 

<down> 

completion-item-focus next-category 

<ctrl-tab> 

completion-item-focus prev-category 

<ctrl-shift-tab> 

completion-item-del 

<ctrl-d> 

command-accept 

<return> 

<ctrl-m> 

<ctrl-j> 

<shift-return> 

<enter> 

<shift-enter> 

[prompt] 

prompt-accept 

<return> 

<ctrl-m> 

<ctrl-j> 

<shift-return> 

<enter> 

<shift-enter> 

prompt-accept yes 

y 

prompt-accept no 

n 

prompt-open-download 

<ctrl-x> 

prompt-item-focus prev 

<shift-tab> 

<up> 

prompt-item-focus next 

<tab> 

<down> 

[command,prompt] 

rl-backward-char 

<ctrl-b> 

rl-forward-char 

<ctrl-f> 

rl-backward-word 

<alt-b> 

rl-forward-word 

<alt-f> 

rl-beginning-of-line 

<ctrl-a> 

rl-end-of-line 

<ctrl-e> 

rl-unix-line-discard 

<ctrl-u> 

rl-kill-line 

<ctrl-k> 

rl-kill-word 

<alt-d> 

rl-unix-word-rubout 

<ctrl-w> 

rl-backward-kill-word 

<alt-backspace> 

rl-yank 

<ctrl-y> 

rl-delete-char 

<ctrl-?> 

rl-backward-delete-char 

<ctrl-h> 

[caret] 

toggle-selection 

v 

<space> 

drop-selection 

<ctrl-space> 

enter-mode normal 

c 

move-to-next-line 

j 

move-to-prev-line 

k 

move-to-next-char 

l 

move-to-prev-char 

h 

move-to-end-of-word 

e 

move-to-next-word 

w 

move-to-prev-word 

b 

move-to-start-of-next-block 

] 

move-to-start-of-prev-block 

[ 

move-to-end-of-next-block 

} 

move-to-end-of-prev-block 

{ 

move-to-start-of-line 

0 

move-to-end-of-line 

$ 

move-to-start-of-document 

gg 

move-to-end-of-document 

G 

yank selection -s 

Y 

yank selection 

y 

<return> 

<ctrl-m> 

<ctrl-j> 

<shift-return> 

<enter> 

<shift-enter> 

scroll left 

H 

scroll down 

J 

scroll up 

K 

scroll right 

L 

""" 

 

 

def get_diff(): 

"""Get a HTML diff for the old config files.""" 

old_conf_lines = [] 

old_key_lines = [] 

 

for filename, dest in [('qutebrowser.conf', old_conf_lines), 

('keys.conf', old_key_lines)]: 

path = os.path.join(standarddir.config(), filename) 

 

with open(path, 'r', encoding='utf-8') as f: 

for line in f: 

if not line.strip() or line.startswith('#'): 

continue 

dest.append(line.rstrip()) 

 

conf_delta = difflib.unified_diff(OLD_CONF.lstrip().splitlines(), 

old_conf_lines) 

key_delta = difflib.unified_diff(OLD_KEYS_CONF.lstrip().splitlines(), 

old_key_lines) 

 

conf_diff = '\n'.join(conf_delta) 

key_diff = '\n'.join(key_delta) 

 

# pylint: disable=no-member 

# WORKAROUND for https://bitbucket.org/logilab/pylint/issue/491/ 

lexer = pygments.lexers.DiffLexer() 

formatter = pygments.formatters.HtmlFormatter( 

full=True, linenos='table', 

title='Diffing pre-1.0 default config with pre-1.0 modified config') 

# pylint: enable=no-member 

return pygments.highlight(conf_diff + key_diff, lexer, formatter)