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