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
|
Test for joining lines and marks in them
in compatible and nocompatible modes
and with 'joinspaces' set or not
and with 'cpoptions' flag 'j' set or not
STARTTEST
:so small.vim
:set nocompatible viminfo+=nviminfo
:set nojoinspaces
:set cpoptions-=j
/firstline/
j"td/^STARTTEST/-1
PJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j joinspaces
j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j nojoinspaces compatible
j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj4Jy3l$pjd/STARTTEST/-2
ENDTEST
firstline
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf.
asdf
asdfasdf
asdf
asdfasdf
asdf
asdfasdf
asdf
asdfasdf
asdf
asdfasdf
asdf
asdfasdf
asdf
asdfasdf
asdf
zx cvn.
as dfg?
hjkl iop!
ert
zx cvn.
as dfg?
hjkl iop!
ert
STARTTEST
/^{/+1
:set comments=s1:/*,mb:*,ex:*/,://
:set nojoinspaces fo=j
:set backspace=eol,start
:.,+3join
j4J
:.,+2join
j3J
:.,+2join
j3J
:.,+2join
jj3J
ENDTEST
{
/*
* Make sure the previous comment leader is not removed.
*/
/*
* Make sure the previous comment leader is not removed.
*/
// Should the next comment leader be left alone?
// Yes.
// Should the next comment leader be left alone?
// Yes.
/* Here the comment leader should be left intact. */
// And so should this one.
/* Here the comment leader should be left intact. */
// And so should this one.
if (condition) // Remove the next comment leader!
// OK, I will.
action();
if (condition) // Remove the next comment leader!
// OK, I will.
action();
}
STARTTEST
:" Test with backspace set to the non-compatible setting
/^\d\+ this
:set cp bs=2
Avim1
Avim2u
:set cpo-=<
:inoremap <c-u> <left><c-u>
Avim3
:iunmap <c-u>
Avim4
:" Test with backspace set to the compatible setting
:set backspace= visualbell
A vim5A
A vim6Azweiu
:inoremap <c-u> <left><c-u>
A vim7
:set compatible novisualbell
ENDTEST
1 this shouldn't be deleted
2 this shouldn't be deleted
3 this shouldn't be deleted
4 this should be deleted
5 this shouldn't be deleted
6 this shouldn't be deleted
7 this shouldn't be deleted
8 this shouldn't be deleted (not touched yet)
STARTTEST
/^{/+1
:set comments=sO:*\ -,mO:*\ \ ,exO:*/
:set comments+=s1:/*,mb:*,ex:*/,://
:set comments+=s1:>#,mb:#,ex:#<,:<
:set cpoptions-=j joinspaces fo=j
:set backspace=eol,start
:.,+3join
j4J
:.,+8join
j9J
:.,+2join
j3J
:.,+2join
j3J
:.,+2join
jj3J
j:.,+2join
jj3J
j:.,+5join
j6J
oSome code!
// Make sure backspacing does not remove this comment leader.0i
ENDTEST
{
/*
* Make sure the previous comment leader is not removed.
*/
/*
* Make sure the previous comment leader is not removed.
*/
/* List:
* - item1
* foo bar baz
* foo bar baz
* - item2
* foo bar baz
* foo bar baz
*/
/* List:
* - item1
* foo bar baz
* foo bar baz
* - item2
* foo bar baz
* foo bar baz
*/
// Should the next comment leader be left alone?
// Yes.
// Should the next comment leader be left alone?
// Yes.
/* Here the comment leader should be left intact. */
// And so should this one.
/* Here the comment leader should be left intact. */
// And so should this one.
if (condition) // Remove the next comment leader!
// OK, I will.
action();
if (condition) // Remove the next comment leader!
// OK, I will.
action();
int i = 7 /* foo *// 3
// comment
;
int i = 7 /* foo *// 3
// comment
;
># Note that the last character of the ending comment leader (left angle
# bracket) is a comment leader itself. Make sure that this comment leader is
# not removed from the next line #<
< On this line a new comment is opened which spans 2 lines. This comment should
< retain its comment leader.
># Note that the last character of the ending comment leader (left angle
# bracket) is a comment leader itself. Make sure that this comment leader is
# not removed from the next line #<
< On this line a new comment is opened which spans 2 lines. This comment should
< retain its comment leader.
}
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:?firstline?+1,$w! test.out
:qa!
ENDTEST
|