1" Script to generate testdir/opt_test.vim from option.c 2 3set cpo=&vim 4 5" Only do this when build with the +eval feature. 6if 1 7 8set nomore 9 10" The terminal size is restored at the end. 11" Clear out t_WS, we don't want to resize the actual terminal. 12let script = [ 13 \ 'let save_columns = &columns', 14 \ 'let save_lines = &lines', 15 \ 'let save_term = &term', 16 \ 'set t_WS=', 17 \ ] 18 19/#define p_term 20let end = line('.') 21 22" font name that works everywhere (hopefully) 23let fontname = has('win32') ? 'fixedsys' : 'fixed' 24 25" Two lists with values: values that work and values that fail. 26" When not listed, "othernum" or "otherstring" is used. 27let test_values = { 28 \ 'cmdheight': [[1, 2, 10], [-1, 0]], 29 \ 'cmdwinheight': [[1, 2, 10], [-1, 0]], 30 \ 'columns': [[12, 80], [-1, 0, 10]], 31 \ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]], 32 \ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]], 33 \ 'helpheight': [[0, 10, 100], [-1]], 34 \ 'history': [[0, 1, 100], [-1, 10001]], 35 \ 'iminsert': [[0, 1], [-1, 3, 999]], 36 \ 'imsearch': [[-1, 0, 1], [-2, 3, 999]], 37 \ 'imstyle': [[0, 1], [-1, 2, 999]], 38 \ 'lines': [[2, 24], [-1, 0, 1]], 39 \ 'linespace': [[0, 2, 4], ['']], 40 \ 'numberwidth': [[1, 4, 8, 10], [-1, 0, 11]], 41 \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]], 42 \ 'report': [[0, 1, 2, 9999], [-1]], 43 \ 'scroll': [[0, 1, 2, 20], [-1]], 44 \ 'scrolljump': [[-50, -1, 0, 1, 2, 20], [999]], 45 \ 'scrolloff': [[0, 1, 2, 20], [-1]], 46 \ 'shiftwidth': [[0, 1, 8, 999], [-1]], 47 \ 'sidescroll': [[0, 1, 8, 999], [-1]], 48 \ 'sidescrolloff': [[0, 1, 8, 999], [-1]], 49 \ 'tabstop': [[1, 4, 8, 12], [-1, 0]], 50 \ 'textwidth': [[0, 1, 8, 99], [-1]], 51 \ 'timeoutlen': [[0, 8, 99999], [-1]], 52 \ 'titlelen': [[0, 1, 8, 9999], [-1]], 53 \ 'updatecount': [[0, 1, 8, 9999], [-1]], 54 \ 'updatetime': [[0, 1, 8, 9999], [-1]], 55 \ 'verbose': [[-1, 0, 1, 8, 9999], []], 56 \ 'wildcharm': [[-1, 0, 100], []], 57 \ 'winheight': [[1, 10, 999], [-1, 0]], 58 \ 'winminheight': [[0, 1], [-1]], 59 \ 'winminwidth': [[0, 1, 10], [-1]], 60 \ 'winwidth': [[1, 10, 999], [-1, 0]], 61 \ 62 \ 'ambiwidth': [['', 'single'], ['xxx']], 63 \ 'background': [['', 'light', 'dark'], ['xxx']], 64 \ 'backspace': [[0, 2, '', 'eol', 'eol,start'], ['xxx']], 65 \ 'backupcopy': [['yes', 'auto'], ['', 'xxx', 'yes,no']], 66 \ 'backupext': [['xxx'], ['']], 67 \ 'belloff': [['', 'all', 'copy,error'], ['xxx']], 68 \ 'breakindentopt': [['', 'min:3', 'sbr'], ['xxx', 'min', 'min:x']], 69 \ 'browsedir': [['', 'last', '/'], ['xxx']], 70 \ 'bufhidden': [['', 'hide', 'wipe'], ['xxx', 'hide,wipe']], 71 \ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']], 72 \ 'casemap': [['', 'internal'], ['xxx']], 73 \ 'cedit': [['', '\<Esc>'], ['xxx', 'f']], 74 \ 'clipboard': [['', 'unnamed', 'autoselect,unnamed'], ['xxx']], 75 \ 'colorcolumn': [['', '8', '+2'], ['xxx']], 76 \ 'comments': [['', 'b:#'], ['xxx']], 77 \ 'commentstring': [['', '/*%s*/'], ['xxx']], 78 \ 'complete': [['', 'w,b'], ['xxx']], 79 \ 'concealcursor': [['', 'n', 'nvic'], ['xxx']], 80 \ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']], 81 \ 'cryptmethod': [['', 'zip'], ['xxx']], 82 \ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']], 83 \ 'debug': [['', 'msg', 'msg', 'beep'], ['xxx']], 84 \ 'diffopt': [['', 'filler', 'icase,iwhite'], ['xxx', 'algorithm:xxx', 'algorithm:']], 85 \ 'display': [['', 'lastline', 'lastline,uhex'], ['xxx']], 86 \ 'eadirection': [['', 'both', 'ver'], ['xxx', 'ver,hor']], 87 \ 'encoding': [['latin1'], ['xxx', '']], 88 \ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter'], ['xxx']], 89 \ 'fileencoding': [['', 'latin1', 'xxx'], []], 90 \ 'fileformat': [['', 'dos', 'unix'], ['xxx']], 91 \ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']], 92 \ 'fillchars': [['', 'vert:x'], ['xxx']], 93 \ 'foldclose': [['', 'all'], ['xxx']], 94 \ 'foldmethod': [['manual', 'indent'], ['', 'xxx', 'expr,diff']], 95 \ 'foldopen': [['', 'all', 'hor,jump'], ['xxx']], 96 \ 'foldmarker': [['((,))'], ['', 'xxx']], 97 \ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']], 98 \ 'guicursor': [['', 'n:block-Cursor'], ['xxx']], 99 \ 'guifont': [['', fontname], []], 100 \ 'guifontwide': [['', fontname], []], 101 \ 'guifontset': [['', fontname], []], 102 \ 'helplang': [['', 'de', 'de,it'], ['xxx']], 103 \ 'highlight': [['', 'e:Error'], ['xxx']], 104 \ 'imactivatekey': [['', 'S-space'], ['xxx']], 105 \ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']], 106 \ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']], 107 \ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']], 108 \ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']], 109 \ 'keymap': [['', 'accents'], ['xxx']], 110 \ 'keymodel': [['', 'startsel', 'startsel,stopsel'], ['xxx']], 111 \ 'langmap': [['', 'xX', 'aA,bB'], ['xxx']], 112 \ 'listchars': [['', 'eol:x', 'eol:x,space:y'], ['xxx']], 113 \ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']], 114 \ 'mkspellmem': [['10000,100,12'], ['', 'xxx']], 115 \ 'mouse': [['', 'a', 'nvi'], ['xxx', 'n,v,i']], 116 \ 'mousemodel': [['', 'popup'], ['xxx']], 117 \ 'mouseshape': [['', 'n:arrow'], ['xxx']], 118 \ 'nrformats': [['', 'alpha', 'alpha,hex,bin'], ['xxx']], 119 \ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']], 120 \ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']], 121 \ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']], 122 \ 'renderoptions': [['', 'type:directx'], ['xxx']], 123 \ 'selection': [['old', 'inclusive'], ['', 'xxx']], 124 \ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']], 125 \ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']], 126 \ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']], 127 \ 'spellfile': [['', 'file.en.add'], ['xxx', '/tmp/file']], 128 \ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']], 129 \ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']], 130 \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], 131 \ 'term': [[], []], 132 \ 'termguicolors': [[], []], 133 \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']], 134 \ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], 135 \ 'termwintype': [['', 'winpty', 'conpty'], ['xxx']], 136 \ 'toolbar': [['', 'icons', 'text'], ['xxx']], 137 \ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']], 138 \ 'ttymouse': [['', 'xterm'], ['xxx']], 139 \ 'ttytype': [[], []], 140 \ 'varsofttabstop': [['8', '4,8,16,32'], ['xxx', '-1', '4,-1,20']], 141 \ 'vartabstop': [['8', '4,8,16,32'], ['xxx', '-1', '4,-1,20']], 142 \ 'viewoptions': [['', 'cursor', 'unix,slash'], ['xxx']], 143 \ 'viminfo': [['', '''50', '"30'], ['xxx']], 144 \ 'virtualedit': [['', 'all', 'all,block'], ['xxx']], 145 \ 'whichwrap': [['', 'b,s', 'bs'], ['xxx']], 146 \ 'wildmode': [['', 'full', 'list:full', 'full,longest'], ['xxx']], 147 \ 'wildoptions': [['', 'tagfile'], ['xxx']], 148 \ 'winaltkeys': [['menu', 'no'], ['', 'xxx']], 149 \ 150 \ 'luadll': [[], []], 151 \ 'perldll': [[], []], 152 \ 'pythondll': [[], []], 153 \ 'pythonthreedll': [[], []], 154 \ 'pyxversion': [[], []], 155 \ 'rubydll': [[], []], 156 \ 'tcldll': [[], []], 157 \ 158 \ 'othernum': [[-1, 0, 100], ['']], 159 \ 'otherstring': [['', 'xxx'], []], 160 \} 161 1621 163/struct vimoption options 164while 1 165 /{" 166 if line('.') > end 167 break 168 endif 169 let line = getline('.') 170 let name = substitute(line, '.*{"\([^"]*\)".*', '\1', '') 171 let shortname = substitute(line, '.*"\([^"]*\)".*', '\1', '') 172 173 if has_key(test_values, name) 174 let a = test_values[name] 175 elseif line =~ 'P_NUM' 176 let a = test_values['othernum'] 177 else 178 let a = test_values['otherstring'] 179 endif 180 if len(a[0]) > 0 || len(a[1]) > 0 181 if line =~ 'P_BOOL' 182 call add(script, 'set ' . name) 183 call add(script, 'set ' . shortname) 184 call add(script, 'set no' . name) 185 call add(script, 'set no' . shortname) 186 else 187 for val in a[0] 188 call add(script, 'set ' . name . '=' . val) 189 call add(script, 'set ' . shortname . '=' . val) 190 endfor 191 192 " setting an option can only fail when it's implemented. 193 call add(script, "if exists('+" . name . "')") 194 for val in a[1] 195 call add(script, "call assert_fails('set " . name . "=" . val . "')") 196 call add(script, "call assert_fails('set " . shortname . "=" . val . "')") 197 endfor 198 call add(script, "endif") 199 endif 200 201 " cannot change 'termencoding' in GTK 202 if name != 'termencoding' || !has('gui_gtk') 203 call add(script, 'set ' . name . '&') 204 call add(script, 'set ' . shortname . '&') 205 endif 206 if name == 'verbosefile' 207 call add(script, 'call delete("xxx")') 208 endif 209 210 if name == 'more' 211 call add(script, 'set nomore') 212 elseif name == 'lines' 213 call add(script, 'let &lines = save_lines') 214 endif 215 endif 216endwhile 217 218call add(script, 'let &term = save_term') 219call add(script, 'let &columns = save_columns') 220call add(script, 'let &lines = save_lines') 221 222call writefile(script, 'opt_test.vim') 223 224endif 225 226qa! 227