forked from martanne/vis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvis.1
1327 lines (1327 loc) · 28.3 KB
/
vis.1
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
.Dd January 14, 2017
.Dt VIS 1
.Os Vis VERSION
.
.Sh NAME
.Nm vis
.Nd a highly efficient text editor
.
.Sh SYNOPSIS
.Nm
.Op Fl v
.Op Ic +command
.Op Fl -
.Op Ar files ...
.
.Sh DESCRIPTION
.Nm
is a highly efficient screen-oriented text editor combining the strengths of both
.Nm vi(m)
and
.Nm sam .
.
This manual page is intended for users already familiar with
.Nm vi Ns / Ns Nm sam .
Anyone else should almost certainly read a good tutorial on
either editor before this manual page.
.
The following options are available:
.Bl -tag -width indent
.It Fl v
Print version information and exit.
.
.It Sy +command
Execute command after loading file.
.
.It Fl -
Denotes the end of the options. Arguments after this will be handled as a
file name.
.\" TODO mention +command
.El
.Pp
The special file
.Cm -
instructs
.Nm
to read from standard input in which case
.Ic :wq
will write to standard output, thereby enabling usage as an interactive filter.
.Pp
If standard input is redirected and all input is consumed,
.Nm
will open /dev/tty to gather further commands. Failure to do so results in
program termination.
.
.Ss Modes
.Nm
employs the same
.Em modal
editing approach as
.Nm vi .
It supports a normal, operator pending, insert, replace and visual
(in both line and character wise variants) mode.
.\" TODO: add short per-mode descripton?
.Pp
The visual block and ex modes are deliberately not implemented,
instead
.Nm
has built in support for multiple cursors/selections and an
.Em interactive
variant of the structural regular expression based command language of
.Nm sam .
.
.Ss Undo/Redo
.Nm
uses an undo tree to keep track of text revisions. The
.Ic u
(undo) and
.Aq Ic C-r
(redo) commands can be used to traverse the tree along the main branch.
Additionally
.Ic g+
and
.Ic g-
traverse the history in chronological order. Furthermore the
.Ic :earlier
and
.Ic :later
commands provide means to restore the text to an arbitrary state.
.
.Ss Marks
A mark associates a given file position to a symbolic name.
A mark becomes invalid once the underlying file content changes (e.g. it
being deleted or replaced). If said changes are later undone the mark becomes
valid again.
.Bl -tag -width indent
.It a-z
general purpose marks
.It <
start of the last selected visual area in current file
.It >
end of the last selected visual area in current file
.El
.Pp
No marks across files are supported. Marks are not preserved over editing sessions.
.
.Ss Registers
Registers can hold arbitrary data which can later be re-inserted into
the file or executed as a macro. Supported registers include:
.Bl -tag -width indent
.It \(dqa-\(dqz
general purpose registers
.It \(dqA-\(dqZ
append to corresponding general purpose register
.It \(dq*, \(dq+
system clipboard integration via shell script
.Xr vis-clipboard 1
.It \(dq0
yank register, most recently yanked range
.It \(dq1-\(dq9
.It \(dq&
sub expression matches of most recent
.Ic x
or
.Ic y
command
.It \(dq/
search register, most recently used search pattern
.It \(dq:
command register, most recently executed command
.It \(dq_
black hole (/dev/null) register, ignore content is always empty
.El
.Pp
If no explicit register is specified a default register is used.
.
.Ss Macros
.
The general purpose registers
.Cm \(dqa-\(dqz
can be used to record macros. Use
one of
.Cm \(dqA-\(dqZ
to append to an existing macro.
.Ic q
starts a recording,
.Ic @
plays it back.
.Ic @@
refers to the most recently recorded macro.
.Ic @:
repeats the last :-command.
.Ic @/
is equivalent to
.Ic n
in normal mode.
.
.Ss Jump list and Change list
.
A per window, fixed sized file local jump list (navigate with
.Aq Ic C-O
and
.Aq Ic C-I )
and change list (navigate with
.Ic g;
and
.Ic g, )
is supported.
.
.Ss Encoding, Tab and Newline handling
.
.Nm
always assumes the input file to be UTF-8 encoded. If you wish to edit
files with legacy encodings, use
.Xr iconv 1
to convert them as needed.
.Aq Tab
can optionally be expanded to a configurable number of spaces (see
.Sx "SET OPTIONS" ) .
The first line ending in the file determines what will be inserted when pressing
.Aq Enter
(defaults to \\n).
.
.Ss Mouse support
The mouse is currently not used at all.
.
.Sh SAM COMMANDS
.
.Nm
supports an interactive variant of the structural regular expression based command language introduced by
.Xr sam 1 .
.
.Ss Regular expressions
.Nm
currently defers regular expression matching to the underlying C library.
It uses what POSIX refers to as
.Dq Extended Regular Expressions
as described in
.Xr regex 7 "."
.
Additonally \[rs]n and \[rs]t may be used to refer to newlines and tabs, respectively.
The
.Cm "."
atom matches any character except newline.
.
The empty regular expression stands for the last complete expression encountered.
.
.Ss Addresses
An address identifies a substring (or range) in a file. In the following
.Do
character
.Sy n
.Dc
means the null string after the
.Sy n\fR-th
character in the file, with 1 the first character in the file.
.Do
Line
.Sy n
.Dc
means the
.Sy n\fR-th
match, starting at the beginning of the file, of the regular expression
.Li ".*\[rs]n?" .
.Pp
All windows always have at least one current substring which
is the default address. In sam this is referred to as
.Sy dot .
In
.Nm
multiple
.Dq dots
can exist at the same time.
In normal mode each cursor induces such a range, representing the
character it is currently over. Similarly, in visual mode each
selection serves as a default address.
.Ss Simple addresses
.Bl -tag -width indent
.It Ic #n
The empty string after character
.Sy n ;
.Li #0
is the beginning of the file.
.It Ic n
Line
.Sy n .
.It Ic /regexp/
.It Ic ?regexp?
The substring that matches the regular expression, found by looking
towards the end
.Pq Li /
or beginning
.Pq Li \&?
of the file. The search does not wrap around when hitting the end
.Pq start
of the file.
.It Ic 0
The string before the first full line.
This is not necessarily the null string; see
.Li +
and
.Li -
below.
.It Ic $
The null string at the end of the file.
.It Ic "."
Dot, the current range.
.It Ic "'m"
The mark
.Sy m
in the file.
.El
.
.Ss Compound addresses
In the following,
.Sy a1
and
.Sy a2
are addresses.
.Bl -tag -width indent
.It Sy a1+a2
The address
.Sy a2
evaluated starting at the end of
.Sy a1 .
.It Sy a1-a2
The address
.Sy a2
evaluated looking the reverse direction starting at the beginning of
.Sy a1 .
.It Sy "a1,a2"
The substring from the beginning of
.Sy a1
to the end of
.Sy a2 .
If
.Sy a1
is missing,
.Li 0
is substituted.
If
.Sy a2
is missing,
.Li $
is substituted.
.It Sy a1;a2
Like
.Dq Sy a1,a2
but with
.Sy a2
evaluated at the end of, and range set to,
.Sy a1 .
.El
.Pp
The operators
.Li +
and
.Li -
are high precedence, while
.Li ","
and
.Li ";"
are low precedence.
.Pp
In both
.Li +
and
.Li -
forms, if
.Sy a2
is a line or character address with a missing number, the number defaults to 1.
If
.Sy a1
is missing,
.Li "."
is substituted.
If both
.Sy a1
and
.Sy a2
are present and distinguishable,
.Li +
may be elided.
.Sy a2
may be a regular expression; if it is delimited by
.Dq Li \&?
characters, the effect of the
.Li +
or
.Li -
is reversed.
.
The
.Li %
sign is an alias for
.Li ","
and hence
.Li 0,$ .
.
It is an error for a compound address to represent a malformed substring.
.
.Ss Commands
In the following, text demarcated by slashes represents text delimited
by any printable ASCII character except alphanumerics. Any number
of trailing delimiters may be elided, with multiple elisions then
representing null strings, but the first delimiter must always be present.
In any delimited text, newline may not appear literally;
.Li \[rs]n
and
.Li \[rs]t
may be typed for newline and tab;
.Li \[rs]/
quotes the delimiter, here
.Li / .
An ampersand
.Li &
and
.Sy \[rs]n ,
where
.Sy n
is a digit (1-9) are replaced by the corresponding register.
Backslash is otherwise interpreted literally.
.Pp
Most commands may be prefixed with an address to indicate their range
of operation. If a command takes an address and none is supplied, a
default address is used. In normal mode this equates to the character
the cursor is currently over. If only one cursor exists
.Ic x
and
.Ic y
default to the whole file
.Li "0,$" .
In normal mode the write commands
.Ic w
and
.Ic wq
always apply to the whole file.
Commands are executed once for every cursor.
In visual mode the commands are applied to every selection
as if an implicit
.Ic x
command, matching the existing selections, was present.
.
.Pp
In the description,
.Dq range
is used to represent whatever address is supplied.
.Pp
Many commands create new selections as a side effect when issued from a visual mode.
If so, it is always to the “result” of the change: the new text for an insertion, the
empty string for a deletion, the command output of a filter etc.
If after a successful command execution no selections remain,
the editor will switch to normal mode, otherwise it remains in
visual mode. This allows
.Em interactive
refinements of ranges.
.
.\" Many commands set the value of dot as a side effect.
.\" If so, it is always to the
.\" .Dq result
.\" of the change: the empty string for a deletion, the new text for an insertion, etc.
.\" .Po
.\" but see the
.\" .Sy s
.\" and
.\" .Sy e
.\" commands
.\" .Pc "."
.Ss Text commands
.Bl -tag -width indent
.It Ic a/text/
Insert the text into the file after the range.
.\" Set dot.
.Pp
May also be written as
.Bd -literal -offset indent
a
lines
of
text
.
.Ed
.It Ic c \fR or i
Same as
.Sy a ,
but
.Sy c
replaces the text, while
.Sy i
inserts
.Em before
the range.
.It Sy d
Delete the text in range.
.\" Set dot.
.El
.
.Ss Display commands
.Bl -tag -width Ds
.It Ic p
Create a new selection for the range. If empty, create a new cursor.
.El
.
.Ss I/O commands
.Bl -tag -width indent
.It Ic e[!] Bq file name
Replace the file by the contents of the named external file.
If no file name is given, reload file from disk.
.It Ic r file name
Replace the text in the range by the contents of the named external file.
.\" Set dot.
.It Ic w[!] Bq file name
Write the range
.Po
default
.Li 0,$
.Pc
to the named external file.
.It Ic wq[!] Bq file name
Same as
.Ic w ,
but close file afterwards.
.El
.Pp
If the file name argument is absent from any of these, the current file name is used.
.Ic e
always sets the file name,
.Ic w
will do so if the file has no name.
Forcing the
.Ic e
command with
.Cm "!"
will discard any unsaved changes. Forcing
.Ic w
will overwrite the file on disk even if it has been externally modified
since loading it. Write commands with a non-default addresses and no
file name are destructive and need always to be forced.
.Bl -tag -width indent
.It Ic "< shell-command"
Replace the range by the standard output of the shell command.
.It Ic "> shell-command"
Sends the range to the standard input of the shell command.
.It Ic "| shell-command"
Send the range to the standard input, and replace it by the standard output, of the shell command.
.It Ic "! shell-command"
Run interactive shell command, redirect keyboard input to it.
.It Ic "cd directory"
Change working directory.
If no directory is specified,
.Ev "$HOME"
is used.
.El
.Pp
In any of
.Ic "<" ,
.Ic ">" ,
.Ic "|" ,
or
.Ic "!" ,
if the shell command is omitted, the last shell command
.Pq "of any type"
is substituted.
Unless the file being edited is unnamed, all these external commands
can refer to its absolute path and file name through the
.Ic $vis_filepath
and
.Ic $vis_filename
environment variables.
.Ss Loops and conditionals
.Bl -tag -width indent
.It Ic x/regexp/ Bq command
For each match of the regular expression in the range, run the command with range set to the match.
If the regular expression and its slashes are omitted,
.Li "/.*\[rs]n/"
is assumed.
Null string matches potentially occur before every character of the range and at the end of the range.
.Pp
The
.Ic \(dq1-\(dq9
and
.Ic \(dq&
registers are updated with the (sub) expression matches of the pattern.
.It Ic y/regexp/ Bq command
Like
.Ic x ,
but run the command for each substring that lies before, between, or after the matches that would be generated by
.Ic x .
There is no default behavior.
Null substrings potentially occur before every character in the range.
.It Ic "X/regexp/ command"
For each file whose file name matches the regular expression, make that the current file and run the command.
If the expression is omitted, the command is run in every file.
.It Ic "Y/regexp/ command"
Same as
.Ic X ,
but for files that do not match the regular expression, and the expression is required.
.It Ic "g/regexp/ command"
.It Ic "v/regexp/ command"
If the range contains
.Po
.Ic g
.Pc
or does not contain
.Po
.Ic v
.Pc
a match for the expression, run command on the range.
.El
.Pp
These may be nested arbitrarily deeply.
An empty command in an
.Ic x
or
.Ic y
defaults to
.Ic p .
.Ic X ,
.Ic Y ,
.Ic g
and
.Ic v
do not have defaults.
.
.Ss Grouping and multiple changes
Commands may be grouped by enclosing them in curly braces.
Semantically, the opening brace is like a command: it takes an
.Pq optional
address and runs each sub-command on the range.
Commands within the braces are executed sequentially, but changes
made by one command are not visible to other commands.
.Pp
When a command makes a number of changes to a file, as in
.Ic x/re/c/text/ ,
the addresses of all changes to the file are computed in the original
file. If the changes are non-overlapping, they are applied to the file.
Successive insertions at the same address are catenated into a single
insertion composed of the several insertions in the order applied.
.Pp
Braces may be nested arbitrarily.
.
.Sh VI(M) KEY BINDINGS
.
In the following sections angle brackets are used to denote special keys.
The prefixes
.Cm C- ,
.Cm S- ,
and
.Cm M-
are used to refer to the
.Aq Ctrl ,
.Aq Shift
and
.Aq Alt
modifiers, respectively.
.Pp
All active key bindings can be listed at runtime using the
.Cm :help
command.
.
.Ss Operators
.
Operators perform a certain operation an a text range indicated by either a
motion, a text object or an existing selection.
.
.Bl -tag -width indent
.It c
change, delete range and enter insert mode
.It d
delete range
.It !
filter range through external shell command
.It =
indent, currently an alias for gq
.It gq
format, filter range through
.Xr fmt 1
.It gu
make lowercase
.It gU
make uppercase
.It J
join lines, insert spaces in between
.It gJ
join lines remove any delimiting white spaces
.It p
put, insert register content
.It <
shift-left, decrease indent
.It >
shift-right, increase indent
.It ~
swap case
.It y
yank, copy range to register
.El
.Pp
Operators can be forced to work line wise by specifying
.Cm V .
.
.Ss Motions
.
.\" TODO? more formal definition: pos -> [min(pos, f(pos)), max(pos, f(pos))]
Motions take an initial file position and transform it to a destination file position,
thereby defining a range.
.\" TODO define word/WORD
.
.Bl -tag -width indent
.It 0
start of line
.
.It b
previous start of a word
.
.It B
previous start of a WORD
.
.It $
end of line
.
.It e
next end of a word
.
.It E
next end of a WORD
.
.It F Aq char
to next occurrence of char to the left
.
.It f Aq char
to next occurrence of char to the right
.
.It ^
first non-blank of line
.
.It g0
begin of display line
.
.It g$
end of display line
.
.It ge
previous end of a word
.
.It gE
previous end of a WORD
.
.It gg
begin of file
.
.It G
goto line or end of file
.
.It gj
display line down
.
.It gk
display line up
.
.It g_
last non-blank of line
.
.It gm
middle of display line
.
.It |
goto column
.
.It h
char left
.
.It H
goto top/home line of window
.
.It j
line down
.
.It k
line up
.
.It l
char right
.
.It L
goto bottom/last line of window
.
.It ` Aq mark
go to mark
.
.It ' Aq mark
go to start of line containing mark
.
.It %
match bracket
.
.It M
goto middle line of window
.
.It }
next paragraph
.
.It )
next sentence
.
.It N
repeat last search backwards
.
.It n
repeat last search forward
.
.It [{
previous start of block
.
.It ]}
next start of block
.
.It [(
previous start of parenthese pair
.
.It ])
next start of parenthese pair
.
.It {
previous paragraph
.
.It "("
previous sentence
.
.It ;
repeat last to/till movement
.
.It ,
repeat last to/till movement but in opposite direction
.
.It #
search word under cursor backwards
.
.It *
search word under cursor forwards
.
.It T Aq char
till before next occurrence of char to the left
.
.It t Aq char
till before next occurrence of char to the right
.
.It ? pattern
to next match of pattern in backward direction
.
.It / pattern
to next match of pattern in forward direction
.
.It w
next start of a word
.
.It W
next start of a WORD
.El
.
.Ss Text objects
.\" TODO? more formal definition: text-object: pos -> [a, b]
Text objects take an initial file position and transform it to a range
where the former does not necessarily have to be contained in the latter.
.
All of the following text objects are implemented in an inner variant
(prefixed with
.Cm i ")"
where the surrounding white space or delimiting characters are not part
of the resulting range and a normal variant (prefixed with
.Cm a ")"
where they are.
.Bl -tag -width indent
.
.It w
word
.
.It W
WORD
.
.It s
sentence
.
.It p
paragraph
.
.It [,], (,), {,}, <,>, \&", ', `
block enclosed by these symbols
.El
.Pp
Further available text objects include:
.Bl -tag -width indent
.
.It gn
matches the last used search term in forward direction
.
.It gN
matches the last used search term in backward direction
.
.It ae
entire file content
.
.It ie
entire file content except for leading and trailing empty lines
.
.It al
current line
.
.It il
current line without leading and trailing white spaces
.El
.
.Ss Multiple Cursors and Selections
.
.Nm
supports multiple cursors with immediate visual feedback. There always
exists one primary cursor located within the current view port. Additional
cursors can be created as needed. If more than one cursor exists,
the primary one is styled differently.
.Pp
To manipulate multiple cursors use in normal mode:
.Bl -tag -width indent
.It Aq C-k
create count new cursors on the lines above
.It Aq C-M-k
create count new cursors on the lines above the first cursor
.It Aq C-j
create count new cursors on the lines below
.It Aq C-M-j
create count new cursors on the lines below the last cursor
.It Aq C-p
remove primary cursor
.It Aq C-n
select word the cursor is currently over, switch to visual mode
.It Aq C-u
make the count previous cursor primary
.It Aq C-d
make the count next cursor primary
.It Aq C-c
remove the count cursor column
.It Aq C-l
remove all but the count cursor column
.It Aq Tab
try to align all cursor on the same column
.It Aq Escape
dispose all but the primary cursor
.El
.Pp
The visual modes were enhanced to recognize:
.Bl -tag -width indent
.It I
create a cursor at the start of every selected line
.It A
create a cursor at the end of every selected line
.It Aq Tab
left align selections by inserting spaces
.It Aq S-Tab
right align selections by inserting spaces
.It Aq C-n
create new cursor and select next word matching current selection
.It Aq C-x
clear (skip) current selection, but select next matching word
.It Aq C-p
remove primary cursor
.It Aq C-u
.It Aq C-k
make the count previous cursor primary
.It Aq C-d
.It Aq C-j
make the count next cursor primary
.It Aq C-c
remove the count cursor column
.It Aq C-l
remove all but the count cursor column
.It +
rotates selections rightwards count times
.It -
rotates selections leftwards count times
.It \e
trim selections, remove leading and trailing white space
.It Aq Escape
clear all selections, switch to normal mode
.El
.Pp
In insert and replace mode:
.Bl -tag -width indent
.
.It Aq S-Tab
align all cursors by inserting spaces
.El
.
.Sh VI(M) COMMANDS
.
Any unique prefix can be used to abbreviate a command.
.
.Ss File and Window management
.
A file must be opened in at least one window. If the last window displaying a
certain file is closed all unsaved changes are discarded. Windows are equally
sized and can be displayed in either horizontal or vertical fashion.
The
.Aq C-w
h,
.Aq C-w
j,
.Aq C-w
k and
.Aq C-w
l key mappings can be used to switch between windows.
.Bl -tag -width indent
.It Cm :new
open an empty window, arrange horizontally
.It Cm :vnew
open an empty window, arrange vertically
.It Cm :open[!] Bq file name
open a new window, displaying file name if given
.It Cm :split Bq file name
split window horizontally
.It Cm :vsplit Bq file name
split window vertically
.It Cm :bdelete[!]
close all windows which display the same file as the current one
.It Cm :q[!]
close currently focused window
.It Cm :qall[!]
close all windows, exit editor
.El
.Pp
Commands taking a file name will invoke the
.Xr vis-open 1
utility, if given a file pattern or directory.
.
.Ss Runtime key mappings
.Nm
supports global as well as window local run time key mappings which are
always evaluated recursively.
.
.Bl -tag -width indent
.It Cm :map[!] <mode> <lhs> <rhs>
add a global key mapping
.It Cm :map-window[!] <mode> <lhs> <rhs>
add a window local key mapping