xref: /openbsd/usr.bin/vi/docs/internals/autowrite (revision 09467b48)
1#	$OpenBSD: autowrite,v 1.3 2001/01/29 01:58:37 niklas Exp $
2
3#	@(#)autowrite	8.3 (Berkeley) 2/17/95
4
5Vi autowrite behavior, the fields with *'s are "don't cares".
6
7=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8Commands that are affected only by autowrite:
9
10Command	File		Autowrite?	Action:
11	modified?
12-----------------------------------------------
13^Z	Y		Y		Write file and suspend.
14^Z	Y		N		Suspend.
15^Z	N		*		Suspend.
16
17# This behavior is NOT identical to :edit.
18^^	Y		Y		Write file and jump.
19^^	Y		N		Error.
20^^	N		*		Jump.
21
22# The new nvi command ^T (:tagpop) behaves identically to ^].
23# This behavior is identical to :tag, :tagpop, and :tagpush with
24# force always set to N.
25^]	Y		Y		Write file and jump.
26^]	Y		N		Error.
27^]	N		*		Jump.
28
29# There's no way to specify a force flag to the '!' command.
30:!	Y		Y		Write file and execute.
31:!	Y		N		Warn (if warn option) and execute.
32:!	N		*		Execute.
33
34=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
35Commands that are affected by both autowrite and force:
36
37NOTE: the "force" flag is never passed on, i.e. the write
38to the file caused by the autowrite flag is never forced.
39
40Command	File		Autowrite?	Force? 	Action:
41	modified?			(!)
42-------------------------------------------------------
43# The first rule (YYY) is historic practice, but seems wrong.
44# In nvi, :next and :prev commands behave identically to :rewind.
45:next 	Y		Y		Y	Write changes and jump.
46:next 	Y		Y		N	Write changes and jump.
47:next 	Y		N		Y	Abandon changes and jump.
48:next 	Y		N		N	Error.
49:next 	N		*		*	Jump.
50
51:rewind	Y		Y		Y	Abandon changes and jump.
52:rewind	Y		Y		N	Write changes and jump.
53:rewind	Y		N		Y	Abandon changes and jump.
54:rewind	Y		N		N	Error.
55:rewind	N		*		*	Jump.
56
57# The new nvi commands, :tagpop and :tagtop, behave identically to :tag.
58# Note, this behavior is the same as :rewind and friends, as well.
59:tag	Y		Y		Y	Abandon changes and jump.
60:tag	Y		Y		N	Write changes and jump.
61:tag	Y		N		Y	Abandon changes and jump.
62:tag	Y		N		N	Error.
63:tag	N		*		*	Jump.
64
65# The command :suspend behaves identically to :stop.
66:stop	Y		Y		Y	Suspend.
67:stop	Y		Y		N	Write changes and suspend.
68:stop	Y		N		Y	Suspend.
69:stop	Y		N		N	Suspend.
70:stop	N		*		*	Suspend.
71
72=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
73Commands that might be affected by autowrite, but aren't:
74
75Command	File		Autowrite?	Force? 	Action:
76	modified?			(!)
77-------------------------------------------------------
78#:ex, and :vi (executed while in vi mode) behave identically to :edit.
79:edit 	Y		*		Y	Abandon changes and jump.
80:edit 	Y		*		N	Error.
81:edit 	N		*		*	Jump.
82
83:quit	Y		*		Y	Quit.
84:quit	Y		*		N	Error.
85:quit	N		*		*	Quit.
86
87:shell	*		*		*	Execute shell.
88
89:xit	Y		*		*	Write changes and exit.
90:xit	N		*		*	Exit.
91