annotate src/testdir/test_options.vim @ 33399:95db67c7b754 v9.0.1958

patch 9.0.1958: cannot complete option values Commit: https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Fri Sep 29 20:42:32 2023 +0200 patch 9.0.1958: cannot complete option values Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=<Tab>` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: #13182 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 29 Sep 2023 20:45:04 +0200
parents 23a824d80de3
children 0909ef6aac3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1 " Test for options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3 source shared.vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4 source check.vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
5 source view_util.vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
6
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
7 func Test_whichwrap()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
8 set whichwrap=b,s
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
9 call assert_equal('b,s', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
10
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
11 set whichwrap+=h,l
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
12 call assert_equal('b,s,h,l', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
13
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
14 set whichwrap+=h,l
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
15 call assert_equal('b,s,h,l', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
16
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
17 set whichwrap+=h,l
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
18 call assert_equal('b,s,h,l', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
19
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
20 set whichwrap=h,h
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
21 call assert_equal('h', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
22
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
23 set whichwrap=h,h,h
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
24 call assert_equal('h', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
25
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
26 " For compatibility with Vim 3.0 and before, number values are also
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
27 " supported for 'whichwrap'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
28 set whichwrap=1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
29 call assert_equal('b', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
30 set whichwrap=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
31 call assert_equal('s', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
32 set whichwrap=4
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
33 call assert_equal('h,l', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
34 set whichwrap=8
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
35 call assert_equal('<,>', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
36 set whichwrap=16
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
37 call assert_equal('[,]', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
38 set whichwrap=31
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
39 call assert_equal('b,s,h,l,<,>,[,]', &whichwrap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
40
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
41 set whichwrap&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
42 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
43
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
44 func Test_isfname()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
45 " This used to cause Vim to access uninitialized memory.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
46 set isfname=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
47 call assert_equal("~X", expand("~X"))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
48 set isfname&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
49 " Test for setting 'isfname' to an unsupported character
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
50 let save_isfname = &isfname
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
51 call assert_fails('exe $"set isfname+={"\u1234"}"', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
52 call assert_equal(save_isfname, &isfname)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
53 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
54
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
55 " Test for getting the value of 'pastetoggle'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
56 func Test_pastetoggle()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
57 " character with K_SPECIAL byte
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
58 let &pastetoggle = '…'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
59 call assert_equal('…', &pastetoggle)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
60 call assert_equal("\n pastetoggle=…", execute('set pastetoggle?'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
61
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
62 " modified character with K_SPECIAL byte
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
63 let &pastetoggle = '<M-…>'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
64 call assert_equal('<M-…>', &pastetoggle)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
65 call assert_equal("\n pastetoggle=<M-…>", execute('set pastetoggle?'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
66
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
67 " illegal bytes
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
68 let str = ":\x7f:\x80:\x90:\xd0:"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
69 let &pastetoggle = str
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
70 call assert_equal(str, &pastetoggle)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
71 call assert_equal("\n pastetoggle=" .. strtrans(str), execute('set pastetoggle?'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
72
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
73 unlet str
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
74 set pastetoggle&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
75 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
76
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
77 func Test_wildchar()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
78 " Empty 'wildchar' used to access invalid memory.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
79 call assert_fails('set wildchar=', 'E521:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
80 call assert_fails('set wildchar=abc', 'E521:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
81 set wildchar=<Esc>
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
82 let a=execute('set wildchar?')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
83 call assert_equal("\n wildchar=<Esc>", a)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
84 set wildchar=27
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
85 let a=execute('set wildchar?')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
86 call assert_equal("\n wildchar=<Esc>", a)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
87 set wildchar&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
88 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
89
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
90 func Test_wildoptions()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
91 set wildoptions=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
92 set wildoptions+=tagfile
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
93 set wildoptions+=tagfile
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
94 call assert_equal('tagfile', &wildoptions)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
95 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
96
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
97 func Test_options_command()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
98 let caught = 'ok'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
99 try
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
100 options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
101 catch
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
102 let caught = v:throwpoint . "\n" . v:exception
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
103 endtry
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
104 call assert_equal('ok', caught)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
105
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
106 " Check if the option-window is opened horizontally.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
107 wincmd j
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
108 call assert_notequal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
109 wincmd k
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
110 call assert_equal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
111 " close option-window
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
112 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
113
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
114 " Open the option-window vertically.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
115 vert options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
116 " Check if the option-window is opened vertically.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
117 wincmd l
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
118 call assert_notequal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
119 wincmd h
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
120 call assert_equal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
121 " close option-window
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
122 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
123
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
124 " Open the option-window at the top.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
125 set splitbelow
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
126 topleft options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
127 call assert_equal(1, winnr())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
128 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
129
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
130 " Open the option-window at the bottom.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
131 set nosplitbelow
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
132 botright options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
133 call assert_equal(winnr('$'), winnr())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
134 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
135 set splitbelow&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
136
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
137 " Open the option-window in a new tab.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
138 tab options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
139 " Check if the option-window is opened in a tab.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
140 normal gT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
141 call assert_notequal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
142 normal gt
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
143 call assert_equal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
144 " close option-window
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
145 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
146
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
147 " Open the options window browse
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
148 if has('browse')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
149 browse set
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
150 call assert_equal('option-window', bufname(''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
151 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
152 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
153 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
154
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
155 func Test_path_keep_commas()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
156 " Test that changing 'path' keeps two commas.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
157 set path=foo,,bar
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
158 set path-=bar
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
159 set path+=bar
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
160 call assert_equal('foo,,bar', &path)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
161
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
162 set path&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
163 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
164
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
165 func Test_path_too_long()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
166 exe 'set path=' .. repeat('x', 10000)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
167 call assert_fails('find x', 'E854:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
168 set path&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
169 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
170
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
171 func Test_signcolumn()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
172 CheckFeature signs
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
173 call assert_equal("auto", &signcolumn)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
174 set signcolumn=yes
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
175 set signcolumn=no
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
176 call assert_fails('set signcolumn=nope')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
177 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
178
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
179 func Test_filetype_valid()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
180 set ft=valid_name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
181 call assert_equal("valid_name", &filetype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
182 set ft=valid-name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
183 call assert_equal("valid-name", &filetype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
184
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
185 call assert_fails(":set ft=wrong;name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
186 call assert_fails(":set ft=wrong\\\\name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
187 call assert_fails(":set ft=wrong\\|name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
188 call assert_fails(":set ft=wrong/name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
189 call assert_fails(":set ft=wrong\\\nname", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
190 call assert_equal("valid-name", &filetype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
191
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
192 exe "set ft=trunc\x00name"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
193 call assert_equal("trunc", &filetype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
194 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
195
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
196 func Test_syntax_valid()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
197 CheckFeature syntax
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
198 set syn=valid_name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
199 call assert_equal("valid_name", &syntax)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
200 set syn=valid-name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
201 call assert_equal("valid-name", &syntax)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
202
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
203 call assert_fails(":set syn=wrong;name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
204 call assert_fails(":set syn=wrong\\\\name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
205 call assert_fails(":set syn=wrong\\|name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
206 call assert_fails(":set syn=wrong/name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
207 call assert_fails(":set syn=wrong\\\nname", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
208 call assert_equal("valid-name", &syntax)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
209
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
210 exe "set syn=trunc\x00name"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
211 call assert_equal("trunc", &syntax)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
212 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
213
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
214 func Test_keymap_valid()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
215 CheckFeature keymap
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
216 call assert_fails(":set kmp=valid_name", "E544:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
217 call assert_fails(":set kmp=valid_name", "valid_name")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
218 call assert_fails(":set kmp=valid-name", "E544:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
219 call assert_fails(":set kmp=valid-name", "valid-name")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
220
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
221 call assert_fails(":set kmp=wrong;name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
222 call assert_fails(":set kmp=wrong\\\\name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
223 call assert_fails(":set kmp=wrong\\|name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
224 call assert_fails(":set kmp=wrong/name", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
225 call assert_fails(":set kmp=wrong\\\nname", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
226
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
227 call assert_fails(":set kmp=trunc\x00name", "E544:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
228 call assert_fails(":set kmp=trunc\x00name", "trunc")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
229 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
230
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
231 func Check_dir_option(name)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
232 " Check that it's possible to set the option.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
233 exe 'set ' . a:name . '=/usr/share/dict/words'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
234 call assert_equal('/usr/share/dict/words', eval('&' . a:name))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
235 exe 'set ' . a:name . '=/usr/share/dict/words,/and/there'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
236 call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
237 exe 'set ' . a:name . '=/usr/share/dict\ words'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
238 call assert_equal('/usr/share/dict words', eval('&' . a:name))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
239
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
240 " Check rejecting weird characters.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
241 call assert_fails("set " . a:name . "=/not&there", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
242 call assert_fails("set " . a:name . "=/not>there", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
243 call assert_fails("set " . a:name . "=/not.*there", "E474:")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
244 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
245
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
246 func Test_cinkeys()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
247 " This used to cause invalid memory access
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
248 set cindent cinkeys=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
249 norm a
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
250 set cindent& cinkeys&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
251 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
252
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
253 func Test_dictionary()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
254 call Check_dir_option('dictionary')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
255 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
256
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
257 func Test_thesaurus()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
258 call Check_dir_option('thesaurus')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
259 endfun
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
260
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
261 func Test_complete()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
262 " Trailing single backslash used to cause invalid memory access.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
263 set complete=s\
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
264 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
265 call feedkeys("i\<C-N>\<Esc>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
266 bwipe!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
267 call assert_fails('set complete=ix', 'E535:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
268 set complete&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
269 endfun
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
270
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
271 func Test_set_completion()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
272 call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
273 call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
274
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
275 call feedkeys(":setlocal di\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
276 call assert_equal('"setlocal dictionary diff diffexpr diffopt digraph directory display', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
277
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
278 call feedkeys(":setglobal di\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
279 call assert_equal('"setglobal dictionary diff diffexpr diffopt digraph directory display', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
280
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
281 " Expand boolean options. When doing :set no<Tab> Vim prefixes the option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
282 " names with "no".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
283 call feedkeys(":set nodi\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
284 call assert_equal('"set nodiff nodigraph', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
285
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
286 call feedkeys(":set invdi\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
287 call assert_equal('"set invdiff invdigraph', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
288
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
289 " Expanding "set noinv" does nothing.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
290 call feedkeys(":set noinv\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
291 call assert_equal('"set noinv', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
292
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
293 " Expand abbreviation of options.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
294 call feedkeys(":set ts\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
295 call assert_equal('"set tabstop thesaurus thesaurusfunc ttyscroll', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
296
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
297 " Expand current value
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
298 call feedkeys(":set suffixes=\<C-A>\<C-B>\"\<CR>", 'tx')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
299 call assert_equal('"set suffixes=.bak,~,.o,.h,.info,.swp,.obj', @:)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
300
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
301 call feedkeys(":set suffixes:\<C-A>\<C-B>\"\<CR>", 'tx')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
302 call assert_equal('"set suffixes:.bak,~,.o,.h,.info,.swp,.obj', @:)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
303
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
304 " Expand key codes.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
305 call feedkeys(":set <H\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
306 call assert_equal('"set <Help> <Home>', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
307
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
308 " Expand terminal options.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
309 call feedkeys(":set t_A\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
310 call assert_equal('"set t_AB t_AF t_AU t_AL', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
311 call assert_fails('call feedkeys(":set <t_afoo>=\<C-A>\<CR>", "xt")', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
312
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
313 " Expand directories.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
314 call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
315 call assert_match(' ./samples/ ', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
316 call assert_notmatch(' ./summarize.vim ', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
317
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
318 " Expand files and directories.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
319 call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
320 call assert_match(' ./samples/.* ./summarize.vim', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
321
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
322 call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
323 call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
324 set tags&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
325
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
326 " Expanding the option names
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
327 call feedkeys(":set \<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
328 call assert_equal('"set all', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
329
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
330 " Expanding a second set of option names
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
331 call feedkeys(":set wrapscan \<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
332 call assert_equal('"set wrapscan all', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
333
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
334 " Expanding a special keycode
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
335 call feedkeys(":set <Home>\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
336 call assert_equal('"set <Home>', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
337
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
338 " Expanding an invalid special keycode
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
339 call feedkeys(":set <abcd>\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
340 call assert_equal("\"set <abcd>\<Tab>", @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
341
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
342 " Expanding a terminal keycode
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
343 call feedkeys(":set t_AB\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
344 call assert_equal("\"set t_AB", @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
345
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
346 " Expanding an invalid option name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
347 call feedkeys(":set abcde=\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
348 call assert_equal("\"set abcde=\<Tab>", @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
349
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
350 " Expanding after a = for a boolean option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
351 call feedkeys(":set wrapscan=\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
352 call assert_equal("\"set wrapscan=\<Tab>", @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
353
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
354 " Expanding a numeric option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
355 call feedkeys(":set tabstop+=\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
356 call assert_equal("\"set tabstop+=" .. &tabstop, @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
357
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
358 " Expanding a non-boolean option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
359 call feedkeys(":set invtabstop=\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
360 call assert_equal("\"set invtabstop=", @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
361
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
362 " Expand options for 'spellsuggest'
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
363 call feedkeys(":set spellsuggest=file:test_options.v\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
364 call assert_equal("\"set spellsuggest=file:test_options.vim", @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
365 call feedkeys(":set spellsuggest=best,file:test_options.v\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
366 call assert_equal("\"set spellsuggest=best,file:test_options.vim", @:)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
367
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
368 " Expand value for 'key'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
369 set key=abcd
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
370 call feedkeys(":set key=\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
371 call assert_equal('"set key=*****', @:)
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
372 call feedkeys(":set key-=\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
373 call assert_equal('"set key-=*****', @:)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
374 set key=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
375
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
376 " Expand values for 'filetype'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
377 call feedkeys(":set filetype=sshdconfi\<Tab>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
378 call assert_equal('"set filetype=sshdconfig', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
379 call feedkeys(":set filetype=a\<C-A>\<C-B>\"\<CR>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
380 call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
33012
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
381
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
382 " Expand values for 'syntax'
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
383 call feedkeys(":set syntax=sshdconfi\<Tab>\<C-B>\"\<CR>", 'xt')
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
384 call assert_equal('"set syntax=sshdconfig', @:)
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
385 call feedkeys(":set syntax=a\<C-A>\<C-B>\"\<CR>", 'xt')
859e539d686b patch 9.0.1798: The 'syntax' option has no completion.
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
386 call assert_equal('"set syntax=' .. getcompletion('a*', 'syntax')->join(), @:)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
387 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
388
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
389 " Test handling of expanding individual string option values
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
390 func Test_set_completion_string_values()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
391 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
392 " Test basic enum string options that have well-defined enum names
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
393 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
394
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
395 call assert_equal(getcompletion('set display=', 'cmdline'), ['lastline', 'truncate', 'uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
396 call assert_equal(getcompletion('set display=t', 'cmdline'), ['truncate'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
397 call assert_equal(getcompletion('set display=*ex*', 'cmdline'), ['uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
398
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
399 " Test that if a value is set, it will populate the results, but only if
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
400 " typed value is empty.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
401 set display=uhex,lastline
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
402 call assert_equal(getcompletion('set display=', 'cmdline'), ['uhex,lastline', 'lastline', 'truncate', 'uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
403 call assert_equal(getcompletion('set display=u', 'cmdline'), ['uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
404 " If the set value is part of the enum list, it will show as the first
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
405 " result with no duplicate.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
406 set display=uhex
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
407 call assert_equal(getcompletion('set display=', 'cmdline'), ['uhex', 'lastline', 'truncate'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
408 " If empty value, will just show the normal list without an empty item
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
409 set display=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
410 call assert_equal(getcompletion('set display=', 'cmdline'), ['lastline', 'truncate', 'uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
411 " Test escaping of the values
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
412 call assert_equal(getcompletion('set fillchars=', 'cmdline')[0], 'vert:\|,fold:-,eob:~,lastline:@')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
413
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
414 " Test comma-separated lists will expand after a comma.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
415 call assert_equal(getcompletion('set display=truncate,*ex*', 'cmdline'), ['uhex'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
416 " Also test the positioning of the expansion is correct
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
417 call feedkeys(":set display=truncate,l\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
418 call assert_equal('"set display=truncate,lastline', @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
419 set display&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
420
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
421 " Test single-value options will not expand after a comma
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
422 call assert_equal(getcompletion('set ambw=single,', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
423
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
424 " Test the other simple options to make sure they have basic auto-complete,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
425 " but don't exhaustively validate their results.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
426 call assert_equal(getcompletion('set ambw=', 'cmdline')[0], 'single')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
427 call assert_match('light\|dark', getcompletion('set bg=', 'cmdline')[1])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
428 call assert_equal(getcompletion('set backspace=', 'cmdline')[0], 'indent')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
429 call assert_equal(getcompletion('set backupcopy=', 'cmdline')[1], 'yes')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
430 call assert_equal(getcompletion('set belloff=', 'cmdline')[1], 'backspace')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
431 call assert_equal(getcompletion('set briopt=', 'cmdline')[1], 'min:')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
432 if exists('+browsedir')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
433 call assert_equal(getcompletion('set browsedir=', 'cmdline')[1], 'current')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
434 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
435 call assert_equal(getcompletion('set bufhidden=', 'cmdline')[1], 'unload')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
436 call assert_equal(getcompletion('set buftype=', 'cmdline')[1], 'nowrite')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
437 call assert_equal(getcompletion('set casemap=', 'cmdline')[1], 'internal')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
438 if exists('+clipboard')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
439 call assert_match('unnamed', getcompletion('set clipboard=', 'cmdline')[1])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
440 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
441 call assert_equal(getcompletion('set complete=', 'cmdline')[1], '.')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
442 call assert_equal(getcompletion('set completeopt=', 'cmdline')[1], 'menu')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
443 if exists('+completeslash')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
444 call assert_equal(getcompletion('set completeslash=', 'cmdline')[1], 'backslash')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
445 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
446 if exists('+cryptmethod')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
447 call assert_equal(getcompletion('set cryptmethod=', 'cmdline')[1], 'zip')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
448 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
449 if exists('+cursorlineopt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
450 call assert_equal(getcompletion('set cursorlineopt=', 'cmdline')[1], 'line')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
451 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
452 call assert_equal(getcompletion('set debug=', 'cmdline')[1], 'throw')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
453 call assert_equal(getcompletion('set eadirection=', 'cmdline')[1], 'ver')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
454 call assert_equal(getcompletion('set fileformat=', 'cmdline')[2], 'mac')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
455 if exists('+foldclose')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
456 call assert_equal(getcompletion('set foldclose=', 'cmdline')[0], 'all')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
457 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
458 if exists('+foldmethod')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
459 call assert_equal(getcompletion('set foldmethod=', 'cmdline')[1], 'expr')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
460 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
461 if exists('+foldopen')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
462 call assert_equal(getcompletion('set foldopen=', 'cmdline')[1], 'all')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
463 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
464 call assert_equal(getcompletion('set jumpoptions=', 'cmdline')[0], 'stack')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
465 call assert_equal(getcompletion('set keymodel=', 'cmdline')[1], 'stopsel')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
466 call assert_equal(getcompletion('set lispoptions=', 'cmdline')[1], 'expr:1')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
467 call assert_match('popup', getcompletion('set mousemodel=', 'cmdline')[2])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
468 call assert_equal(getcompletion('set nrformats=', 'cmdline')[1], 'bin')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
469 if exists('+rightleftcmd')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
470 call assert_equal(getcompletion('set rightleftcmd=', 'cmdline')[0], 'search')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
471 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
472 call assert_equal(getcompletion('set scrollopt=', 'cmdline')[1], 'ver')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
473 call assert_equal(getcompletion('set selection=', 'cmdline')[1], 'exclusive')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
474 call assert_equal(getcompletion('set selectmode=', 'cmdline')[1], 'key')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
475 if exists('+ssop')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
476 call assert_equal(getcompletion('set ssop=', 'cmdline')[1], 'buffers')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
477 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
478 call assert_equal(getcompletion('set showcmdloc=', 'cmdline')[1], 'statusline')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
479 if exists('+signcolumn')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
480 call assert_equal(getcompletion('set signcolumn=', 'cmdline')[1], 'yes')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
481 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
482 if exists('+spelloptions')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
483 call assert_equal(getcompletion('set spelloptions=', 'cmdline')[0], 'camel')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
484 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
485 if exists('+spellsuggest')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
486 call assert_equal(getcompletion('set spellsuggest+=', 'cmdline')[0], 'best')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
487 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
488 call assert_equal(getcompletion('set splitkeep=', 'cmdline')[1], 'screen')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
489 call assert_equal(getcompletion('set swapsync=', 'cmdline')[1], 'sync')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
490 call assert_equal(getcompletion('set switchbuf=', 'cmdline')[1], 'usetab')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
491 call assert_equal(getcompletion('set tagcase=', 'cmdline')[1], 'ignore')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
492 if exists('+termwintype')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
493 call assert_equal(getcompletion('set termwintype=', 'cmdline')[1], 'conpty')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
494 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
495 if exists('+toolbar')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
496 call assert_equal(getcompletion('set toolbar=', 'cmdline')[1], 'text')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
497 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
498 if exists('+tbis')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
499 call assert_equal(getcompletion('set tbis=', 'cmdline')[2], 'medium')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
500 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
501 if exists('+ttymouse')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
502 set ttymouse=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
503 call assert_equal(getcompletion('set ttymouse=', 'cmdline')[1], 'xterm2')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
504 set ttymouse&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
505 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
506 call assert_equal(getcompletion('set virtualedit=', 'cmdline')[1], 'insert')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
507 call assert_equal(getcompletion('set wildmode=', 'cmdline')[1], 'longest')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
508 call assert_equal(getcompletion('set wildmode=list,longest:', 'cmdline')[0], 'full')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
509 call assert_equal(getcompletion('set wildoptions=', 'cmdline')[1], 'tagfile')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
510 if exists('+winaltkeys')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
511 call assert_equal(getcompletion('set winaltkeys=', 'cmdline')[1], 'yes')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
512 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
513
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
514 " Other string options that queries the system rather than fixed enum names
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
515 call assert_equal(getcompletion('set eventignore=', 'cmdline')[0:1], ['all', 'BufAdd'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
516 call assert_equal(getcompletion('set fileencodings=', 'cmdline')[1], 'latin1')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
517 call assert_equal(getcompletion('set printoptions=', 'cmdline')[0], 'top')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
518 call assert_equal(getcompletion('set wincolor=', 'cmdline')[0], 'SpecialKey')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
519
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
520 call assert_equal(getcompletion('set listchars+=', 'cmdline')[0], 'eol')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
521 call assert_equal(getcompletion('setl listchars+=', 'cmdline')[0], 'eol')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
522 call assert_equal(getcompletion('set fillchars+=', 'cmdline')[0], 'stl')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
523 call assert_equal(getcompletion('setl fillchars+=', 'cmdline')[0], 'stl')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
524
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
525 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
526 " Unique string options below
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
527 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
528
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
529 " keyprotocol: only auto-complete when after ':' with known protocol types
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
530 call assert_equal(getcompletion('set keyprotocol=', 'cmdline'), [&keyprotocol])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
531 call feedkeys(":set keyprotocol+=someterm:m\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
532 call assert_equal('"set keyprotocol+=someterm:mok2', @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
533 set keyprotocol&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
534
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
535 " previewpopup / completepopup
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
536 call assert_equal(getcompletion('set previewpopup=', 'cmdline')[0], 'height:')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
537 call assert_equal(getcompletion('set previewpopup=highlight:End*Buffer', 'cmdline')[0], 'EndOfBuffer')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
538 call feedkeys(":set previewpopup+=border:\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
539 call assert_equal('"set previewpopup+=border:on', @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
540 call feedkeys(":set completepopup=height:10,align:\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
541 call assert_equal('"set completepopup=height:10,align:item', @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
542 call assert_equal(getcompletion('set completepopup=bogusname:', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
543 set previewpopup& completepopup&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
544
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
545 " diffopt: special handling of algorithm:<alg_list>
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
546 call assert_equal(getcompletion('set diffopt+=', 'cmdline')[0], 'filler')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
547 call assert_equal(getcompletion('set diffopt+=iblank,foldcolumn:', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
548 call assert_equal(getcompletion('set diffopt+=iblank,algorithm:pat*', 'cmdline')[0], 'patience')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
549
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
550 " highlight: special parsing, including auto-completing highlight groups
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
551 " after ':'
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
552 call assert_equal(getcompletion('set hl=', 'cmdline')[0:1], [&hl, '8'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
553 call assert_equal(getcompletion('set hl+=', 'cmdline')[0], '8')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
554 call assert_equal(getcompletion('set hl+=8', 'cmdline')[0:2], ['8:', '8b', '8i'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
555 call assert_equal(getcompletion('set hl+=8b', 'cmdline')[0], '8bi')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
556 call assert_equal(getcompletion('set hl+=8:No*ext', 'cmdline')[0], 'NonText')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
557 " If all the display modes are used up we should be suggesting nothing. Make
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
558 " a hl typed option with all the modes which will look like '8bi-nrsuc2d=t',
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
559 " and make sure nothing is suggested from that.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
560 let hl_display_modes = join(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
561 \ filter(map(getcompletion('set hl+=8', 'cmdline'),
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
562 \ {idx, val -> val[1]}),
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
563 \ {idx, val -> val != ':'}),
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
564 \ '')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
565 call assert_equal(getcompletion('set hl+=8'..hl_display_modes, 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
566
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
567 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
568 " Test flag lists
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
569 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
570
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
571 " Test set=. Show the original value if nothing is typed after '='.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
572 " Otherwise, the list should avoid showing what's already typed.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
573 set mouse=v
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
574 call assert_equal(getcompletion('set mouse=', 'cmdline'), ['v','a','n','i','c','h','r'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
575 set mouse=nvi
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
576 call assert_equal(getcompletion('set mouse=', 'cmdline'), ['nvi','a','n','v','i','c','h','r'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
577 call assert_equal(getcompletion('set mouse=hn', 'cmdline'), ['a','v','i','c','r'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
578
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
579 " Test set+=. Never show original value, and it also tries to avoid listing
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
580 " flags that's already in the option value.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
581 call assert_equal(getcompletion('set mouse+=', 'cmdline'), ['a','c','h','r'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
582 call assert_equal(getcompletion('set mouse+=hn', 'cmdline'), ['a','c','r'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
583 call assert_equal(getcompletion('set mouse+=acrhn', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
584
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
585 " Test that the position of the expansion is correct (even if there are
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
586 " additional values after the current cursor)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
587 call feedkeys(":set mouse=hn\<Left>\<Tab>\<C-B>\"\<CR>", 'xt')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
588 call assert_equal('"set mouse=han', @:)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
589 set mouse&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
590
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
591 " Test that other flag list options have auto-complete, but don't
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
592 " exhaustively validate their results.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
593 if exists('+concealcursor')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
594 call assert_equal(getcompletion('set cocu=', 'cmdline')[0], 'n')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
595 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
596 call assert_equal(getcompletion('set cpo=', 'cmdline')[1], 'a')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
597 call assert_equal(getcompletion('set fo=', 'cmdline')[1], 't')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
598 if exists('+guioptions')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
599 call assert_equal(getcompletion('set go=', 'cmdline')[1], '!')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
600 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
601 call assert_equal(getcompletion('set shortmess=', 'cmdline')[1], 'r')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
602 call assert_equal(getcompletion('set whichwrap=', 'cmdline')[1], 'b')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
603
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
604 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
605 "Test set-=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
606 "
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
607
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
608 " Normal single-value option just shows the existing value
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
609 set ambiwidth=double
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
610 call assert_equal(getcompletion('set ambw-=', 'cmdline'), ['double'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
611 set ambiwidth&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
612
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
613 " Works on numbers and term options as well
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
614 call assert_equal(getcompletion('set laststatus-=', 'cmdline'), [string(&laststatus)])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
615 set t_Ce=testCe
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
616 call assert_equal(getcompletion('set t_Ce-=', 'cmdline'), ['testCe'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
617 set t_Ce&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
618
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
619 " Comma-separated lists should present each option
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
620 set diffopt=context:123,,,,,iblank,iwhiteall
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
621 call assert_equal(getcompletion('set diffopt-=', 'cmdline'), ['context:123', 'iblank', 'iwhiteall'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
622 call assert_equal(getcompletion('set diffopt-=*n*', 'cmdline'), ['context:123', 'iblank'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
623 call assert_equal(getcompletion('set diffopt-=i', 'cmdline'), ['iblank', 'iwhiteall'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
624 " Don't present more than one option as it doesn't make sense in set-=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
625 call assert_equal(getcompletion('set diffopt-=iblank,', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
626 " Test empty option
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
627 set diffopt=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
628 call assert_equal(getcompletion('set diffopt-=', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
629 set diffopt&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
630
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
631 " Test escaping output
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
632 call assert_equal(getcompletion('set fillchars-=', 'cmdline')[0], 'vert:\|')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
633
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
634 " Test files with commas in name are being parsed and escaped properly
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
635 set path=has\\\ space,file\\,with\\,comma,normal_file
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
636 if exists('+completeslash')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
637 call assert_equal(getcompletion('set path-=', 'cmdline'), ['has\\\ space', 'file\,with\,comma', 'normal_file'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
638 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
639 call assert_equal(getcompletion('set path-=', 'cmdline'), ['has\\\ space', 'file\\,with\\,comma', 'normal_file'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
640 endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
641 set path&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
642
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
643 " Flag list should present orig value, then individual flags
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
644 set mouse=v
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
645 call assert_equal(getcompletion('set mouse-=', 'cmdline'), ['v'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
646 set mouse=avn
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
647 call assert_equal(getcompletion('set mouse-=', 'cmdline'), ['avn','a','v','n'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
648 " Don't auto-complete when we have at least one flags already
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
649 call assert_equal(getcompletion('set mouse-=n', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
650 " Test empty option
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
651 set mouse=
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
652 call assert_equal(getcompletion('set mouse-=', 'cmdline'), [])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
653 set mouse&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
654
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
655 " 'whichwrap' is an odd case where it's both flag list and comma-separated
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
656 set ww=b,h
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
657 call assert_equal(getcompletion('set ww-=', 'cmdline'), ['b','h'])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
658 set ww&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
659 endfunc
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
660
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
661 func Test_set_option_errors()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
662 call assert_fails('set scroll=-1', 'E49:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
663 call assert_fails('set backupcopy=', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
664 call assert_fails('set regexpengine=3', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
665 call assert_fails('set history=10001', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
666 call assert_fails('set numberwidth=21', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
667 call assert_fails('set colorcolumn=-a', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
668 call assert_fails('set colorcolumn=a', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
669 call assert_fails('set colorcolumn=1,', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
670 call assert_fails('set colorcolumn=1;', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
671 call assert_fails('set cmdheight=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
672 call assert_fails('set cmdwinheight=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
673 if has('conceal')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
674 call assert_fails('set conceallevel=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
675 call assert_fails('set conceallevel=4', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
676 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
677 call assert_fails('set helpheight=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
678 call assert_fails('set history=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
679 call assert_fails('set report=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
680 call assert_fails('set shiftwidth=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
681 call assert_fails('set sidescroll=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
682 call assert_fails('set tabstop=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
683 call assert_fails('set tabstop=10000', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
684 call assert_fails('let &tabstop = 10000', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
685 call assert_fails('set tabstop=5500000000', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
686 call assert_fails('set textwidth=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
687 call assert_fails('set timeoutlen=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
688 call assert_fails('set updatecount=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
689 call assert_fails('set updatetime=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
690 call assert_fails('set winheight=-1', 'E487:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
691 call assert_fails('set tabstop!', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
692 call assert_fails('set xxx', 'E518:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
693 call assert_fails('set beautify?', 'E519:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
694 call assert_fails('set undolevels=x', 'E521:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
695 call assert_fails('set tabstop=', 'E521:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
696 call assert_fails('set comments=-', 'E524:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
697 call assert_fails('set comments=a', 'E525:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
698 call assert_fails('set foldmarker=x', 'E536:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
699 call assert_fails('set commentstring=x', 'E537:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
700 call assert_fails('let &commentstring = "x"', 'E537:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
701 call assert_fails('set complete=x', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
702 call assert_fails('set rulerformat=%-', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
703 call assert_fails('set rulerformat=%(', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
704 call assert_fails('set rulerformat=%15(%%', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
705 call assert_fails('set statusline=%$', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
706 call assert_fails('set statusline=%{', 'E540:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
707 call assert_fails('set statusline=%{%', 'E540:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
708 call assert_fails('set statusline=%{%}', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
709 call assert_fails('set statusline=%(', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
710 call assert_fails('set statusline=%)', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
711 call assert_fails('set tabline=%$', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
712 call assert_fails('set tabline=%{', 'E540:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
713 call assert_fails('set tabline=%{%', 'E540:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
714 call assert_fails('set tabline=%{%}', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
715 call assert_fails('set tabline=%(', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
716 call assert_fails('set tabline=%)', 'E542:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
717
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
718 if has('cursorshape')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
719 " This invalid value for 'guicursor' used to cause Vim to crash.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
720 call assert_fails('set guicursor=i-ci,r-cr:h', 'E545:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
721 call assert_fails('set guicursor=i-ci', 'E545:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
722 call assert_fails('set guicursor=x', 'E545:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
723 call assert_fails('set guicursor=x:', 'E546:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
724 call assert_fails('set guicursor=r-cr:horx', 'E548:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
725 call assert_fails('set guicursor=r-cr:hor0', 'E549:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
726 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
727 if has('mouseshape')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
728 call assert_fails('se mouseshape=i-r:x', 'E547:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
729 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
730
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
731 " Test for 'backupext' and 'patchmode' set to the same value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
732 set backupext=.bak
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
733 set patchmode=.patch
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
734 call assert_fails('set patchmode=.bak', 'E589:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
735 call assert_equal('.patch', &patchmode)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
736 call assert_fails('set backupext=.patch', 'E589:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
737 call assert_equal('.bak', &backupext)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
738 set backupext& patchmode&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
739
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
740 call assert_fails('set winminheight=10 winheight=9', 'E591:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
741 set winminheight& winheight&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
742 set winheight=10 winminheight=10
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
743 call assert_fails('set winheight=9', 'E591:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
744 set winminheight& winheight&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
745 call assert_fails('set winminwidth=10 winwidth=9', 'E592:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
746 set winminwidth& winwidth&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
747 call assert_fails('set winwidth=9 winminwidth=10', 'E592:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
748 set winwidth& winminwidth&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
749 call assert_fails("set showbreak=\x01", 'E595:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
750 call assert_fails('set t_foo=', 'E846:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
751 call assert_fails('set tabstop??', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
752 call assert_fails('set wrapscan!!', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
753 call assert_fails('set tabstop&&', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
754 call assert_fails('set wrapscan<<', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
755 call assert_fails('set wrapscan=1', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
756 call assert_fails('set autoindent@', 'E488:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
757 call assert_fails('set wildchar=<abc>', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
758 call assert_fails('set cmdheight=1a', 'E521:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
759 call assert_fails('set invcmdheight', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
760 if has('python') || has('python3')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
761 call assert_fails('set pyxversion=6', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
762 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
763 call assert_fails("let &tabstop='ab'", ['E521:', 'E521:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
764 call assert_fails('set spellcapcheck=%\\(', 'E54:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
765 call assert_fails('set sessionoptions=curdir,sesdir', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
766 call assert_fails('set foldmarker={{{,', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
767 call assert_fails('set sessionoptions=sesdir,curdir', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
768 setlocal listchars=trail:·
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
769 call assert_fails('set ambiwidth=double', 'E834:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
770 setlocal listchars=trail:-
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
771 setglobal listchars=trail:·
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
772 call assert_fails('set ambiwidth=double', 'E834:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
773 set listchars&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
774 setlocal fillchars=stl:·
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
775 call assert_fails('set ambiwidth=double', 'E835:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
776 setlocal fillchars=stl:-
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
777 setglobal fillchars=stl:·
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
778 call assert_fails('set ambiwidth=double', 'E835:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
779 set fillchars&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
780 call assert_fails('set fileencoding=latin1,utf-8', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
781 set nomodifiable
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
782 call assert_fails('set fileencoding=latin1', 'E21:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
783 set modifiable&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
784 call assert_fails('set t_#-&', 'E522:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
785 call assert_fails('let &formatoptions = "?"', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
786 call assert_fails('call setbufvar("", "&formatoptions", "?")', 'E539:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
787 call assert_fails('call setwinvar(0, "&scrolloff", [])', ['E745:', 'E745:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
788 call assert_fails('call setwinvar(0, "&list", [])', ['E745:', 'E745:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
789 call assert_fails('call setwinvar(0, "&listchars", [])', ['E730:', 'E730:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
790 call assert_fails('call setwinvar(0, "&nosuchoption", 0)', ['E355:', 'E355:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
791 call assert_fails('call setwinvar(0, "&nosuchoption", "")', ['E355:', 'E355:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
792 call assert_fails('call setwinvar(0, "&nosuchoption", [])', ['E355:', 'E355:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
793 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
794
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
795 func Test_set_encoding()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
796 let save_encoding = &encoding
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
797
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
798 set enc=iso8859-1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
799 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
800 set enc=iso8859_1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
801 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
802 set enc=iso-8859-1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
803 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
804 set enc=iso_8859_1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
805 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
806 set enc=iso88591
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
807 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
808 set enc=iso8859
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
809 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
810 set enc=iso-8859
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
811 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
812 set enc=iso_8859
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
813 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
814 call assert_fails('set enc=iso8858', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
815 call assert_equal('latin1', &enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
816
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
817 let &encoding = save_encoding
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
818 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
819
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
820 func CheckWasSet(name)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
821 let verb_cm = execute('verbose set ' .. a:name .. '?')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
822 call assert_match('Last set from.*test_options.vim', verb_cm)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
823 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
824 func CheckWasNotSet(name)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
825 let verb_cm = execute('verbose set ' .. a:name .. '?')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
826 call assert_notmatch('Last set from', verb_cm)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
827 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
828
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
829 " Must be executed before other tests that set 'term'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
830 func Test_000_term_option_verbose()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
831 CheckNotGui
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
832
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
833 call CheckWasNotSet('t_cm')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
834
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
835 let term_save = &term
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
836 set term=ansi
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
837 call CheckWasSet('t_cm')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
838 let &term = term_save
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
839 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
840
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
841 func Test_copy_context()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
842 setlocal list
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
843 call CheckWasSet('list')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
844 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
845 call CheckWasSet('list')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
846 quit
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
847 setlocal nolist
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
848
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
849 set ai
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
850 call CheckWasSet('ai')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
851 set filetype=perl
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
852 call CheckWasSet('filetype')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
853 set fo=tcroq
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
854 call CheckWasSet('fo')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
855
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
856 split Xsomebuf
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
857 call CheckWasSet('ai')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
858 call CheckWasNotSet('filetype')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
859 call CheckWasSet('fo')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
860 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
861
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
862 func Test_set_ttytype()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
863 CheckUnix
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
864 CheckNotGui
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
865
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
866 " Setting 'ttytype' used to cause a double-free when exiting vim and
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
867 " when vim is compiled with -DEXITFREE.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
868 set ttytype=ansi
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
869 call assert_equal('ansi', &ttytype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
870 call assert_equal(&ttytype, &term)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
871 set ttytype=xterm
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
872 call assert_equal('xterm', &ttytype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
873 call assert_equal(&ttytype, &term)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
874 try
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
875 set ttytype=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
876 call assert_report('set ttytype= did not fail')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
877 catch /E529/
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
878 endtry
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
879
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
880 " Some systems accept any terminal name and return dumb settings,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
881 " check for failure of finding the entry and for missing 'cm' entry.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
882 try
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
883 set ttytype=xxx
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
884 call assert_report('set ttytype=xxx did not fail')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
885 catch /E522\|E437/
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
886 endtry
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
887
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
888 set ttytype&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
889 call assert_equal(&ttytype, &term)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
890
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
891 if has('gui') && !has('gui_running')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
892 call assert_fails('set term=gui', 'E531:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
893 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
894 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
895
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
896 func Test_set_all()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
897 set tw=75
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
898 set iskeyword=a-z,A-Z
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
899 set nosplitbelow
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
900 let out = execute('set all')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
901 call assert_match('textwidth=75', out)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
902 call assert_match('iskeyword=a-z,A-Z', out)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
903 call assert_match('nosplitbelow', out)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
904 set tw& iskeyword& splitbelow&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
905 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
906
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
907 func Test_set_one_column()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
908 let out_mult = execute('set all')->split("\n")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
909 let out_one = execute('set! all')->split("\n")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
910 call assert_true(len(out_mult) < len(out_one))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
911 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
912
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
913 func Test_set_values()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
914 " opt_test.vim is generated from ../optiondefs.h using gen_opt_test.vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
915 if filereadable('opt_test.vim')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
916 source opt_test.vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
917 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
918 throw 'Skipped: opt_test.vim does not exist'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
919 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
920 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
921
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
922 func Test_renderoptions()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
923 " Only do this for Windows Vista and later, fails on Windows XP and earlier.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
924 " Doesn't hurt to do this on a non-Windows system.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
925 if windowsversion() !~ '^[345]\.'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
926 set renderoptions=type:directx
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
927 set rop=type:directx
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
928 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
929 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
930
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
931 func ResetIndentexpr()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
932 set indentexpr=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
933 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
934
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
935 func Test_set_indentexpr()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
936 " this was causing usage of freed memory
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
937 set indentexpr=ResetIndentexpr()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
938 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
939 call feedkeys("i\<c-f>", 'x')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
940 call assert_equal('', &indentexpr)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
941 bwipe!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
942 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
943
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
944 func Test_backupskip()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
945 " Option 'backupskip' may contain several comma-separated path
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
946 " specifications if one or more of the environment variables TMPDIR, TMP,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
947 " or TEMP is defined. To simplify testing, convert the string value into a
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
948 " list.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
949 let bsklist = split(&bsk, ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
950
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
951 if has("mac")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
952 let found = (index(bsklist, '/private/tmp/*') >= 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
953 call assert_true(found, '/private/tmp not in option bsk: ' . &bsk)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
954 elseif has("unix")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
955 let found = (index(bsklist, '/tmp/*') >= 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
956 call assert_true(found, '/tmp not in option bsk: ' . &bsk)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
957 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
958
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
959 " If our test platform is Windows, the path(s) in option bsk will use
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
960 " backslash for the path separator and the components could be in short
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
961 " (8.3) format. As such, we need to replace the backslashes with forward
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
962 " slashes and convert the path components to long format. The expand()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
963 " function will do this but it cannot handle comma-separated paths. This is
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
964 " why bsk was converted from a string into a list of strings above.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
965 "
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
966 " One final complication is that the wildcard "/*" is at the end of each
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
967 " path and so expand() might return a list of matching files. To prevent
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
968 " this, we need to remove the wildcard before calling expand() and then
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
969 " append it afterwards.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
970 if has('win32')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
971 let item_nbr = 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
972 while item_nbr < len(bsklist)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
973 let path_spec = bsklist[item_nbr]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
974 let path_spec = strcharpart(path_spec, 0, strlen(path_spec)-2)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
975 let path_spec = substitute(expand(path_spec), '\\', '/', 'g')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
976 let bsklist[item_nbr] = path_spec . '/*'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
977 let item_nbr += 1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
978 endwhile
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
979 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
980
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
981 " Option bsk will also include these environment variables if defined.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
982 " If they're defined, verify they appear in the option value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
983 for var in ['$TMPDIR', '$TMP', '$TEMP']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
984 if exists(var)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
985 let varvalue = substitute(expand(var), '\\', '/', 'g')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
986 let varvalue = substitute(varvalue, '/$', '', '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
987 let varvalue .= '/*'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
988 let found = (index(bsklist, varvalue) >= 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
989 call assert_true(found, var . ' (' . varvalue . ') not in option bsk: ' . &bsk)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
990 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
991 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
992
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
993 " Duplicates from environment variables should be filtered out (option has
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
994 " P_NODUP). Run this in a separate instance and write v:errors in a file,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
995 " so that we see what happens on startup.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
996 let after =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
997 let bsklist = split(&backupskip, ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
998 call assert_equal(uniq(copy(bsklist)), bsklist)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
999 call writefile(['errors:'] + v:errors, 'Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1000 qall
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1001 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1002 call writefile(after, 'Xafter', 'D')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1003 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1004
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1005 let saveenv = {}
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1006 for var in ['TMPDIR', 'TMP', 'TEMP']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1007 let saveenv[var] = getenv(var)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1008 call setenv(var, '/duplicate/path')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1009 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1010
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1011 exe 'silent !' . cmd
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1012 call assert_equal(['errors:'], readfile('Xtestout'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1013
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1014 " restore environment variables
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1015 for var in ['TMPDIR', 'TMP', 'TEMP']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1016 call setenv(var, saveenv[var])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1017 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1018
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1019 call delete('Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1020
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1021 " Duplicates should be filtered out (option has P_NODUP)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1022 let backupskip = &backupskip
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1023 set backupskip=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1024 set backupskip+=/test/dir
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1025 set backupskip+=/other/dir
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1026 set backupskip+=/test/dir
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1027 call assert_equal('/test/dir,/other/dir', &backupskip)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1028 let &backupskip = backupskip
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1029 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1030
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1031 func Test_buf_copy_winopt()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1032 set hidden
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1033
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1034 " Test copy option from current buffer in window
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1035 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1036 enew
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1037 setlocal numberwidth=5
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1038 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1039 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1040 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1041 call assert_equal(5,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1042 bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1043 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1044
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1045 " Test copy value from window that used to be display the buffer
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1046 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1047 enew
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1048 setlocal numberwidth=6
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1049 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1050 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1051 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1052 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1053 call assert_equal(6,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1054 bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1055
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1056 " Test that if buffer is current, don't use the stale cached value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1057 " from the last time the buffer was displayed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1058 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1059 enew
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1060 setlocal numberwidth=7
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1061 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1062 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1063 setlocal numberwidth=8
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1064 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1065 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1066 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1067 call assert_equal(8,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1068 bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1069
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1070 " Test value is not copied if window already has seen the buffer
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1071 enew
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1072 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1073 setlocal numberwidth=9
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1074 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1075 setlocal numberwidth=10
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1076 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1077 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1078 bnext
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1079 call assert_equal(4,&numberwidth)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1080 bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1081
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1082 set hidden&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1083 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1084
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1085 def Test_split_copy_options()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1086 var values = [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1087 ['cursorbind', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1088 ['fillchars', '"vert:-"', '"' .. &fillchars .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1089 ['list', true, 0],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1090 ['listchars', '"space:-"', '"' .. &listchars .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1091 ['number', true, 0],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1092 ['relativenumber', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1093 ['scrollbind', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1094 ['smoothscroll', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1095 ['virtualedit', '"block"', '"' .. &virtualedit .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1096 ['wincolor', '"Search"', '"' .. &wincolor .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1097 ['wrap', false, true],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1098 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1099 if has('linebreak')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1100 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1101 ['breakindent', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1102 ['breakindentopt', '"min:5"', '"' .. &breakindentopt .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1103 ['linebreak', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1104 ['numberwidth', 7, 4],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1105 ['showbreak', '"++"', '"' .. &showbreak .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1106 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1107 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1108 if has('rightleft')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1109 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1110 ['rightleft', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1111 ['rightleftcmd', '"search"', '"' .. &rightleftcmd .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1112 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1113 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1114 if has('statusline')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1115 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1116 ['statusline', '"---%f---"', '"' .. &statusline .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1117 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1118 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1119 if has('spell')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1120 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1121 ['spell', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1122 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1123 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1124 if has('syntax')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1125 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1126 ['cursorcolumn', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1127 ['cursorline', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1128 ['cursorlineopt', '"screenline"', '"' .. &cursorlineopt .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1129 ['colorcolumn', '"+1"', '"' .. &colorcolumn .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1130 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1131 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1132 if has('diff')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1133 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1134 ['diff', true, false],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1135 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1136 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1137 if has('conceal')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1138 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1139 ['concealcursor', '"nv"', '"' .. &concealcursor .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1140 ['conceallevel', '3', &conceallevel],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1141 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1142 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1143 if has('terminal')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1144 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1145 ['termwinkey', '"<C-X>"', '"' .. &termwinkey .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1146 ['termwinsize', '"10x20"', '"' .. &termwinsize .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1147 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1148 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1149 if has('folding')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1150 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1151 ['foldcolumn', 5, &foldcolumn],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1152 ['foldenable', false, true],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1153 ['foldexpr', '"2 + 3"', '"' .. &foldexpr .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1154 ['foldignore', '"+="', '"' .. &foldignore .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1155 ['foldlevel', 4, &foldlevel],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1156 ['foldmarker', '">>,<<"', '"' .. &foldmarker .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1157 ['foldmethod', '"marker"', '"' .. &foldmethod .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1158 ['foldminlines', 3, &foldminlines],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1159 ['foldnestmax', 17, &foldnestmax],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1160 ['foldtext', '"closed"', '"' .. &foldtext .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1161 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1162 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1163 if has('signs')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1164 values += [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1165 ['signcolumn', '"number"', '"' .. &signcolumn .. '"'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1166 ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1167 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1168
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1169 # set options to non-default value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1170 for item in values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1171 exe $'&l:{item[0]} = {item[1]}'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1172 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1173
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1174 # check values are set in new window
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1175 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1176 for item in values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1177 exe $'assert_equal({item[1]}, &{item[0]}, "{item[0]}")'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1178 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1179
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1180 # restore
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1181 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1182 for item in values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1183 exe $'&l:{item[0]} = {item[2]}'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1184 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1185 enddef
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1186
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1187 func Test_shortmess_F()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1188 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1189 call assert_match('\[No Name\]', execute('file'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1190 set shortmess+=F
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1191 call assert_match('\[No Name\]', execute('file'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1192 call assert_match('^\s*$', execute('file foo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1193 call assert_match('foo', execute('file'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1194 set shortmess-=F
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1195 call assert_match('bar', execute('file bar'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1196 call assert_match('bar', execute('file'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1197 set shortmess&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1198 bwipe
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1199 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1200
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1201 func Test_shortmess_F2()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1202 e file1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1203 e file2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1204 call assert_match('file1', execute('bn', ''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1205 call assert_match('file2', execute('bn', ''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1206 set shortmess+=F
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1207 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1208 call assert_false(test_getvalue('need_fileinfo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1209 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1210 call assert_false('need_fileinfo'->test_getvalue())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1211 set hidden
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1212 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1213 call assert_false(test_getvalue('need_fileinfo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1214 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1215 call assert_false(test_getvalue('need_fileinfo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1216 set nohidden
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1217 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1218 call assert_false(test_getvalue('need_fileinfo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1219 call assert_true(empty(execute('bn', '')))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1220 call assert_false(test_getvalue('need_fileinfo'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1221 set shortmess&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1222 call assert_match('file1', execute('bn', ''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1223 call assert_match('file2', execute('bn', ''))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1224 bwipe
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1225 bwipe
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1226 call assert_fails('call test_getvalue("abc")', 'E475:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1227 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1228
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1229 func Test_local_scrolloff()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1230 set so=5
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1231 set siso=7
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1232 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1233 call assert_equal(5, &so)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1234 setlocal so=3
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1235 call assert_equal(3, &so)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1236 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1237 call assert_equal(5, &so)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1238 wincmd w
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1239 call assert_equal(3, &so)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1240 setlocal so<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1241 call assert_equal(5, &so)
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1242 setglob so=8
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1243 call assert_equal(8, &so)
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1244 call assert_equal(-1, &l:so)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1245 setlocal so=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1246 call assert_equal(0, &so)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1247 setlocal so=-1
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1248 call assert_equal(8, &so)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1249
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1250 call assert_equal(7, &siso)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1251 setlocal siso=3
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1252 call assert_equal(3, &siso)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1253 wincmd w
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1254 call assert_equal(7, &siso)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1255 wincmd w
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1256 call assert_equal(3, &siso)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1257 setlocal siso<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1258 call assert_equal(7, &siso)
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1259 setglob siso=4
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1260 call assert_equal(4, &siso)
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1261 call assert_equal(-1, &l:siso)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1262 setlocal siso=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1263 call assert_equal(0, &siso)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1264 setlocal siso=-1
32679
1b9a29f7fe86 patch 9.0.1670: resetting local option to global value is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1265 call assert_equal(4, &siso)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1266
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1267 close
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1268 set so&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1269 set siso&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1270 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1271
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1272 func Test_writedelay()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1273 CheckFunction reltimefloat
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1274
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1275 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1276 call setline(1, 'empty')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1277 redraw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1278 set writedelay=10
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1279 let start = reltime()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1280 call setline(1, repeat('x', 70))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1281 redraw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1282 let elapsed = reltimefloat(reltime(start))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1283 set writedelay=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1284 " With 'writedelay' set should take at least 30 * 10 msec
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1285 call assert_inrange(30 * 0.01, 999.0, elapsed)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1286
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1287 bwipe!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1288 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1289
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1290 func Test_visualbell()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1291 set belloff=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1292 set visualbell
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1293 call assert_beeps('normal 0h')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1294 set novisualbell
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1295 set belloff=all
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1296 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1297
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1298 " Test for the 'write' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1299 func Test_write()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1300 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1301 call setline(1, ['L1'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1302 set nowrite
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1303 call assert_fails('write Xwrfile', 'E142:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1304 set write
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1305 close!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1306 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1307
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1308 " Test for 'buftype' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1309 func Test_buftype()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1310 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1311 call setline(1, ['L1'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1312 set buftype=nowrite
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1313 call assert_fails('write', 'E382:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1314
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1315 for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'terminal', 'prompt', 'popup']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1316 exe 'set buftype=' .. val
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1317 call writefile(['something'], 'XBuftype', 'D')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1318 call assert_fails('write XBuftype', 'E13:', 'with buftype=' .. val)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1319 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1320
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1321 bwipe!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1322 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1323
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1324 " Test for the 'rightleftcmd' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1325 func Test_rightleftcmd()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1326 CheckFeature rightleft
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1327 set rightleft
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1328
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1329 let g:l = []
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1330 func AddPos()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1331 call add(g:l, screencol())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1332 return ''
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1333 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1334 cmap <expr> <F2> AddPos()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1335
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1336 set rightleftcmd=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1337 call feedkeys("/\<F2>abc\<Right>\<F2>\<Left>\<Left>\<F2>" ..
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1338 \ "\<Right>\<F2>\<Esc>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1339 call assert_equal([2, 5, 3, 4], g:l)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1340
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1341 let g:l = []
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1342 set rightleftcmd=search
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1343 call feedkeys("/\<F2>abc\<Left>\<F2>\<Right>\<Right>\<F2>" ..
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1344 \ "\<Left>\<F2>\<Esc>", 'xt')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1345 call assert_equal([&co - 1, &co - 4, &co - 2, &co - 3], g:l)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1346
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1347 cunmap <F2>
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1348 unlet g:l
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1349 set rightleftcmd&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1350 set rightleft&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1351 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1352
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1353 " Test for the 'debug' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1354 func Test_debug_option()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1355 " redraw to avoid matching previous messages
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1356 redraw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1357 set debug=beep
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1358 exe "normal \<C-c>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1359 call assert_equal('Beep!', Screenline(&lines))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1360 call assert_equal('line 4:', Screenline(&lines - 1))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1361 " also check a line above, with a certain window width the colon is there
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1362 call assert_match('Test_debug_option:$',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1363 \ Screenline(&lines - 3) .. Screenline(&lines - 2))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1364 set debug&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1365 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1366
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1367 " Test for the default CDPATH option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1368 func Test_opt_default_cdpath()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1369 let after =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1370 call assert_equal(',/path/to/dir1,/path/to/dir2', &cdpath)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1371 call writefile(v:errors, 'Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1372 qall
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1373 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1374 if has('unix')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1375 let $CDPATH='/path/to/dir1:/path/to/dir2'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1376 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1377 let $CDPATH='/path/to/dir1;/path/to/dir2'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1378 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1379 if RunVim([], after, '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1380 call assert_equal([], readfile('Xtestout'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1381 call delete('Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1382 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1383 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1384
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1385 " Test for setting keycodes using set
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1386 func Test_opt_set_keycode()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1387 call assert_fails('set <t_k1=l', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1388 call assert_fails('set <Home=l', 'E474:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1389 set <t_k9>=abcd
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1390 call assert_equal('abcd', &t_k9)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1391 set <t_k9>&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1392 set <F9>=xyz
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1393 call assert_equal('xyz', &t_k9)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1394 set <t_k9>&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1395
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1396 " should we test all of them?
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1397 set t_Ce=testCe
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1398 set t_Cs=testCs
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1399 set t_Us=testUs
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1400 set t_ds=testds
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1401 set t_Ds=testDs
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1402 call assert_equal('testCe', &t_Ce)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1403 call assert_equal('testCs', &t_Cs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1404 call assert_equal('testUs', &t_Us)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1405 call assert_equal('testds', &t_ds)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1406 call assert_equal('testDs', &t_Ds)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1407 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1408
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1409 " Test for changing options in a sandbox
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1410 func Test_opt_sandbox()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1411 for opt in ['backupdir', 'cdpath', 'exrc']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1412 call assert_fails('sandbox set ' .. opt .. '?', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1413 call assert_fails('sandbox let &' .. opt .. ' = 1', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1414 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1415 call assert_fails('sandbox let &modelineexpr = 1', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1416 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1417
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1418 " Test for setting an option with local value to global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1419 func Test_opt_local_to_global()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1420 setglobal equalprg=gprg
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1421 setlocal equalprg=lprg
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1422 call assert_equal('gprg', &g:equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1423 call assert_equal('lprg', &l:equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1424 call assert_equal('lprg', &equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1425 set equalprg<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1426 call assert_equal('', &l:equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1427 call assert_equal('gprg', &equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1428 setglobal equalprg=gnewprg
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1429 setlocal equalprg=lnewprg
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1430 setlocal equalprg<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1431 call assert_equal('gnewprg', &l:equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1432 call assert_equal('gnewprg', &equalprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1433 set equalprg&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1434
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1435 " Test for setting the global/local value of a boolean option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1436 setglobal autoread
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1437 setlocal noautoread
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1438 call assert_false(&autoread)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1439 set autoread<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1440 call assert_true(&autoread)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1441 setglobal noautoread
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1442 setlocal autoread
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1443 setlocal autoread<
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1444 call assert_false(&autoread)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1445 set autoread&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1446 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1447
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1448 func Test_set_in_sandbox()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1449 " Some boolean options cannot be set in sandbox, some can.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1450 call assert_fails('sandbox set modelineexpr', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1451 sandbox set number
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1452 call assert_true(&number)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1453 set number&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1454
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1455 " Some boolean options cannot be set in sandbox, some can.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1456 if has('python') || has('python3')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1457 call assert_fails('sandbox set pyxversion=3', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1458 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1459 sandbox set tabstop=4
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1460 call assert_equal(4, &tabstop)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1461 set tabstop&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1462
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1463 " Some string options cannot be set in sandbox, some can.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1464 call assert_fails('sandbox set backupdir=/tmp', 'E48:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1465 sandbox set filetype=perl
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1466 call assert_equal('perl', &filetype)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1467 set filetype&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1468 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1469
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1470 " Test for incrementing, decrementing and multiplying a number option value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1471 func Test_opt_num_op()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1472 set shiftwidth=4
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1473 set sw+=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1474 call assert_equal(6, &sw)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1475 set sw-=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1476 call assert_equal(4, &sw)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1477 set sw^=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1478 call assert_equal(8, &sw)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1479 set shiftwidth&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1480 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1481
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1482 " Test for setting option values using v:false and v:true
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1483 func Test_opt_boolean()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1484 set number&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1485 set number
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1486 call assert_equal(1, &nu)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1487 set nonu
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1488 call assert_equal(0, &nu)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1489 let &nu = v:true
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1490 call assert_equal(1, &nu)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1491 let &nu = v:false
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1492 call assert_equal(0, &nu)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1493 set number&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1494 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1495
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1496 " Test for the 'window' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1497 func Test_window_opt()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1498 " Needs only one open widow
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1499 %bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1500 call setline(1, range(1, 8))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1501 set window=5
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1502 exe "normal \<C-F>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1503 call assert_equal(4, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1504 exe "normal \<C-F>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1505 call assert_equal(7, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1506 exe "normal \<C-F>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1507 call assert_equal(8, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1508 exe "normal \<C-B>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1509 call assert_equal(5, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1510 exe "normal \<C-B>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1511 call assert_equal(2, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1512 exe "normal \<C-B>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1513 call assert_equal(1, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1514 set window=1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1515 exe "normal gg\<C-F>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1516 call assert_equal(2, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1517 exe "normal \<C-F>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1518 call assert_equal(3, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1519 exe "normal \<C-B>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1520 call assert_equal(2, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1521 exe "normal \<C-B>"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1522 call assert_equal(1, line('w0'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1523 enew!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1524 set window&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1525 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1526
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1527 " Test for the 'winminheight' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1528 func Test_opt_winminheight()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1529 only!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1530 let &winheight = &lines + 4
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1531 call assert_fails('let &winminheight = &lines + 2', 'E36:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1532 call assert_true(&winminheight <= &lines)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1533 set winminheight&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1534 set winheight&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1535 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1536
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1537 func Test_opt_winminheight_term()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1538 CheckRunVimInTerminal
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1539
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1540 " The tabline should be taken into account.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1541 let lines =<< trim END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1542 set wmh=0 stal=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1543 below sp | wincmd _
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1544 below sp | wincmd _
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1545 below sp | wincmd _
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1546 below sp
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1547 END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1548 call writefile(lines, 'Xwinminheight', 'D')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1549 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1550 call term_sendkeys(buf, ":set wmh=1\n")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1551 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1552
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1553 call StopVimInTerminal(buf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1554 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1555
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1556 func Test_opt_winminheight_term_tabs()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1557 CheckRunVimInTerminal
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1558
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1559 " The tabline should be taken into account.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1560 let lines =<< trim END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1561 set wmh=0 stal=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1562 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1563 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1564 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1565 split
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1566 tabnew
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1567 END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1568 call writefile(lines, 'Xwinminheight', 'D')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1569 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1570 call term_sendkeys(buf, ":set wmh=1\n")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1571 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1572
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1573 call StopVimInTerminal(buf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1574 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1575
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1576 " Test for the 'winminwidth' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1577 func Test_opt_winminwidth()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1578 only!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1579 let &winwidth = &columns + 4
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1580 call assert_fails('let &winminwidth = &columns + 2', 'E36:')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1581 call assert_true(&winminwidth <= &columns)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1582 set winminwidth&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1583 set winwidth&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1584 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1585
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1586 " Test for setting option value containing spaces with isfname+=32
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1587 func Test_isfname_with_options()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1588 set isfname+=32
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1589 setlocal keywordprg=:term\ help.exe
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1590 call assert_equal(':term help.exe', &keywordprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1591 set isfname&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1592 setlocal keywordprg&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1593 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1594
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1595 " Test that resetting laststatus does change scroll option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1596 func Test_opt_reset_scroll()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1597 CheckRunVimInTerminal
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1598 let vimrc =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1599 set scroll=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1600 set laststatus=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1601 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1602 call writefile(vimrc, 'Xscroll', 'D')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1603 let buf = RunVimInTerminal('-S Xscroll', {'rows': 16, 'cols': 45})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1604 call term_sendkeys(buf, ":verbose set scroll?\n")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1605 call WaitForAssert({-> assert_match('Last set.*window size', term_getline(buf, 15))})
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1606 call assert_match('^\s*scroll=7$', term_getline(buf, 14))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1607
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1608 " clean up
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1609 call StopVimInTerminal(buf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1610 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1611
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1612 " Check that VIM_POSIX env variable influences default value of 'cpo' and 'shm'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1613 func Test_VIM_POSIX()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1614 let saved_VIM_POSIX = getenv("VIM_POSIX")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1615
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1616 call setenv('VIM_POSIX', "1")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1617 let after =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1618 call writefile([&cpo, &shm], 'X_VIM_POSIX')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1619 qall
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1620 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1621 if RunVim([], after, '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1622 call assert_equal(['aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>#{|&/\.;',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1623 \ 'AS'], readfile('X_VIM_POSIX'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1624 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1625
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1626 call setenv('VIM_POSIX', v:null)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1627 let after =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1628 call writefile([&cpo, &shm], 'X_VIM_POSIX')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1629 qall
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1630 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1631 if RunVim([], after, '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1632 call assert_equal(['aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1633 \ 'S'], readfile('X_VIM_POSIX'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1634 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1635
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1636 call delete('X_VIM_POSIX')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1637 call setenv('VIM_POSIX', saved_VIM_POSIX)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1638 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1639
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1640 " Test for setting an option to a Vi or Vim default
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1641 func Test_opt_default()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1642 set formatoptions&vi
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1643 call assert_equal('vt', &formatoptions)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1644 set formatoptions&vim
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1645 call assert_equal('tcq', &formatoptions)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1646
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1647 call assert_equal('ucs-bom,utf-8,default,latin1', &fencs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1648 set fencs=latin1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1649 set fencs&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1650 call assert_equal('ucs-bom,utf-8,default,latin1', &fencs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1651 set fencs=latin1
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1652 set all&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1653 call assert_equal('ucs-bom,utf-8,default,latin1', &fencs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1654 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1655
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1656 " Test for the 'cmdheight' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1657 func Test_cmdheight()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1658 %bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1659 let ht = &lines
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1660 set cmdheight=9999
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1661 call assert_equal(1, winheight(0))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1662 call assert_equal(ht - 1, &cmdheight)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1663 set cmdheight&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1664 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1665
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1666 " To specify a control character as an option value, '^' can be used
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1667 func Test_opt_control_char()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1668 set wildchar=^v
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1669 call assert_equal("\<C-V>", nr2char(&wildchar))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1670 set wildcharm=^r
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1671 call assert_equal("\<C-R>", nr2char(&wildcharm))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1672 " Bug: This doesn't work for the 'cedit' and 'termwinkey' options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1673 set wildchar& wildcharm&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1674 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1675
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1676 " Test for the 'errorbells' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1677 func Test_opt_errorbells()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1678 set errorbells
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1679 call assert_beeps('s/a1b2/x1y2/')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1680 set noerrorbells
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1681 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1682
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1683 func Test_opt_scrolljump()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1684 help
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1685 resize 10
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1686
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1687 " Test with positive 'scrolljump'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1688 set scrolljump=2
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1689 norm! Lj
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1690 call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1691 \ 'topline':3, 'coladd':0, 'skipcol':0, 'curswant':0},
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1692 \ winsaveview())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1693
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1694 " Test with negative 'scrolljump' (percentage of window height).
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1695 set scrolljump=-40
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1696 norm! ggLj
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1697 call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1698 \ 'topline':5, 'coladd':0, 'skipcol':0, 'curswant':0},
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1699 \ winsaveview())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1700
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1701 set scrolljump&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1702 bw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1703 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1704
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1705 " Test for the 'cdhome' option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1706 func Test_opt_cdhome()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1707 if has('unix') || has('vms')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1708 throw 'Skipped: only works on non-Unix'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1709 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1710
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1711 set cdhome&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1712 call assert_equal(0, &cdhome)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1713 set cdhome
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1714
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1715 " This paragraph is copied from Test_cd_no_arg().
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1716 let path = getcwd()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1717 cd
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1718 call assert_equal($HOME, getcwd())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1719 call assert_notequal(path, getcwd())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1720 exe 'cd ' .. fnameescape(path)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1721 call assert_equal(path, getcwd())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1722
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1723 set cdhome&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1724 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1725
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1726 func Test_set_completion_fuzzy()
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1727 CheckOption termguicolors
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1728
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1729 " Test default option completion
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1730 set wildoptions=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1731 call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1732 call assert_equal('"set termguicolors', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1733
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1734 call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1735 call assert_equal('"set notermguicolors', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1736
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1737 " Test fuzzy option completion
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1738 set wildoptions=fuzzy
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1739 call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1740 call assert_equal('"set termguicolors termencoding', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1741
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1742 call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1743 call assert_equal('"set notermguicolors', @:)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1744
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1745 set wildoptions=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1746 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1747
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1748 func Test_switchbuf_reset()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1749 set switchbuf=useopen
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1750 sblast
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1751 call assert_equal(1, winnr('$'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1752 set all&
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1753 call assert_equal('', &switchbuf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1754 sblast
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1755 call assert_equal(2, winnr('$'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1756 only!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1757 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1758
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1759 " :set empty string for global 'keywordprg' falls back to ":help"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1760 func Test_keywordprg_empty()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1761 let k = &keywordprg
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1762 set keywordprg=man
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1763 call assert_equal('man', &keywordprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1764 set keywordprg=
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1765 call assert_equal(':help', &keywordprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1766 set keywordprg=man
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1767 call assert_equal('man', &keywordprg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1768 call assert_equal("\n keywordprg=:help", execute('set kp= kp?'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1769 let &keywordprg = k
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1770 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1771
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1772 " check that the very first buffer created does not have 'endoffile' set
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1773 func Test_endoffile_default()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1774 let after =<< trim [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1775 call writefile([execute('set eof?')], 'Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1776 qall!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1777 [CODE]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1778 if RunVim([], after, '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1779 call assert_equal(["\nnoendoffile"], readfile('Xtestout'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1780 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1781 call delete('Xtestout')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1782 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1783
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1784 " Test for setting the 'lines' and 'columns' options to a minimum value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1785 func Test_set_min_lines_columns()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1786 let save_lines = &lines
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1787 let save_columns = &columns
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1788
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1789 let after =<< trim END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1790 set nomore
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1791 let msg = []
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1792 let v:errmsg = ''
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1793 silent! let &columns=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1794 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1795 silent! set columns=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1796 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1797 silent! call setbufvar('', '&columns', 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1798 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1799 "call writefile(msg, 'XResultsetminlines')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1800 silent! let &lines=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1801 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1802 silent! set lines=0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1803 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1804 silent! call setbufvar('', '&lines', 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1805 call add(msg, v:errmsg)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1806 call writefile(msg, 'XResultsetminlines')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1807 qall!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1808 END
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1809 if RunVim([], after, '')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1810 call assert_equal(['E594: Need at least 12 columns',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1811 \ 'E594: Need at least 12 columns: columns=0',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1812 \ 'E594: Need at least 12 columns',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1813 \ 'E593: Need at least 2 lines',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1814 \ 'E593: Need at least 2 lines: lines=0',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1815 \ 'E593: Need at least 2 lines',], readfile('XResultsetminlines'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1816 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1817
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1818 call delete('XResultsetminlines')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1819 let &lines = save_lines
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1820 let &columns = save_columns
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1821 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1822
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1823 " Test for reverting a string option value if the new value is invalid.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1824 func Test_string_option_revert_on_failure()
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1825 new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1826 let optlist = [
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1827 \ ['ambiwidth', 'double', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1828 \ ['background', 'dark', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1829 \ ['backspace', 'eol', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1830 \ ['backupcopy', 'no', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1831 \ ['belloff', 'showmatch', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1832 \ ['breakindentopt', 'min:10', 'list'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1833 \ ['bufhidden', 'wipe', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1834 \ ['buftype', 'nowrite', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1835 \ ['casemap', 'keepascii', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1836 \ ['cedit', "\<C-Y>", 'z'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1837 \ ['colorcolumn', '10', 'z'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1838 \ ['commentstring', '#%s', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1839 \ ['complete', '.,t', 'a'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1840 \ ['completefunc', 'MyCmplFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1841 \ ['completeopt', 'popup', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1842 \ ['completepopup', 'width:20', 'border'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1843 \ ['concealcursor', 'v', 'xyz'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1844 \ ['cpoptions', 'HJ', '~'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1845 \ ['cryptmethod', 'zip', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1846 \ ['cursorlineopt', 'screenline', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1847 \ ['debug', 'throw', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1848 \ ['diffopt', 'iwhite', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1849 \ ['display', 'uhex', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1850 \ ['eadirection', 'hor', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1851 \ ['encoding', 'utf-8', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1852 \ ['eventignore', 'TextYankPost', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1853 \ ['fileencoding', 'utf-8', 'a123,'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1854 \ ['fileformat', 'mac', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1855 \ ['fileformats', 'mac', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1856 \ ['filetype', 'abc', 'a^b'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1857 \ ['fillchars', 'diff:~', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1858 \ ['foldclose', 'all', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1859 \ ['foldmarker', '[[[,]]]', '[[['],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1860 \ ['foldmethod', 'marker', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1861 \ ['foldopen', 'percent', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1862 \ ['formatoptions', 'an', '*'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1863 \ ['guicursor', 'n-v-c:block-Cursor/lCursor', 'n-v-c'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1864 \ ['helplang', 'en', 'a'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1865 \ ['highlight', '!:CursorColumn', '8:'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1866 \ ['keymodel', 'stopsel', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1867 \ ['keyprotocol', 'kitty:kitty', 'kitty:'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1868 \ ['lispoptions', 'expr:1', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1869 \ ['listchars', 'tab:->', 'tab:'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1870 \ ['matchpairs', '<:>', '<:'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1871 \ ['mkspellmem', '100000,1000,100', '100000'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1872 \ ['mouse', 'nvi', 'z'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1873 \ ['mousemodel', 'extend', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1874 \ ['nrformats', 'alpha', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1875 \ ['omnifunc', 'MyOmniFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1876 \ ['operatorfunc', 'MyOpFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1877 \ ['previewpopup', 'width:20', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1878 \ ['printoptions', 'paper:A4', 'a123:'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1879 \ ['quickfixtextfunc', 'MyQfFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1880 \ ['rulerformat', '%l', '%['],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1881 \ ['scrollopt', 'hor,jump', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1882 \ ['selection', 'exclusive', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1883 \ ['selectmode', 'cmd', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1884 \ ['sessionoptions', 'options', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1885 \ ['shortmess', 'w', '2'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1886 \ ['showbreak', '>>', "\x01"],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1887 \ ['showcmdloc', 'statusline', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1888 \ ['signcolumn', 'no', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1889 \ ['spellcapcheck', '[.?!]\+', '%\{'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1890 \ ['spellfile', 'MySpell.en.add', "\x01"],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1891 \ ['spelllang', 'en', "#"],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1892 \ ['spelloptions', 'camel', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1893 \ ['spellsuggest', 'double', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1894 \ ['splitkeep', 'topline', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1895 \ ['statusline', '%f', '%['],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1896 \ ['swapsync', 'sync', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1897 \ ['switchbuf', 'usetab', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1898 \ ['syntax', 'abc', 'a^b'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1899 \ ['tabline', '%f', '%['],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1900 \ ['tagcase', 'ignore', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1901 \ ['tagfunc', 'MyTagFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1902 \ ['thesaurusfunc', 'MyThesaurusFunc', '1a-'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1903 \ ['viewoptions', 'options', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1904 \ ['virtualedit', 'onemore', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1905 \ ['whichwrap', '<,>', '{,}'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1906 \ ['wildmode', 'list', 'a123'],
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1907 \ ['wildoptions', 'pum', 'a123']
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1908 \ ]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1909 if has('gui')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1910 call add(optlist, ['browsedir', 'buffer', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1911 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1912 if has('clipboard_working')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1913 call add(optlist, ['clipboard', 'unnamed', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1914 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1915 if has('win32')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1916 call add(optlist, ['completeslash', 'slash', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1917 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1918 if has('cscope')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1919 call add(optlist, ['cscopequickfix', 't-', 'z-'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1920 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1921 if !has('win32')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1922 call add(optlist, ['imactivatefunc', 'MyActFunc', '1a-'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1923 call add(optlist, ['imstatusfunc', 'MyStatusFunc', '1a-'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1924 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1925 if has('keymap')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1926 call add(optlist, ['keymap', 'greek', '[]'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1927 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1928 if has('mouseshape')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1929 call add(optlist, ['mouseshape', 'm:no', 'a123:'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1930 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1931 if has('win32') && has('gui')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1932 call add(optlist, ['renderoptions', 'type:directx', 'type:directx,a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1933 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1934 if has('rightleft')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1935 call add(optlist, ['rightleftcmd', 'search', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1936 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1937 if has('terminal')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1938 call add(optlist, ['termwinkey', '<C-L>', '<C'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1939 call add(optlist, ['termwinsize', '24x80', '100'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1940 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1941 if has('win32') && has('terminal')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1942 call add(optlist, ['termwintype', 'winpty', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1943 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1944 if exists('+toolbar')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1945 call add(optlist, ['toolbar', 'text', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1946 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1947 if exists('+toolbariconsize')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1948 call add(optlist, ['toolbariconsize', 'medium', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1949 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1950 if exists('+ttymouse') && !has('gui')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1951 call add(optlist, ['ttymouse', 'xterm', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1952 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1953 if exists('+vartabs')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1954 call add(optlist, ['varsofttabstop', '12', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1955 call add(optlist, ['vartabstop', '4,20', '4,'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1956 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1957 if exists('+winaltkeys')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1958 call add(optlist, ['winaltkeys', 'no', 'a123'])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1959 endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1960 for opt in optlist
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1961 exe $"let save_opt = &{opt[0]}"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1962 try
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1963 exe $"let &{opt[0]} = '{opt[1]}'"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1964 catch
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1965 call assert_report($"Caught {v:exception} with {opt->string()}")
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1966 endtry
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1967 call assert_fails($"let &{opt[0]} = '{opt[2]}'", '', opt[0])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1968 call assert_equal(opt[1], eval($"&{opt[0]}"), opt[0])
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1969 exe $"let &{opt[0]} = save_opt"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1970 endfor
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1971 bw!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1972 endfunc
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1973
32788
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1974 func Test_set_option_window_global_local()
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1975 new Xbuffer1
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1976 let [ _gso, _lso ] = [ &g:scrolloff, &l:scrolloff ]
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1977 setlocal scrolloff=2
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1978 setglobal scrolloff=3
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1979 setl modified
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1980 " A new buffer has its own window-local options
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1981 hide enew
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1982 call assert_equal(-1, &l:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1983 call assert_equal(3, &g:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1984 " A new window opened with its own buffer-local options
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1985 new
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1986 call assert_equal(-1, &l:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1987 call assert_equal(3, &g:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1988 " Re-open Xbuffer1 and it should use
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1989 " the previous set window-local options
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1990 b Xbuffer1
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1991 call assert_equal(2, &l:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1992 call assert_equal(3, &g:scrolloff)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1993 bw!
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1994 bw!
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1995 let &g:scrolloff = _gso
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1996 endfunc
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1997
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1998 func GetGlobalLocalWindowOptions()
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
1999 new
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2000 sil! r $VIMRUNTIME/doc/options.txt
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2001 " Filter for global or local to window
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2002 v/^'.*'.*\n.*global or local to window |global-local/d
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2003 " get option value and type
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2004 sil %s/^'\([^']*\)'.*'\s\+\(\w\+\)\s\+(default \%(\(".*"\|\d\+\|empty\)\).*/\1 \2 \3/g
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2005 sil %s/empty/""/g
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2006 " split the result
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2007 let result=getline(1,'$')->map({_, val -> split(val, ' ')})
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2008 bw!
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2009 return result
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2010 endfunc
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2011
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2012 func Test_set_option_window_global_local_all()
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2013 new Xbuffer2
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2014
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2015 let optionlist = GetGlobalLocalWindowOptions()
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2016 for [opt, type, default] in optionlist
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2017 let _old = eval('&g:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2018 if type == 'string'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2019 if opt == 'fillchars'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2020 exe 'setl ' .. opt .. '=vert:+'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2021 exe 'setg ' .. opt .. '=vert:+,fold:+'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2022 elseif opt == 'listchars'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2023 exe 'setl ' .. opt .. '=tab:>>'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2024 exe 'setg ' .. opt .. '=tab:++'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2025 elseif opt == 'virtualedit'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2026 exe 'setl ' .. opt .. '=all'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2027 exe 'setg ' .. opt .. '=block'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2028 else
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2029 exe 'setl ' .. opt .. '=Local'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2030 exe 'setg ' .. opt .. '=Global'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2031 endif
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2032 elseif type == 'number'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2033 exe 'setl ' .. opt .. '=5'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2034 exe 'setg ' .. opt .. '=10'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2035 endif
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2036 setl modified
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2037 hide enew
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2038 if type == 'string'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2039 call assert_equal('', eval('&l:' .. opt))
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2040 if opt == 'fillchars'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2041 call assert_equal('vert:+,fold:+', eval('&g:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2042 elseif opt == 'listchars'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2043 call assert_equal('tab:++', eval('&g:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2044 elseif opt == 'virtualedit'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2045 call assert_equal('block', eval('&g:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2046 else
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2047 call assert_equal('Global', eval('&g:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2048 endif
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2049 elseif type == 'number'
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2050 call assert_equal(-1, eval('&l:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2051 call assert_equal(10, eval('&g:' .. opt), 'option:' .. opt)
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2052 endif
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2053 bw!
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2054 exe 'let &g:' .. opt .. '=' .. default
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2055 endfor
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2056 bw!
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2057 endfunc
80152cf7ce63 patch 9.0.1710: scrolloff options work slightly different
Christian Brabandt <cb@256bit.org>
parents: 32679
diff changeset
2058
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2059 func Test_paste_depending_options()
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2060 " setting the paste option, resets all dependent options
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2061 " and will be reported correctly using :verbose set <option>?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2062 let lines =<< trim [CODE]
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2063 " set paste test
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2064 set autoindent
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2065 set expandtab
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2066 " disabled, because depends on compiled feature set
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2067 " set hkmap
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2068 " set revins
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2069 " set varsofttabstop=8,32,8
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2070 set ruler
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2071 set showmatch
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2072 set smarttab
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2073 set softtabstop=4
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2074 set textwidth=80
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2075 set wrapmargin=10
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2076
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2077 source Xvimrc_paste2
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2078
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2079 redir > Xoutput_paste
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2080 verbose set expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2081 verbose setg expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2082 verbose setl expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2083 redir END
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2084
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2085 qall!
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2086 [CODE]
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2087
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2088 call writefile(lines, 'Xvimrc_paste', 'D')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2089 call writefile(['set paste'], 'Xvimrc_paste2', 'D')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2090 if !RunVim([], lines, '--clean')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2091 return
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2092 endif
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2093
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2094 let result = readfile('Xoutput_paste')->filter('!empty(v:val)')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2095 call assert_equal('noexpandtab', result[0])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2096 call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[1])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2097 call assert_equal('noexpandtab', result[2])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2098 call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[3])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2099 call assert_equal('noexpandtab', result[4])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2100 call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[5])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2101
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2102 call delete('Xoutput_paste')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2103 endfunc
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2104
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2105 func Test_binary_depending_options()
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2106 " setting the paste option, resets all dependent options
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2107 " and will be reported correctly using :verbose set <option>?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2108 let lines =<< trim [CODE]
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2109 " set binary test
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2110 set expandtab
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2111
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2112 source Xvimrc_bin2
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2113
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2114 redir > Xoutput_bin
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2115 verbose set expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2116 verbose setg expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2117 verbose setl expandtab?
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2118 redir END
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2119
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2120 qall!
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2121 [CODE]
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2122
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2123 call writefile(lines, 'Xvimrc_bin', 'D')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2124 call writefile(['set binary'], 'Xvimrc_bin2', 'D')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2125 if !RunVim([], lines, '--clean')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2126 return
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2127 endif
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2128
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2129 let result = readfile('Xoutput_bin')->filter('!empty(v:val)')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2130 call assert_equal('noexpandtab', result[0])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2131 call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[1])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2132 call assert_equal('noexpandtab', result[2])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2133 call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[3])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2134 call assert_equal('noexpandtab', result[4])
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32962
diff changeset
2135 call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[5])
32962
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2136
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2137 call delete('Xoutput_bin')
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2138 endfunc
7771cb060685 patch 9.0.1781: Problems when setting bin/paste option
Christian Brabandt <cb@256bit.org>
parents: 32788
diff changeset
2139
33397
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2140 func Test_set_keyprotocol()
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2141 CheckNotGui
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2142
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2143 let term = &term
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2144 set term=ansi
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2145 call assert_equal('', &t_TI)
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2146
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2147 " Setting 'keyprotocol' should affect terminal codes without needing to
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2148 " reset 'term'
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2149 set keyprotocol+=ansi:kitty
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2150 call assert_equal("\<Esc>[=1;1u", &t_TI)
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2151 let &term = term
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2152 endfunc
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33012
diff changeset
2153
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2154 " vim: shiftwidth=2 sts=2 expandtab