-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathddhx.1
More file actions
1204 lines (1204 loc) · 25.8 KB
/
Copy pathddhx.1
File metadata and controls
1204 lines (1204 loc) · 25.8 KB
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
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" ddhx - modal hex editor
.\" Copyright (c) 2017-2026 dd86k <dd@dax.moe>
.\" MIT License
.TH DDHX 1 "2026-06-19" "ddhx 0.10.0" "User Commands"
.
.SH NAME
ddhx \- modal TUI hex editor
.
.SH SYNOPSIS
.B ddhx
.RI [ FILE | \- ]
.RI [ OPTIONS ]
.br
.B ddhx
.RB { \-h | \-\-help | \-\-version | \-\-ver }
.
.SH DESCRIPTION
.B ddhx
is a simple modal TUI hex editor.
.PP
It supports viewing and editing binary files with multiple data representations,
pattern-based search, unlimited undo/redo, and files up to 8\ EiB in size.
.PP
When invoked with no arguments,
.B ddhx
opens an empty buffer or, if there is data, opens the standard input stream
into an in-memory buffer.
.PP
Minimum recommended terminal size is 80x24 characters.
.
.SS Features
.IP \(bu 2
Supports insert, overwrite, and delete operations
.IP \(bu
Unlimited undo/redo
.IP \(bu
Large file support: up to 8 EiB
.IP \(bu
Visual selection and range commands
.IP \(bu
Multiple charset representations: ascii, mac, cp437, ebcdic
.IP \(bu
Search data with a powerful pattern syntax
.IP \(bu
Skip identical data or repeating patterns by selection
.IP \(bu
Bookmark ranges and jump between them, with save/load to a file
.IP \(bu
Data inspector panel
.IP \(bu
Find and replace, including replacing all occurrences
.IP \(bu
Customizable with configuration file
.IP \(bu
Copy, Cut, and Paste data at will
.
.SH OPTIONS
.
.SS Configuration
.TP
.BI "\-c, \-\-columns=" N
Set the number of columns per row. Use
.B auto
to fit the terminal width. Default: 16.
.TP
.BI "\-A, \-\-address=" MODE
Set address display mode:
.BR hex ,
.BR dec ,
or
.BR oct .
Default:
.BR hex .
.TP
.BI "\-D, \-\-data=" MODE
Set data display mode:
.BR x8 ,
.BR x16 ,
.BR x32 ,
.BR d8 ,
.BR d16 ,
.BR d32 ,
.BR o8 ,
.BR o16 ,
or
.BR o32 .
Default:
.BR x8 .
.TP
.BI \-\-address\-spacing= N
Set the address column width in characters. Default: 11.
.TP
.B \-\-autoresize
Automatically resize the number of columns to fit the terminal width on
dimension change. Equivalent to
.BR "\-\-columns=auto" .
.TP
.BI "\-C, \-\-charset=" CHARSET
Set character translation:
.BR ascii ,
.BR cp437 ,
.BR mac ,
or
.BR ebcdic .
Default:
.BR ascii .
.TP
.B \-R, \-\-restrict
Restrict document editing for the whole session. This starts in the
.B readonly
writing mode, like the
.B writemode
setting, but editing cannot be enabled back afterward.
.TP
.B \-W, \-\-writable
Allow document editing, ignoring the
.B writemode
setting from configuration files. Lifts
.BR \-R / \-\-restrict
when given after it, the last of the two options wins.
.TP
.B \-I, \-\-norc
Ignore user configuration files and use defaults.
.TP
.BI "\-f, \-\-rcfile=" PATH
Use the specified file for configuration instead of the default locations.
.TP
.BI "-B, \-\-bookmarks=" PATH
Load bookmarks from the specified file on startup. See the
.SM
.B BOOKMARKS
section for the file format.
.
.SS Information
.TP
.BR \-h ", " \-\-help
Print a help summary and exit.
.TP
.B \-\-version
Print full version information and exit.
.TP
.B \-\-ver
Print the version number only and exit.
.TP
.B \-\-help\-keys
Print default keybindings and exit.
.TP
.B \-\-help\-commands
Print all available commands and exit.
.TP
.B \-\-help\-config
Print configuration options and file paths and exit.
.
.SH USAGE
.PP
Create a new empty document:
.RS
.nf
$ ddhx
.fi
.RE
.PP
Open an existing or create a new file:
.RS
.nf
$ ddhx FILENAME
.fi
.RE
.PP
Create a new document from stream data:
.RS
.nf
$ echo test | ddhx
.fi
.RE
.PP
To quit the editor, use
.B Ctrl+Q
or the
.B quit
command.
.
.SH WRITING MODES
The editor supports four writing modes, shown in the status bar:
.TP
.B R/O
Read-only. No editing is permitted.
.TP
.B OVR
Overwrite. Typed data replaces existing bytes at the cursor. This is the default.
.TP
.B INS
Insert. Typed data is inserted before the cursor position.
.TP
.B DIG
Digit. Overwrite a single digit (or nibble).
.PP
Press
.B Insert
or use the
.B change\-mode
command to cycle between modes.
.PP
The writing mode currently affects manual edits and pasting data from the
internal clipboard.
.
.SH KEYBINDINGS
.
.SS Navigation
.TS
lb l.
Left/Right Move cursor by one element
Up/Down Move cursor by one row
Page Up/Down Move cursor by one screen
Home/End Move to start/end of row
Ctrl+Home/End Move to start/end of document
Ctrl+Up/Down Scroll view without moving cursor
Ctrl+Left/Right Skip identical elements
Ctrl+G Goto address
.TE
.PP
Navigation should resemble most text editors. If you wish to set up custom
keybindings, see the CONFIGURATION section.
.
.SS Selection
.TS
lb l.
Shift+Left/Right Extend selection by one element
Shift+Up/Down Extend selection by one row
Shift+Home/End Extend selection to row start/end
Ctrl+Shift+Home/End Extend selection to document start/end
Ctrl+A Select entire document
.TE
.PP
Some commands support selection.
Selection makes certain commands work differently.
For example, with an active selection, the
.B replace
command doesn't need a range expression, only a pattern.
.PP
If the shift key is unavailable, the
.B mark
and
.B unmark
commands can be used to start and stop a selection.
The selection commands, such as
.BR "select \fIRANGE\fP" ", " select\-end ,
etc., also remain available.
.
.SS Skipping
Typically,
.B Ctrl+Left
and
.B Ctrl+Right
skip the same element until a different element is found.
This is particularly useful for skipping wide empty spaces, even gigabytes.
.PP
To skip a group of data as a pattern, first select a range of data, then press
.B Ctrl+Right
to skip forward.
The cursor will skip over all consecutive occurrences of the selected pattern
until a mismatch is found.
.
.SS Bookmarks
.TS
lb l.
m Toggle a bookmark over the selection or cursor
] Jump to the next bookmark
[ Jump to the previous bookmark
.TE
.PP
Bookmarks mark a range of data and are highlighted in the view. Navigation
between bookmarks wraps around the document. See the
.B BOOKMARKS
section for the related commands.
.
.SS Editing
.TS
lb l.
a\-f, 0\-9 Start inserting or replacing data at cursor
Insert Cycle writing mode (OVR, INS, DIG)
Delete Delete element at cursor
Backspace Delete element before cursor
Ctrl+U Undo
Ctrl+Y Redo
Ctrl+S Save document
Ctrl+O Save As another name and set new target
Alt+C Copy selection
Alt+X Cut selection
Alt+V Paste
.TE
.PP
Edit single elements using the
.B a\-f
and
.B 0\-9
keys.
For the overwrite and insert modes, the editor is element-oriented, so typing
"ff" will insert or replace one element. In digit mode, editing a single digit
will overwrite the element.
.PP
It is also possible to use a command over a selection, like
.BR "replace x:00" ,
to replace a selection with zeros.
.PP
To insert a file into the document at the current cursor position, use the
.B insert\-file
command.
The same can be done using
.BR replace\-file ,
where the file replaces content using the file's length.
.
.SS Search
.TS
lb l.
Ctrl+F Find forward
Ctrl+B Find backward
Ctrl+N Find next (repeat forward)
Shift+N Find previous (repeat backward)
Ctrl+R Find and replace next (repeat last)
.TE
.
.SS Display
.TS
lb l.
Tab Switch between data and text columns
Alt+I Toggle the data inspector panel
Alt+E Toggle inspector endian (little/big)
.TE
.
.SS Diff
.TS
lb l.
} Jump to the next difference
{ Jump to the previous difference
.TE
.PP
With a diff panel open (see the
.B diff\-file
command), these move the cursor between differences.
A run of consecutive differing elements counts as one difference, so a large
modified region is one jump rather than one per element.
Navigation does not wrap around the document.
.
.SS Other
.TS
lb l.
Enter Open command prompt
Ctrl+P Report position
Ctrl+L Refresh screen
Alt+R Auto-resize columns
Ctrl+Q Quit
.TE
.
.SH COMMANDS
All actions in the editor are backed by commands, many of which are mapped
to keys.
.PP
To invoke the command prompt, press the
.B Enter
(Return) key.
Type a command and press
.B Enter
again to execute it.
.PP
To cancel a prompt input, press
.BR Escape ,
.BR Ctrl+C ,
or give it empty input.
.PP
Some commands require arguments. If omitted, the editor will prompt for the
missing arguments, or continue if there is an active selection.
.
.SS Navigation Commands
.TP
.BI goto " ADDRESS"
Jump to the specified address. Supports hexadecimal
.RB ( 0x
prefix), binary
.RB ( 0b
prefix), octal
.RB ( 0
prefix), decimal, and percentage
.RB ( %
prefix) formats. A leading
.B +
or
.B \-
makes the jump relative to the current position.
.PP
.RS
Examples:
.RS
.nf
goto 0x10 \fRJump to position 16 (hexadecimal)\fP
goto 0b1010 \fRJump to position 10 (binary)\fP
goto +020 \fRJump forward 16 bytes (octal)\fP
goto \-5 \fRJump backward 5 bytes (decimal)\fP
goto %45.1 \fRJump to 45.1% of the document size\fP
.fi
.RE
.RE
.PP
With an active selection of 1 to 8 bytes, no address argument is used.
Instead, the selected bytes are read as a native-endian integer and the
cursor jumps to that absolute position, letting a selected field be
followed like a pointer.
.
.SS Search Commands
.TP
.BI find " PATTERN"
Search forward for
.IR PATTERN .
.TP
.BI find\-back " PATTERN"
Search backward for
.IR PATTERN .
.TP
.B find\-next
Repeat the last search forward.
.TP
.B find\-prev
Repeat the last search backward.
.TP
.BI find\-replace " [NEEDLE \fR\-\-\fP REPLACEMENT]"
Find the next occurrence of
.I NEEDLE
and replace it with
.IR REPLACEMENT .
The needle and replacement are both patterns, separated by a literal
.BR \-\- .
With no arguments, repeats the last find-replace
.RB ( Ctrl+R ).
.TP
.BI find\-replace\-all " [NEEDLE \fR\-\-\fP REPLACEMENT]"
Find and replace every occurrence.
With an active selection, only that range is searched.
.PP
Example: replace the string "foo" with "bar":
.RS
.nf
find\-replace s:foo \-\- s:bar
find\-replace\-all x:00 \-\- x:ff
.fi
.RE
.PP
Once a search needle is defined, it can be reused using
.B find\-next
.RB ( Ctrl+N )
and
.B find\-prev
.RB ( Shift+N ).
.PP
Example: looking for
.B "hi\e0\e0"
(these are all equivalent):
.RS
.nf
find s:hi x:00 00
find "hi" 0x0000
find x:68 69 00 00
.fi
.RE
.PP
Practical example for PDF files: use
.B find s:endstream
to search for the string "endstream", then hit
.B Ctrl+N
to go to the next result or
.B Shift+N
to go to the previous result.
.PP
.BR "LIMITATION:" " Search does not wrap and depends on the cursor position."
.
.SS Editing Commands
.TP
.BI insert " PATTERN"
Insert
.I PATTERN
at the cursor position, or over the active selection.
.TP
.BI replace " PATTERN"
Replace data at the cursor with
.IR PATTERN ,
or over the active selection.
.TP
.BI insert\-range " RANGE PATTERN"
Insert
.I PATTERN
at the start of
.IR RANGE .
With an active selection, only a pattern is needed.
.TP
.BI replace\-range " RANGE PATTERN"
Replace data in
.I RANGE
with
.IR PATTERN .
With an active selection, only a pattern is needed.
.TP
.BI insert\-file " PATH"
Insert the contents of a file at the cursor position.
.TP
.BI replace\-file " PATH"
Replace data at the cursor with the contents of a file.
.TP
.BI select " RANGE"
Select the specified range.
.TP
.B mark
Start a selection at the current cursor position (alternative to Shift key).
.TP
.B unmark
Clear the current selection.
.TP
.B copy
Copy selected data to the internal clipboard.
.TP
.B cut
Cut selected data to the internal clipboard.
.TP
.B paste
Paste data from the internal clipboard.
.TP
.B clear\-clip
Clear the internal clipboard.
.TP
.B delete
Delete the element at the cursor position.
.TP
.B undo
Undo the last change.
.TP
.B redo
Redo the last undone change.
.
.SS Bookmark Commands
.TP
.BI bookmark\-set " [RANGE]"
Add a bookmark over
.IR RANGE ,
the active selection, or the cursor element.
.TP
.BI bookmark\-unset " [RANGE]"
Remove bookmarks overlapping
.IR RANGE ,
the active selection, or the cursor element.
.TP
.BI bookmark\-toggle " [RANGE]"
Set a bookmark, or remove any that overlap the target
.RB (key: m ).
.TP
.B bookmark\-next
Jump to the next bookmark
.RB (key: ] ).
Wraps to the first bookmark.
.TP
.B bookmark\-prev
Jump to the previous bookmark
.RB (key: [ ).
Wraps to the last bookmark.
.TP
.B bookmark\-clear
Remove all bookmarks.
.TP
.BI bookmark\-save " PATH"
Save all bookmarks to a file. See the
.SM
.B BOOKMARKS
section for the format.
.TP
.BI bookmark\-load " PATH"
Load bookmarks from a file and merge them with the current list.
.
.SS Display Commands
.TP
.B change\-panel
Switch the cursor between the data and text columns
.RB ( Tab ).
.TP
.B toggle\-inspector
Show or hide the data inspector panel
.RB ( Alt+I ).
.TP
.B toggle\-endian
Toggle the inspector between little- and big-endian
.RB ( Alt+E ).
.TP
.BI diff\-file " [PATH]"
Open
.I PATH
in a diff panel below the view, highlighting bytes that differ from the current document.
The panel follows the main view's position.
With no argument while a diff panel is open, the panel closes.
To compare unsaved changes against the on-disk copy, pass the document's own path.
.TP
.B diff\-next
Move the cursor to the start of the next difference against the diffed file
.RB (key: } ).
.TP
.B diff\-prev
Move the cursor to the start of the previous difference against the diffed file
.RB (key: { ).
A cursor sitting inside a difference moves to the start of that difference first.
.TP
.B refresh
Redraw the entire screen
.RB ( Ctrl+L ).
.TP
.B autosize
Automatically set the number of columns to fit the terminal width, once
.RB ( Alt+R ).
Unlike the
.B columns auto
setting, this does not persist the automatic behavior across resizes.
.
.SS File Commands
.TP
.B save
Save the current document.
.TP
.BI save\-as " PATH"
Save the document to a new file and set it as the current target.
.TP
.BI export\-range " RANGE PATH"
Export the specified range to a file.
.
.SS Reporting Commands
.TP
.B report
Report the cursor position, document size, and percentage
.RB ( Ctrl+P ).
The report format is customizable using the
.B status-report
configuration property.
.TP
.B report\-name
Report the current document name on screen.
.TP
.B report\-version
Report the
.B ddhx
version on screen.
.
.SS Configuration Commands
.TP
.BI set " OPTION VALUE"
Change a configuration setting at runtime. See
.SM
.B CONFIGURATION
for available options.
Runtime changes do not persist across sessions.
To make settings permanent, add them to a configuration file.
.TP
.BI bind " KEY COMMAND \fR[\fPPARAMS...\fR]\fP"
Bind a key to a command.
.TP
.BI unbind " KEY"
Remove a keybinding.
.TP
.B reset\-keys
Restore all keybindings to their defaults.
.TP
.BI color " ELEMENT COLOR"
Set the color for
.IR ELEMENT .
See the Colors subsection under
.SM
.B CONFIGURATION
for the list of elements, color syntax, and the
.B reset
value.
.PP
Examples:
.RS
.nf
set charset mac \fRSet character set to Mac\fP
bind right\-arrow goto +32 \fRBind Right Arrow to jump 32 bytes\fP
unbind right\-arrow \fRRemove the binding\fP
reset\-keys \fRReset all bindings to defaults\fP
color cursor red:blue \fRSet cursor color\fP
color cursor reset \fRReset cursor color to default\fP
.fi
.RE
.
.SH PATTERNS
A pattern expression consists of one or more prefixed patterns, which can be
matched in order (left to right).
.PP
For example,
.B "x:00 01"
will yield a pattern of [ 0x00, 0x01 ], and
.B "s:hi x:ffff"
a pattern of [ 0x68, 0x69, 0xff, 0xff ].
.PP
Supported prefixes:
.TP
.BI x: VALUE "\fR, \fP" 0x VALUE
Hexadecimal unsigned integer.
Example:
.BR "x:00" ", " "0xff" ", " "x:0101" .
.TP
.BI d: VALUE
Decimal unsigned integer.
Example:
.BR "d:255" .
.TP
.BI o: VALUE "\fR, \fP" 0o VALUE
Octal unsigned integer.
Example:
.BR "o:377" ", " "0o377" .
.TP
.BI s: STRING "\fR, \fP \(dq" STRING \(dq
String (currently ASCII only). Quoted strings need a terminator.
Example:
.BR "s:hello" ", " "\(dqtest\(dq" .
.TP
.B ?
Match any single byte (wildcard).
.TP
.B *
Match zero or more bytes (wildcard).
.PP
Supported commands:
.BR find ,
.BR find\-back ,
.BR find\-replace ,
.BR find\-replace\-all ,
.BR insert ,
.BR insert\-range ,
.BR replace ,
and
.BR replace\-range .
.
.SH RANGES
A range expression represents a start and end position inclusively, typically
in the
.IB START : END
format. Supports hexadecimal, decimal, and octal values.
.PP
Special markers:
.TP
.B .
Current cursor position.
.TP
.B $
End of document (document size minus one).
.TP
.B +
(End only) End is not a position, but an addition to start position.
.PP
Without the separator
.RB ( : ),
it only denotes a length, including the cursor position.
Instead of
.BR ".:+3"
(current position + 3 elements),
.B "4"
can be used.
.PP
Examples:
.RS
.nf
select 0x10:0x19 \fRSelect positions 0x10 to 0x19\fP
select 0x10:+9 \fRSame range (0x10 + 9 = 0x19)\fP
select 0x10:. \fRFrom 0x10 to cursor position\fP
select 0x10:$ \fRFrom 0x10 to end of document\fP
replace\-range 200:$ x:00 \fRReplace from address 200 to EOF with zeros\fP
replace\-range 200:. x:00 \fRReplace from 200 to cursor with zeros\fP
insert\-range 100 x:90 \fRInsert 100 0x90 bytes at cursor\fP
select 4 \fRSelect 4 elements from cursor\fP
.fi
.RE
.PP
Supported commands:
.BR select ,
.BR insert\-range ,
.BR replace\-range ,
.BR export\-range ,
.BR bookmark\-set ,
.BR bookmark\-unset ,
and
.BR delete .
.
.SH BOOKMARKS
Bookmarks mark a range of data for quick navigation. They are highlighted in
the view and can be jumped between with
.B ]
.RB ( bookmark\-next )
and
.B [
.RB ( bookmark\-prev ),
both of which wrap around the document.
.PP
Press
.B m
.RB ( bookmark\-toggle )
to set a bookmark over the current selection or cursor, or to remove any
bookmarks overlapping it.
.PP
Bookmarks can be written to a file with
.B bookmark\-save
and read back with
.BR bookmark\-load .
The
.B \-\-bookmarks
option loads a file on startup.
The file is plain text, one bookmark per line, in the form:
.RS
.IB ADDRESS " " LENGTH
.RE
.PP
.I ADDRESS
may be hexadecimal
.RB ( 0x
prefix) or decimal, and
.I LENGTH
is decimal. Lines beginning with
.B #
are comments. Loaded entries are merged with existing bookmarks.
.PP
Example:
.RS
.nf
# ddhx bookmarks
0x10 4
0x100 16
.fi
.RE
.
.SH DATA INSPECTOR
The data inspector is an optional panel, shown below the view, that interprets
the bytes at the cursor as multiple data types: 8-, 16-, and 32-bit signed and
unsigned integers, and 32- and 64-bit floating point values.
.PP
Toggle the panel with
.B Alt+I
.RB ( toggle\-inspector )
or the
.B inspector
setting.
Multi-byte values respect the
.B endian
setting, which can be flipped at runtime with
.B Alt+E
.RB ( toggle\-endian ).
.
.SH CONFIGURATION
Configuration can be set via command-line options, configuration files, or the
.B set
command at runtime.
Runtime changes do not persist across sessions. To make settings permanent,
add them to a configuration file.
.
.SS Configuration File
The configuration file is a plain text file with one setting per line.
Comments start with
.BR # .
Lines take the form:
.RS
.IB setting " value [OPTIONS...]"
.RE
.PP
Keybindings can also be set in the configuration file:
.RS
.IB bind " KEY COMMAND [PARAMS...]"
.RE
.
.SS Configuration File Locations
Configuration files are searched in the following order (first found wins):
.TP
1.
Path specified with
.BR \-f / \-\-rcfile .
.TP
2.
.I ~/.ddhxrc
.TP
3.
.I ~/.config/ddhx/.ddhxrc
.TP
4.
.I /etc/ddhx/.ddhxrc
.PP
The
.BR \-\-help\-config
option lists possible paths.
.
.SS Settings
.TP
.BR address " \fRhexadecimal\fP | octal | decimal"
Address display format. Default:
.BR hexadecimal .
.TP
.BI "address\-spacing " N
Address column width. Default:
.BR 11 .
.TP
.BR charset " \fRascii\fP | cp437 | mac | ebcdic"
Character set for the text column. Default:
.BR ascii .
.TP
.BR coalesce " \fRon\fP | off"
Enable edit coalescing (group consecutive edits into a single undo step). Default:
.BR on .
.TP
.BI columns " N \fR|\fP auto"
Number of elements per row. Default:
.BR 16 .
.TP
.BR data " \fRx8\fP | x16 | x32 | d8 | d16 | d32 | o8 | o16 | o32"
Data display format. Default:
.BR x8 .
.TP
.BR endian " \fRlittle\fP | big"
Endian used by the data inspector for multi-byte values. Aliases
.B le
and
.B be
are accepted. Default:
.BR little .
.TP
.BR inspector " on | \fRoff\fP"
Show the data inspector panel below the view. Default:
.BR off .
.TP
.BR highlight\-zeros " \fRon\fP | off"
If enabled, highlight zero values (defaults to gray). Default:
.BR on .
.TP
.BR header " \fRon\fP | off"
Show the header bar. Default:
.BR on .
.TP
.BR mirror\-cursor " on | \fRoff\fP"
Show the cursor in both data and text columns. Default:
.BR off .
.TP
.BR status " \fRon\fP | off"
Show the status bar. Default:
.BR on .
.TP
.BI status\-format " STRING"
Format string for the status bar. See
.SM
.B STATUS BAR FORMAT
for available specifiers. Default:
.BR "\(dq%e %m | %t | %c | %8p\(dq" .
.TP
.BI status\-selection " STRING"
Format string for the status bar when a selection is active. Default:
.BR "\(dqSEL: %V (%v Bytes)\(dq" .
.TP
.BI status\-report " STRING"
Format string for the position report
.RB ( Ctrl+P ).
Default:
.BR "\(dq%d / %s B (%q%%)\(dq" .
.TP
.BR writemode " readonly | \fRoverwrite\fP | insert | digit"
Writing mode used when entering data. Only the first character is
significant, so
.B o
is accepted for
.BR overwrite .
The
.B readonly
value only sets the starting mode, and can be changed back with
.B change\-mode
or
.BR set ,
unlike
.BR \-R / \-\-restrict .
On fixed\-size documents, insert mode is
reported as unavailable and falls back to
.BR overwrite .
Default:
.BR overwrite .
.
.SS Colors
Unlike the settings above, colors are not changed with
.BR set .
Instead, use the
.B color
command
.RB ( "color ELEMENT COLOR" ),
either at the command prompt or as its own line in a configuration file:
.RS
.IB color " ELEMENT COLOR"
.RE
.PP
Valid elements are:
.IR normal ", " cursor ", " selection ", " mirror ", " zero ", " bookmark ", " diff\-changed ", " diff\-missing .
.PP
.I COLOR
is
.IB FOREGROUND : BACKGROUND
where either part is optional (omitting defaults to the terminal color).
For example,
.B red:blue