1" These commands create the option window.
2"
3" Maintainer:	Bram Moolenaar <Bram@vim.org>
4" Last Change:	2010 Jul 24
5
6" If there already is an option window, jump to that one.
7if bufwinnr("option-window") > 0
8  let s:thiswin = winnr()
9  while 1
10    if @% == "option-window"
11      finish
12    endif
13    exe "norm! \<C-W>w"
14    if s:thiswin == winnr()
15      break
16    endif
17  endwhile
18endif
19
20" Make sure the '<' flag is not included in 'cpoptions', otherwise <CR> would
21" not be recognized.  See ":help 'cpoptions'".
22let s:cpo_save = &cpo
23set cpo&vim
24
25" function to be called when <CR> is hit in the option-window
26fun! <SID>CR()
27
28  " If on a continued comment line, go back to the first comment line
29  let lnum = line(".")
30  let line = getline(lnum)
31  while line[0] == "\t"
32    let lnum = lnum - 1
33    let line = getline(lnum)
34  endwhile
35
36  " <CR> on a "set" line executes the option line
37  if match(line, "^ \tset ") >= 0
38
39    " For a local option: go to the previous window
40    " If this is a help window, go to the window below it
41    let thiswin = winnr()
42    let local = <SID>Find(lnum)
43    if local >= 0
44      exe line
45      call <SID>Update(lnum, line, local, thiswin)
46    endif
47
48  " <CR> on a "option" line shows help for that option
49  elseif match(line, "^[a-z]") >= 0
50    let name = substitute(line, '\([^\t]*\).*', '\1', "")
51    exe "help '" . name . "'"
52
53  " <CR> on an index line jumps to the group
54  elseif match(line, '^ \=[0-9]') >= 0
55    exe "norm! /" . line . "\<CR>zt"
56  endif
57endfun
58
59" function to be called when <Space> is hit in the option-window
60fun! <SID>Space()
61
62  let lnum = line(".")
63  let line = getline(lnum)
64
65  " <Space> on a "set" line refreshes the option line
66  if match(line, "^ \tset ") >= 0
67
68    " For a local option: go to the previous window
69    " If this is a help window, go to the window below it
70    let thiswin = winnr()
71    let local = <SID>Find(lnum)
72    if local >= 0
73      call <SID>Update(lnum, line, local, thiswin)
74    endif
75
76  endif
77endfun
78
79" find the window in which the option applies
80" returns 0 for global option, 1 for local option, -1 for error
81fun! <SID>Find(lnum)
82    if getline(a:lnum - 1) =~ "(local to"
83      let local = 1
84      let thiswin = winnr()
85      exe "norm! \<C-W>p"
86      if exists("b:current_syntax") && b:current_syntax == "help"
87	exe "norm! \<C-W>j"
88	if winnr() == thiswin
89	  exe "norm! \<C-W>j"
90	endif
91      endif
92    else
93      let local = 0
94    endif
95    if local && (winnr() == thiswin || (exists("b:current_syntax")
96	\ && b:current_syntax == "help"))
97      echo "Don't know in which window"
98      let local = -1
99    endif
100    return local
101endfun
102
103" Update a "set" line in the option window
104fun! <SID>Update(lnum, line, local, thiswin)
105  " get the new value of the option and update the option window line
106  if match(a:line, "=") >= 0
107    let name = substitute(a:line, '^ \tset \([^=]*\)=.*', '\1', "")
108  else
109    let name = substitute(a:line, '^ \tset \(no\)\=\([a-z]*\).*', '\2', "")
110  endif
111  if name == "pt" && &pt =~ "\x80"
112    let val = <SID>PTvalue()
113  else
114    exe "let val = substitute(&" . name . ', "[ \\t\\\\\"|]", "\\\\\\0", "g")'
115  endif
116  if a:local
117    exe "norm! " . a:thiswin . "\<C-W>w"
118  endif
119  if match(a:line, "=") >= 0 || (val != "0" && val != "1")
120    call setline(a:lnum, " \tset " . name . "=" . val)
121  else
122    if val
123      call setline(a:lnum, " \tset " . name . "\tno" . name)
124    else
125      call setline(a:lnum, " \tset no" . name . "\t" . name)
126    endif
127  endif
128  set nomodified
129endfun
130
131" Reset 'title' and 'icon' to make it work faster.
132let s:old_title = &title
133let s:old_icon = &icon
134let s:old_sc = &sc
135let s:old_ru = &ru
136set notitle noicon nosc noru
137
138" If the current window is a help window, try finding a non-help window.
139" Relies on syntax highlighting to be switched on.
140let s:thiswin = winnr()
141while exists("b:current_syntax") && b:current_syntax == "help"
142  exe "norm! \<C-W>w"
143  if s:thiswin == winnr()
144    break
145  endif
146endwhile
147
148" Open the window
149new option-window
150setlocal ts=15 tw=0 noro
151
152" Insert help and a "set" command for each option.
153call append(0, '" Each "set" line shows the current value of an option (on the left).')
154call append(1, '" Hit <CR> on a "set" line to execute it.')
155call append(2, '"            A boolean option will be toggled.')
156call append(3, '"            For other options you can edit the value.')
157call append(4, '" Hit <CR> on a help line to open a help window on this option.')
158call append(5, '" Hit <CR> on an index line to jump there.')
159call append(6, '" Hit <Space> on a "set" line to refresh it.')
160
161" These functions are called often below.  Keep them fast!
162
163" Init a local binary option
164fun! <SID>BinOptionL(name)
165  exe "norm! \<C-W>p"
166  exe "let val = &" . a:name
167  exe "norm! \<C-W>p"
168  call append("$", substitute(substitute(" \tset " . val . a:name . "\t" .
169	\!val . a:name, "0", "no", ""), "1", "", ""))
170endfun
171
172" Init a global binary option
173fun! <SID>BinOptionG(name, val)
174  call append("$", substitute(substitute(" \tset " . a:val . a:name . "\t" .
175	\!a:val . a:name, "0", "no", ""), "1", "", ""))
176endfun
177
178" Init a local string option
179fun! <SID>OptionL(name)
180  exe "norm! \<C-W>p"
181  exe "let val = substitute(&" . a:name . ', "[ \\t\\\\\"|]", "\\\\\\0", "g")'
182  exe "norm! \<C-W>p"
183  call append("$", " \tset " . a:name . "=" . val)
184endfun
185
186" Init a global string option
187fun! <SID>OptionG(name, val)
188  call append("$", " \tset " . a:name . "=" . substitute(a:val, '[ \t\\"|]',
189	\ '\\\0', "g"))
190endfun
191
192let s:idx = 1
193let s:lnum = line("$")
194call append("$", "")
195
196fun! <SID>Header(text)
197  let line = s:idx . " " . a:text
198  if s:idx < 10
199    let line = " " . line
200  endif
201  call append("$", "")
202  call append("$", line)
203  call append("$", "")
204  call append(s:lnum, line)
205  let s:idx = s:idx + 1
206  let s:lnum = s:lnum + 1
207endfun
208
209" Get the value of 'pastetoggle'.  It could be a special key.
210fun! <SID>PTvalue()
211  redir @a
212  silent set pt
213  redir END
214  return substitute(@a, '[^=]*=\(.*\)', '\1', "")
215endfun
216
217" Restore the previous value of 'cpoptions' here, it's used below.
218let &cpo = s:cpo_save
219
220" List of all options, organized by function.
221" The text should be sufficient to know what the option is used for.
222
223call <SID>Header("important")
224call append("$", "compatible\tbehave very Vi compatible (not advisable)")
225call <SID>BinOptionG("cp", &cp)
226call append("$", "cpoptions\tlist of flags to specify Vi compatibility")
227call <SID>OptionG("cpo", &cpo)
228call append("$", "insertmode\tuse Insert mode as the default mode")
229call <SID>BinOptionG("im", &im)
230call append("$", "paste\tpaste mode, insert typed text literally")
231call <SID>BinOptionG("paste", &paste)
232call append("$", "pastetoggle\tkey sequence to toggle paste mode")
233if &pt =~ "\x80"
234  call append("$", " \tset pt=" . <SID>PTvalue())
235else
236  call <SID>OptionG("pt", &pt)
237endif
238call append("$", "runtimepath\tlist of directories used for runtime files and plugins")
239call <SID>OptionG("rtp", &rtp)
240call append("$", "helpfile\tname of the main help file")
241call <SID>OptionG("hf", &hf)
242
243
244call <SID>Header("moving around, searching and patterns")
245call append("$", "whichwrap\tlist of flags specifying which commands wrap to another line")
246call append("$", "\t(local to window)")
247call <SID>OptionL("ww")
248call append("$", "startofline\tmany jump commands move the cursor to the first non-blank")
249call append("$", "\tcharacter of a line")
250call <SID>BinOptionG("sol", &sol)
251call append("$", "paragraphs\tnroff macro names that separate paragraphs")
252call <SID>OptionG("para", &para)
253call append("$", "sections\tnroff macro names that separate sections")
254call <SID>OptionG("sect", &sect)
255call append("$", "path\tlist of directory names used for file searching")
256call append("$", "\t(global or local to buffer)")
257call <SID>OptionG("pa", &pa)
258call append("$", "cdpath\tlist of directory names used for :cd")
259call <SID>OptionG("cd", &cd)
260if exists("+autochdir")
261  call append("$", "autochdir\tchange to directory of file in buffer")
262  call <SID>BinOptionG("acd", &acd)
263endif
264call append("$", "wrapscan\tsearch commands wrap around the end of the buffer")
265call <SID>BinOptionG("ws", &ws)
266call append("$", "incsearch\tshow match for partly typed search command")
267call <SID>BinOptionG("is", &is)
268call append("$", "magic\tchange the way backslashes are used in search patterns")
269call <SID>BinOptionG("magic", &magic)
270call append("$", "ignorecase\tignore case when using a search pattern")
271call <SID>BinOptionG("ic", &ic)
272call append("$", "smartcase\toverride 'ignorecase' when pattern has upper case characters")
273call <SID>BinOptionG("scs", &scs)
274call append("$", "casemap\twhat method to use for changing case of letters")
275call <SID>OptionG("cmp", &cmp)
276call append("$", "maxmempattern\tmaximum amount of memory in Kbyte used for pattern matching")
277call append("$", " \tset mmp=" . &mmp)
278call append("$", "define\tpattern for a macro definition line")
279call append("$", "\t(global or local to buffer)")
280call <SID>OptionG("def", &def)
281if has("find_in_path")
282  call append("$", "include\tpattern for an include-file line")
283  call append("$", "\t(local to buffer)")
284  call <SID>OptionL("inc")
285  call append("$", "includeexpr\texpression used to transform an include line to a file name")
286  call append("$", "\t(local to buffer)")
287  call <SID>OptionL("inex")
288endif
289
290
291call <SID>Header("tags")
292call append("$", "tagbsearch\tuse binary searching in tags files")
293call <SID>BinOptionG("tbs", &tbs)
294call append("$", "taglength\tnumber of significant characters in a tag name or zero")
295call append("$", " \tset tl=" . &tl)
296call append("$", "tags\tlist of file names to search for tags")
297call append("$", "\t(global or local to buffer)")
298call <SID>OptionG("tag", &tag)
299call append("$", "tagrelative\tfile names in a tags file are relative to the tags file")
300call <SID>BinOptionG("tr", &tr)
301call append("$", "tagstack\ta :tag command will use the tagstack")
302call <SID>BinOptionG("tgst", &tgst)
303call append("$", "showfulltag\twhen completing tags in Insert mode show more info")
304call <SID>BinOptionG("sft", &sft)
305if has("cscope")
306  call append("$", "cscopeprg\tcommand for executing cscope")
307  call <SID>OptionG("csprg", &csprg)
308  call append("$", "cscopetag\tuse cscope for tag commands")
309  call <SID>BinOptionG("cst", &cst)
310  call append("$", "cscopetagorder\t0 or 1; the order in which \":cstag\" performs a search")
311  call append("$", " \tset csto=" . &csto)
312  call append("$", "cscopeverbose\tgive messages when adding a cscope database")
313  call <SID>BinOptionG("csverb", &csverb)
314  call append("$", "cscopepathcomp\thow many components of the path to show")
315  call append("$", " \tset cspc=" . &cspc)
316  call append("$", "cscopequickfix\twhen to open a quickfix window for cscope")
317  call <SID>OptionG("csqf", &csqf)
318endif
319
320
321call <SID>Header("displaying text")
322call append("$", "scroll\tnumber of lines to scroll for CTRL-U and CTRL-D")
323call append("$", "\t(local to window)")
324call <SID>OptionL("scr")
325call append("$", "scrolloff\tnumber of screen lines to show around the cursor")
326call append("$", " \tset so=" . &so)
327call append("$", "wrap\tlong lines wrap")
328call <SID>BinOptionG("wrap", &wrap)
329call append("$", "linebreak\twrap long lines at a character in 'breakat'")
330call append("$", "\t(local to window)")
331call <SID>BinOptionL("lbr")
332call append("$", "breakat\twhich characters might cause a line break")
333call <SID>OptionG("brk", &brk)
334call append("$", "showbreak\tstring to put before wrapped screen lines")
335call <SID>OptionG("sbr", &sbr)
336call append("$", "sidescroll\tminimal number of columns to scroll horizontally")
337call append("$", " \tset ss=" . &ss)
338call append("$", "sidescrolloff\tminimal number of columns to keep left and right of the cursor")
339call append("$", " \tset siso=" . &siso)
340call append("$", "display\tinclude \"lastline\" to show the last line even if it doesn't fit")
341call append("$", "\tinclude \"uhex\" to show unprintable characters as a hex number")
342call <SID>OptionG("dy", &dy)
343call append("$", "fillchars\tcharacters to use for the status line, folds and filler lines")
344call <SID>OptionG("fcs", &fcs)
345call append("$", "cmdheight\tnumber of lines used for the command-line")
346call append("$", " \tset ch=" . &ch)
347call append("$", "columns\twidth of the display")
348call append("$", " \tset co=" . &co)
349call append("$", "lines\tnumber of lines in the display")
350call append("$", " \tset lines=" . &lines)
351call append("$", "window\tnumber of lines to scroll for CTRL-F and CTRL-B")
352call append("$", " \tset window=" . &window)
353call append("$", "lazyredraw\tdon't redraw while executing macros")
354call <SID>BinOptionG("lz", &lz)
355if has("reltime")
356  call append("$", "redrawtime\ttimeout for 'hlsearch' and :match highlighting in msec")
357  call append("$", " \tset rdt=" . &rdt)
358endif
359call append("$", "writedelay\tdelay in msec for each char written to the display")
360call append("$", "\t(for debugging)")
361call append("$", " \tset wd=" . &wd)
362call append("$", "list\tshow <Tab> as ^I and end-of-line as $")
363call append("$", "\t(local to window)")
364call <SID>BinOptionL("list")
365call append("$", "listchars\tlist of strings used for list mode")
366call <SID>OptionG("lcs", &lcs)
367call append("$", "number\tshow the line number for each line")
368call append("$", "\t(local to window)")
369call <SID>BinOptionL("nu")
370call append("$", "relativenumber\tshow the relative line number for each line")
371call append("$", "\t(local to window)")
372call <SID>BinOptionL("rnu")
373if has("linebreak")
374  call append("$", "numberwidth\tnumber of columns to use for the line number")
375  call append("$", "\t(local to window)")
376  call <SID>OptionL("nuw")
377endif
378if has("conceal")
379  call append("$", "conceallevel\tcontrols whether concealable text is hidden")
380  call append("$", "\t(local to window)")
381  call <SID>OptionL("cole")
382  call append("$", "concealcursor\tmodes in which text in the cursor line can be concealed")
383  call append("$", "\t(local to window)")
384  call <SID>OptionL("cocu")
385endif
386
387
388call <SID>Header("syntax, highlighting and spelling")
389call append("$", "background\t\"dark\" or \"light\"; the background color brightness")
390call <SID>OptionG("bg", &bg)
391if has("autocmd")
392  call append("$", "filetype\ttype of file; triggers the FileType event when set")
393  call append("$", "\t(local to buffer)")
394  call <SID>OptionL("ft")
395endif
396if has("syntax")
397  call append("$", "syntax\tname of syntax highlighting used")
398  call append("$", "\t(local to buffer)")
399  call <SID>OptionL("syn")
400  call append("$", "synmaxcol\tmaximum column to look for syntax items")
401  call append("$", "\t(local to buffer)")
402  call <SID>OptionL("smc")
403endif
404call append("$", "highlight\twhich highlighting to use for various occasions")
405call <SID>OptionG("hl", &hl)
406call append("$", "hlsearch\thighlight all matches for the last used search pattern")
407call <SID>BinOptionG("hls", &hls)
408if has("syntax")
409  call append("$", "cursorcolumn\thighlight the screen column of the cursor")
410  call append("$", "\t(local to window)")
411  call <SID>BinOptionL("cuc")
412  call append("$", "cursorline\thighlight the screen line of the cursor")
413  call append("$", "\t(local to window)")
414  call <SID>BinOptionL("cul")
415  call append("$", "colorcolumn\tcolumns to highlight")
416  call append("$", "\t(local to window)")
417  call <SID>OptionL("cc")
418  call append("$", "spell\thighlight spelling mistakes")
419  call append("$", "\t(local to window)")
420  call <SID>BinOptionL("spell")
421  call append("$", "spelllang\tlist of accepted languages")
422  call append("$", "\t(local to buffer)")
423  call <SID>OptionL("spl")
424  call append("$", "spellfile\tfile that \"zg\" adds good words to")
425  call append("$", "\t(local to buffer)")
426  call <SID>OptionL("spf")
427  call append("$", "spellcapcheck\tpattern to locate the end of a sentence")
428  call append("$", "\t(local to buffer)")
429  call <SID>OptionL("spc")
430  call append("$", "spellsuggest\tmethods used to suggest corrections")
431  call <SID>OptionG("sps", &sps)
432  call append("$", "mkspellmem\tamount of memory used by :mkspell before compressing")
433  call <SID>OptionG("msm", &msm)
434endif
435
436
437call <SID>Header("multiple windows")
438call append("$", "laststatus\t0, 1 or 2; when to use a status line for the last window")
439call append("$", " \tset ls=" . &ls)
440if has("statusline")
441  call append("$", "statusline\talternate format to be used for a status line")
442  call <SID>OptionG("stl", &stl)
443endif
444call append("$", "equalalways\tmake all windows the same size when adding/removing windows")
445call <SID>BinOptionG("ea", &ea)
446if has("vertsplit")
447  call append("$", "eadirection\tin which direction 'equalalways' works: \"ver\", \"hor\" or \"both\"")
448  call <SID>OptionG("ead", &ead)
449endif
450call append("$", "winheight\tminimal number of lines used for the current window")
451call append("$", " \tset wh=" . &wh)
452call append("$", "winminheight\tminimal number of lines used for any window")
453call append("$", " \tset wmh=" . &wmh)
454call append("$", "winfixheight\tkeep the height of the window")
455call append("$", "\t(local to window)")
456call <SID>BinOptionL("wfh")
457if has("vertsplit")
458call append("$", "winfixwidth\tkeep the width of the window")
459call append("$", "\t(local to window)")
460call <SID>BinOptionL("wfw")
461  call append("$", "winwidth\tminimal number of columns used for the current window")
462  call append("$", " \tset wiw=" . &wiw)
463  call append("$", "winminwidth\tminimal number of columns used for any window")
464  call append("$", " \tset wmw=" . &wmw)
465endif
466call append("$", "helpheight\tinitial height of the help window")
467call append("$", " \tset hh=" . &hh)
468if has("quickfix")
469  call append("$", "previewheight\tdefault height for the preview window")
470  call append("$", " \tset pvh=" . &pvh)
471  call append("$", "previewwindow\tidentifies the preview window")
472  call append("$", "\t(local to window)")
473  call <SID>BinOptionL("pvw")
474endif
475call append("$", "hidden\tdon't unload a buffer when no longer shown in a window")
476call <SID>BinOptionG("hid", &hid)
477call append("$", "switchbuf\t\"useopen\" and/or \"split\"; which window to use when jumping")
478call append("$", "\tto a buffer")
479call <SID>OptionG("swb", &swb)
480call append("$", "splitbelow\ta new window is put below the current one")
481call <SID>BinOptionG("sb", &sb)
482if has("vertsplit")
483  call append("$", "splitright\ta new window is put right of the current one")
484  call <SID>BinOptionG("spr", &spr)
485endif
486if has("scrollbind")
487  call append("$", "scrollbind\tthis window scrolls together with other bound windows")
488  call append("$", "\t(local to window)")
489  call <SID>BinOptionL("scb")
490  call append("$", "scrollopt\t\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'")
491  call <SID>OptionG("sbo", &sbo)
492endif
493if has("cursorbind")
494  call append("$", "cursorbind\tthis window's cursor moves together with other bound windows")
495  call append("$", "\t(local to window)")
496  call <SID>BinOptionL("crb")
497endif
498
499
500call <SID>Header("multiple tab pages")
501call append("$", "showtabline\t0, 1 or 2; when to use a tab pages line")
502call append("$", " \tset stal=" . &stal)
503call append("$", "tabpagemax\tmaximum number of tab pages to open for -p and \"tab all\"")
504call append("$", " \tset tpm=" . &tpm)
505call append("$", "tabline\tcustom tab pages line")
506call <SID>OptionG("tal", &tal)
507if has("gui")
508  call append("$", "guitablabel\tcustom tab page label for the GUI")
509  call <SID>OptionG("gtl", &gtl)
510  call append("$", "guitabtooltip\tcustom tab page tooltip for the GUI")
511  call <SID>OptionG("gtt", &gtt)
512endif
513
514
515call <SID>Header("terminal")
516call append("$", "term\tname of the used terminal")
517call <SID>OptionG("term", &term)
518call append("$", "ttytype\talias for 'term'")
519call <SID>OptionG("tty", &tty)
520call append("$", "ttybuiltin\tcheck built-in termcaps first")
521call <SID>BinOptionG("tbi", &tbi)
522call append("$", "ttyfast\tterminal connection is fast")
523call <SID>BinOptionG("tf", &tf)
524call append("$", "weirdinvert\tterminal that requires extra redrawing")
525call <SID>BinOptionG("wiv", &wiv)
526call append("$", "esckeys\trecognize keys that start with <Esc> in Insert mode")
527call <SID>BinOptionG("ek", &ek)
528call append("$", "scrolljump\tminimal number of lines to scroll at a time")
529call append("$", " \tset sj=" . &sj)
530call append("$", "ttyscroll\tmaximum number of lines to use scrolling instead of redrawing")
531call append("$", " \tset tsl=" . &tsl)
532if has("gui") || has("msdos") || has("win32")
533  call append("$", "guicursor\tspecifies what the cursor looks like in different modes")
534  call <SID>OptionG("gcr", &gcr)
535endif
536if has("title")
537  let &title = s:old_title
538  call append("$", "title\tshow info in the window title")
539  call <SID>BinOptionG("title", &title)
540  set notitle
541  call append("$", "titlelen\tpercentage of 'columns' used for the window title")
542  call append("$", " \tset titlelen=" . &titlelen)
543  call append("$", "titlestring\twhen not empty, string to be used for the window title")
544  call <SID>OptionG("titlestring", &titlestring)
545  call append("$", "titleold\tstring to restore the title to when exiting Vim")
546  call <SID>OptionG("titleold", &titleold)
547  let &icon = s:old_icon
548  call append("$", "icon\tset the text of the icon for this window")
549  call <SID>BinOptionG("icon", &icon)
550  set noicon
551  call append("$", "iconstring\twhen not empty, text for the icon of this window")
552  call <SID>OptionG("iconstring", &iconstring)
553endif
554if has("win32")
555  call append("$", "restorescreen\trestore the screen contents when exiting Vim")
556  call <SID>BinOptionG("rs", &rs)
557endif
558
559
560call <SID>Header("using the mouse")
561call append("$", "mouse\tlist of flags for using the mouse")
562call <SID>OptionG("mouse", &mouse)
563if has("gui")
564  call append("$", "mousefocus\tthe window with the mouse pointer becomes the current one")
565  call <SID>BinOptionG("mousef", &mousef)
566  call append("$", "mousehide\thide the mouse pointer while typing")
567  call <SID>BinOptionG("mh", &mh)
568endif
569call append("$", "mousemodel\t\"extend\", \"popup\" or \"popup_setpos\"; what the right")
570call append("$", "\tmouse button is used for")
571call <SID>OptionG("mousem", &mousem)
572call append("$", "mousetime\tmaximum time in msec to recognize a double-click")
573call append("$", " \tset mouset=" . &mouset)
574call append("$", "ttymouse\t\"xterm\", \"xterm2\", \"dec\" or \"netterm\"; type of mouse")
575call <SID>OptionG("ttym", &ttym)
576if has("mouseshape")
577  call append("$", "mouseshape\twhat the mouse pointer looks like in different modes")
578  call <SID>OptionG("mouses", &mouses)
579endif
580
581
582if has("gui")
583  call <SID>Header("GUI")
584  call append("$", "guifont\tlist of font names to be used in the GUI")
585  call <SID>OptionG("gfn", &gfn)
586  if has("xfontset")
587    call append("$", "guifontset\tpair of fonts to be used, for multibyte editing")
588    call <SID>OptionG("gfs", &gfs)
589  endif
590  call append("$", "guifontwide\tlist of font names to be used for double-wide characters")
591  call <SID>OptionG("gfw", &gfw)
592  if has("mac")
593    call append("$", "antialias\tuse smooth, antialiased fonts")
594    call <SID>BinOptionG("anti", &anti)
595  endif
596  call append("$", "guioptions\tlist of flags that specify how the GUI works")
597  call <SID>OptionG("go", &go)
598  if has("gui_gtk")
599    call append("$", "toolbar\t\"icons\", \"text\" and/or \"tooltips\"; how to show the toolbar")
600    call <SID>OptionG("tb", &tb)
601    if has("gui_gtk2")
602      call append("$", "toolbariconsize\tsize of toolbar icons")
603      call <SID>OptionG("tbis", &tbis)
604    endif
605    call append("$", "guiheadroom\troom (in pixels) left above/below the window")
606    call append("$", " \tset ghr=" . &ghr)
607  endif
608  call append("$", "guipty\tuse a pseudo-tty for I/O to external commands")
609  call <SID>BinOptionG("guipty", &guipty)
610  if has("browse")
611    call append("$", "browsedir\t\"last\", \"buffer\" or \"current\": which directory used for the file browser")
612    call <SID>OptionG("bsdir", &bsdir)
613  endif
614  if has("multi_lang")
615    call append("$", "langmenu\tlanguage to be used for the menus")
616    call <SID>OptionG("langmenu", &lm)
617  endif
618  call append("$", "menuitems\tmaximum number of items in one menu")
619  call append("$", " \tset mis=" . &mis)
620  if has("winaltkeys")
621    call append("$", "winaltkeys\t\"no\", \"yes\" or \"menu\"; how to use the ALT key")
622    call <SID>OptionG("wak", &wak)
623  endif
624  call append("$", "linespace\tnumber of pixel lines to use between characters")
625  call append("$", " \tset lsp=" . &lsp)
626  if has("balloon_eval")
627    call append("$", "balloondelay\tdelay in milliseconds before a balloon may pop up")
628    call append("$", " \tset bdlay=" . &bdlay)
629    call append("$", "ballooneval\twhether the balloon evaluation is to be used")
630    call <SID>BinOptionG("beval", &beval)
631    if has("eval")
632      call append("$", "balloonexpr\texpression to show in balloon eval")
633      call append("$", " \tset bexpr=" . &bexpr)
634    endif
635  endif
636  if exists("+macatsui")
637    call append("$", "macatsui\tuse ATSUI text drawing; disable to avoid display problems")
638    call <SID>OptionG("macatsui", &macatsui)
639  endif
640endif
641
642if has("printer")
643  call <SID>Header("printing")
644  call append("$", "printoptions\tlist of items that control the format of :hardcopy output")
645  call <SID>OptionG("popt", &popt)
646  call append("$", "printdevice\tname of the printer to be used for :hardcopy")
647  call <SID>OptionG("pdev", &pdev)
648  if has("postscript")
649    call append("$", "printexpr\texpression used to print the PostScript file for :hardcopy")
650    call <SID>OptionG("pexpr", &pexpr)
651  endif
652  call append("$", "printfont\tname of the font to be used for :hardcopy")
653  call <SID>OptionG("pfn", &pfn)
654  call append("$", "printheader\tformat of the header used for :hardcopy")
655  call <SID>OptionG("pheader", &pheader)
656  if has("postscript")
657    call append("$", "printencoding\tencoding used to print the PostScript file for :hardcopy")
658    call <SID>OptionG("penc", &penc)
659  endif
660  if has("multi_byte")
661    call append("$", "printmbcharset\tthe CJK character set to be used for CJK output from :hardcopy")
662    call <SID>OptionG("pmbcs", &pmbcs)
663    call append("$", "printmbfont\tlist of font names to be used for CJK output from :hardcopy")
664    call <SID>OptionG("pmbfn", &pmbfn)
665  endif
666endif
667
668call <SID>Header("messages and info")
669call append("$", "terse\tadd 's' flag in 'shortmess' (don't show search message)")
670call <SID>BinOptionG("terse", &terse)
671call append("$", "shortmess\tlist of flags to make messages shorter")
672call <SID>OptionG("shm", &shm)
673call append("$", "showcmd\tshow (partial) command keys in the status line")
674let &sc = s:old_sc
675call <SID>BinOptionG("sc", &sc)
676set nosc
677call append("$", "showmode\tdisplay the current mode in the status line")
678call <SID>BinOptionG("smd", &smd)
679call append("$", "ruler\tshow cursor position below each window")
680let &ru = s:old_ru
681call <SID>BinOptionG("ru", &ru)
682set noru
683if has("statusline")
684  call append("$", "rulerformat\talternate format to be used for the ruler")
685  call <SID>OptionG("ruf", &ruf)
686endif
687call append("$", "report\tthreshold for reporting number of changed lines")
688call append("$", " \tset report=" . &report)
689call append("$", "verbose\tthe higher the more messages are given")
690call append("$", " \tset vbs=" . &vbs)
691call append("$", "verbosefile\tfile to write messages in")
692call <SID>OptionG("vfile", &vfile)
693call append("$", "more\tpause listings when the screen is full")
694call <SID>BinOptionG("more", &more)
695if has("dialog_con") || has("dialog_gui")
696  call append("$", "confirm\tstart a dialog when a command fails")
697  call <SID>BinOptionG("cf", &cf)
698endif
699call append("$", "errorbells\tring the bell for error messages")
700call <SID>BinOptionG("eb", &eb)
701call append("$", "visualbell\tuse a visual bell instead of beeping")
702call <SID>BinOptionG("vb", &vb)
703if has("multi_lang")
704  call append("$", "helplang\tlist of preferred languages for finding help")
705  call <SID>OptionG("hlg", &hlg)
706endif
707
708
709call <SID>Header("selecting text")
710call append("$", "selection\t\"old\", \"inclusive\" or \"exclusive\"; how selecting text behaves")
711call <SID>OptionG("sel", &sel)
712call append("$", "selectmode\t\"mouse\", \"key\" and/or \"cmd\"; when to start Select mode")
713call append("$", "\tinstead of Visual mode")
714call <SID>OptionG("slm", &slm)
715if has("clipboard")
716  call append("$", "clipboard\t\"unnamed\" to use the * register like unnamed register")
717  call append("$", "\t\"autoselect\" to always put selected text on the clipboard")
718  call <SID>OptionG("cb", &cb)
719endif
720call append("$", "keymodel\t\"startsel\" and/or \"stopsel\"; what special keys can do")
721call <SID>OptionG("km", &km)
722
723
724call <SID>Header("editing text")
725call append("$", "undolevels\tmaximum number of changes that can be undone")
726call append("$", " \tset ul=" . &ul)
727call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload")
728call append("$", " \tset ur=" . &ur)
729call append("$", "modified\tchanges have been made and not written to a file")
730call append("$", "\t(local to buffer)")
731call <SID>BinOptionL("mod")
732call append("$", "readonly\tbuffer is not to be written")
733call append("$", "\t(local to buffer)")
734call <SID>BinOptionL("ro")
735call append("$", "modifiable\tchanges to the text are not possible")
736call append("$", "\t(local to buffer)")
737call <SID>BinOptionL("ma")
738call append("$", "textwidth\tline length above which to break a line")
739call append("$", "\t(local to buffer)")
740call <SID>OptionL("tw")
741call append("$", "wrapmargin\tmargin from the right in which to break a line")
742call append("$", "\t(local to buffer)")
743call <SID>OptionL("wm")
744call append("$", "backspace\tspecifies what <BS>, CTRL-W, etc. can do in Insert mode")
745call append("$", " \tset bs=" . &bs)
746call append("$", "comments\tdefinition of what comment lines look like")
747call append("$", "\t(local to buffer)")
748call <SID>OptionL("com")
749call append("$", "formatoptions\tlist of flags that tell how automatic formatting works")
750call append("$", "\t(local to buffer)")
751call <SID>OptionL("fo")
752call append("$", "formatlistpat\tpattern to recognize a numbered list")
753call append("$", "\t(local to buffer)")
754call <SID>OptionL("flp")
755if has("eval")
756  call append("$", "formatexpr\texpression used for \"gq\" to format lines")
757  call append("$", "\t(local to buffer)")
758  call <SID>OptionL("fex")
759endif
760if has("insert_expand")
761  call append("$", "complete\tspecifies how Insert mode completion works for CTRL-N and CTRL-P")
762  call append("$", "\t(local to buffer)")
763  call <SID>OptionL("cpt")
764  call append("$", "completeopt\twhether to use a popup menu for Insert mode completion")
765  call <SID>OptionG("cot", &cot)
766  call append("$", "pumheight\tmaximum height of the popup menu")
767  call <SID>OptionG("ph", &ph)
768  call append("$", "completefunc\tuser defined function for Insert mode completion")
769  call append("$", "\t(local to buffer)")
770  call <SID>OptionL("cfu")
771  call append("$", "omnifunc\tfunction for filetype-specific Insert mode completion")
772  call append("$", "\t(local to buffer)")
773  call <SID>OptionL("ofu")
774  call append("$", "dictionary\tlist of dictionary files for keyword completion")
775  call append("$", "\t(global or local to buffer)")
776  call <SID>OptionG("dict", &dict)
777  call append("$", "thesaurus\tlist of thesaurus files for keyword completion")
778  call append("$", "\t(global or local to buffer)")
779  call <SID>OptionG("tsr", &tsr)
780endif
781call append("$", "infercase\tadjust case of a keyword completion match")
782call append("$", "\t(local to buffer)")
783call <SID>BinOptionL("inf")
784if has("digraphs")
785  call append("$", "digraph\tenable entering digraps with c1 <BS> c2")
786  call <SID>BinOptionG("dg", &dg)
787endif
788call append("$", "tildeop\tthe \"~\" command behaves like an operator")
789call <SID>BinOptionG("top", &top)
790call append("$", "operatorfunc\tfunction called for the\"g@\"  operator")
791call <SID>OptionG("opfunc", &opfunc)
792call append("$", "showmatch\twhen inserting a bracket, briefly jump to its match")
793call <SID>BinOptionG("sm", &sm)
794call append("$", "matchtime\ttenth of a second to show a match for 'showmatch'")
795call append("$", " \tset mat=" . &mat)
796call append("$", "matchpairs\tlist of pairs that match for the \"%\" command")
797call append("$", "\t(local to buffer)")
798call <SID>OptionL("mps")
799call append("$", "joinspaces\tuse two spaces after '.' when joining a line")
800call <SID>BinOptionG("js", &js)
801call append("$", "nrformats\t\"alpha\", \"octal\" and/or \"hex\"; number formats recognized for")
802call append("$", "\tCTRL-A and CTRL-X commands")
803call append("$", "\t(local to buffer)")
804call <SID>OptionL("nf")
805
806
807call <SID>Header("tabs and indenting")
808call append("$", "tabstop\tnumber of spaces a <Tab> in the text stands for")
809call append("$", "\t(local to buffer)")
810call <SID>OptionL("ts")
811call append("$", "shiftwidth\tnumber of spaces used for each step of (auto)indent")
812call append("$", "\t(local to buffer)")
813call <SID>OptionL("sw")
814call append("$", "smarttab\ta <Tab> in an indent inserts 'shiftwidth' spaces")
815call <SID>BinOptionG("sta", &sta)
816call append("$", "softtabstop\tif non-zero, number of spaces to insert for a <Tab>")
817call append("$", "\t(local to buffer)")
818call <SID>OptionL("sts")
819call append("$", "shiftround\tround to 'shiftwidth' for \"<<\" and \">>\"")
820call <SID>BinOptionG("sr", &sr)
821call append("$", "expandtab\texpand <Tab> to spaces in Insert mode")
822call append("$", "\t(local to buffer)")
823call <SID>BinOptionL("et")
824call append("$", "autoindent\tautomatically set the indent of a new line")
825call append("$", "\t(local to buffer)")
826call <SID>BinOptionL("ai")
827if has("smartindent")
828  call append("$", "smartindent\tdo clever autoindenting")
829  call append("$", "\t(local to buffer)")
830  call <SID>BinOptionL("si")
831endif
832if has("cindent")
833  call append("$", "cindent\tenable specific indenting for C code")
834  call append("$", "\t(local to buffer)")
835  call <SID>BinOptionL("cin")
836  call append("$", "cinoptions\toptions for C-indenting")
837  call append("$", "\t(local to buffer)")
838  call <SID>OptionL("cino")
839  call append("$", "cinkeys\tkeys that trigger C-indenting in Insert mode")
840  call append("$", "\t(local to buffer)")
841  call <SID>OptionL("cink")
842  call append("$", "cinwords\tlist of words that cause more C-indent")
843  call append("$", "\t(local to buffer)")
844  call <SID>OptionL("cinw")
845  call append("$", "indentexpr\texpression used to obtain the indent of a line")
846  call append("$", "\t(local to buffer)")
847  call <SID>OptionL("inde")
848  call append("$", "indentkeys\tkeys that trigger indenting with 'indentexpr' in Insert mode")
849  call append("$", "\t(local to buffer)")
850  call <SID>OptionL("indk")
851endif
852call append("$", "copyindent\tcopy whitespace for indenting from previous line")
853call append("$", "\t(local to buffer)")
854call <SID>BinOptionL("ci")
855call append("$", "preserveindent\tpreserve kind of whitespace when changing indent")
856call append("$", "\t(local to buffer)")
857call <SID>BinOptionL("pi")
858if has("lispindent")
859  call append("$", "lisp\tenable lisp mode")
860  call append("$", "\t(local to buffer)")
861  call <SID>BinOptionL("lisp")
862  call append("$", "lispwords\twords that change how lisp indenting works")
863  call <SID>OptionG("lw", &lw)
864endif
865
866
867if has("folding")
868  call <SID>Header("folding")
869  call append("$", "foldenable\tset to display all folds open")
870  call append("$", "\t(local to window)")
871  call <SID>BinOptionL("fen")
872  call append("$", "foldlevel\tfolds with a level higher than this number will be closed")
873  call append("$", "\t(local to window)")
874  call <SID>OptionL("fdl")
875  call append("$", "foldlevelstart\tvalue for 'foldlevel' when starting to edit a file")
876  call append("$", " \tset fdls=" . &fdls)
877  call append("$", "foldcolumn\twidth of the column used to indicate folds")
878  call append("$", "\t(local to window)")
879  call <SID>OptionL("fdc")
880  call append("$", "foldtext\texpression used to display the text of a closed fold")
881  call append("$", "\t(local to window)")
882  call <SID>OptionL("fdt")
883  call append("$", "foldclose\tset to \"all\" to close a fold when the cursor leaves it")
884  call <SID>OptionG("fcl", &fcl)
885  call append("$", "foldopen\tspecifies for which commands a fold will be opened")
886  call <SID>OptionG("fdo", &fdo)
887  call append("$", "foldminlines\tminimum number of screen lines for a fold to be closed")
888  call append("$", "\t(local to window)")
889  call <SID>OptionL("fml")
890  call append("$", "commentstring\ttemplate for comments; used to put the marker in")
891  call <SID>OptionL("cms")
892  call append("$", "foldmethod\tfolding type: \"manual\", \"indent\", \"expr\", \"marker\" or \"syntax\"")
893  call append("$", "\t(local to window)")
894  call <SID>OptionL("fdm")
895  call append("$", "foldexpr\texpression used when 'foldmethod' is \"expr\"")
896  call append("$", "\t(local to window)")
897  call <SID>OptionL("fde")
898  call append("$", "foldignore\tused to ignore lines when 'foldmethod' is \"indent\"")
899  call append("$", "\t(local to window)")
900  call <SID>OptionL("fdi")
901  call append("$", "foldmarker\tmarkers used when 'foldmethod' is \"marker\"")
902  call append("$", "\t(local to window)")
903  call <SID>OptionL("fmr")
904  call append("$", "foldnestmax\tmaximum fold depth for when 'foldmethod is \"indent\" or \"syntax\"")
905  call append("$", "\t(local to window)")
906  call <SID>OptionL("fdn")
907endif
908
909
910if has("diff")
911  call <SID>Header("diff mode")
912  call append("$", "diff\tuse diff mode for the current window")
913  call append("$", "\t(local to window)")
914  call <SID>BinOptionL("diff")
915  call append("$", "diffopt\toptions for using diff mode")
916  call <SID>OptionG("dip", &dip)
917  call append("$", "diffexpr\texpression used to obtain a diff file")
918  call <SID>OptionG("dex", &dex)
919  call append("$", "patchexpr\texpression used to patch a file")
920  call <SID>OptionG("pex", &pex)
921endif
922
923
924call <SID>Header("mapping")
925call append("$", "maxmapdepth\tmaximum depth of mapping")
926call append("$", " \tset mmd=" . &mmd)
927call append("$", "remap\trecognize mappings in mapped keys")
928call <SID>BinOptionG("remap", &remap)
929call append("$", "timeout\tallow timing out halfway into a mapping")
930call <SID>BinOptionG("to", &to)
931call append("$", "ttimeout\tallow timing out halfway into a key code")
932call <SID>BinOptionG("ttimeout", &ttimeout)
933call append("$", "timeoutlen\ttime in msec for 'timeout'")
934call append("$", " \tset tm=" . &tm)
935call append("$", "ttimeoutlen\ttime in msec for 'ttimeout'")
936call append("$", " \tset ttm=" . &ttm)
937
938
939call <SID>Header("reading and writing files")
940call append("$", "modeline\tenable using settings from modelines when reading a file")
941call append("$", "\t(local to buffer)")
942call <SID>BinOptionL("ml")
943call append("$", "modelines\tnumber of lines to check for modelines")
944call append("$", " \tset mls=" . &mls)
945call append("$", "binary\tbinary file editing")
946call append("$", "\t(local to buffer)")
947call <SID>BinOptionL("bin")
948call append("$", "endofline\tlast line in the file has an end-of-line")
949call append("$", "\t(local to buffer)")
950call <SID>BinOptionL("eol")
951if has("multi_byte")
952  call append("$", "bomb\tprepend a Byte Order Mark to the file")
953  call append("$", "\t(local to buffer)")
954  call <SID>BinOptionL("bomb")
955endif
956call append("$", "fileformat\tend-of-line format: \"dos\", \"unix\" or \"mac\"")
957call append("$", "\t(local to buffer)")
958call <SID>OptionL("ff")
959call append("$", "fileformats\tlist of file formats to look for when editing a file")
960call <SID>OptionG("ffs", &ffs)
961call append("$", "textmode\tobsolete, use 'fileformat'")
962call append("$", "\t(local to buffer)")
963call <SID>BinOptionL("tx")
964call append("$", "textauto\tobsolete, use 'fileformats'")
965call <SID>BinOptionG("ta", &ta)
966call append("$", "write\twriting files is allowed")
967call <SID>BinOptionG("write", &write)
968call append("$", "writebackup\twrite a backup file before overwriting a file")
969call <SID>BinOptionG("wb", &wb)
970call append("$", "backup\tkeep a backup after overwriting a file")
971call <SID>BinOptionG("bk", &bk)
972call append("$", "backupskip\tpatterns that specify for which files a backup is not made")
973call append("$", " \tset bsk=" . &bsk)
974call append("$", "backupcopy\twhether to make the backup as a copy or rename the existing file")
975call append("$", " \tset bkc=" . &bkc)
976call append("$", "backupdir\tlist of directories to put backup files in")
977call <SID>OptionG("bdir", &bdir)
978call append("$", "backupext\tfile name extension for the backup file")
979call <SID>OptionG("bex", &bex)
980call append("$", "autowrite\tautomatically write a file when leaving a modified buffer")
981call <SID>BinOptionG("aw", &aw)
982call append("$", "autowriteall\tas 'autowrite', but works with more commands")
983call <SID>BinOptionG("awa", &awa)
984call append("$", "writeany\talways write without asking for confirmation")
985call <SID>BinOptionG("wa", &wa)
986call append("$", "autoread\tautomatically read a file when it was modified outside of Vim")
987call append("$", "\t(global or local to buffer)")
988call <SID>BinOptionG("ar", &ar)
989call append("$", "patchmode\tkeep oldest version of a file; specifies file name extension")
990call <SID>OptionG("pm", &pm)
991call append("$", "fsync\tforcibly sync the file to disk after writing it")
992call <SID>BinOptionG("fs", &fs)
993if !has("msdos")
994  call append("$", "shortname\tuse 8.3 file names")
995  call append("$", "\t(local to buffer)")
996  call <SID>BinOptionL("sn")
997endif
998call append("$", "cryptmethod\tencryption method for file writing: zip or blowfish")
999call append("$", "\t(local to buffer)")
1000call <SID>OptionL("cm")
1001
1002
1003call <SID>Header("the swap file")
1004call append("$", "directory\tlist of directories for the swap file")
1005call <SID>OptionG("dir", &dir)
1006call append("$", "swapfile\tuse a swap file for this buffer")
1007call append("$", "\t(local to buffer)")
1008call <SID>BinOptionL("swf")
1009call append("$", "swapsync\t\"sync\", \"fsync\" or empty; how to flush a swap file to disk")
1010call <SID>OptionG("sws", &sws)
1011call append("$", "updatecount\tnumber of characters typed to cause a swap file update")
1012call append("$", " \tset uc=" . &uc)
1013call append("$", "updatetime\ttime in msec after which the swap file will be updated")
1014call append("$", " \tset ut=" . &ut)
1015call append("$", "maxmem\tmaximum amount of memory in Kbyte used for one buffer")
1016call append("$", " \tset mm=" . &mm)
1017call append("$", "maxmemtot\tmaximum amount of memory in Kbyte used for all buffers")
1018call append("$", " \tset mmt=" . &mmt)
1019
1020
1021call <SID>Header("command line editing")
1022call append("$", "history\thow many command lines are remembered ")
1023call append("$", " \tset hi=" . &hi)
1024call append("$", "wildchar\tkey that triggers command-line expansion")
1025call append("$", " \tset wc=" . &wc)
1026call append("$", "wildcharm\tlike 'wildchar' but can also be used in a mapping")
1027call append("$", " \tset wcm=" . &wcm)
1028call append("$", "wildmode\tspecifies how command line completion works")
1029call <SID>OptionG("wim", &wim)
1030if has("wildoptions")
1031  call append("$", "wildoptions\tempty or \"tagfile\" to list file name of matching tags")
1032  call <SID>OptionG("wop", &wop)
1033endif
1034call append("$", "suffixes\tlist of file name extensions that have a lower priority")
1035call <SID>OptionG("su", &su)
1036if has("file_in_path")
1037  call append("$", "suffixesadd\tlist of file name extensions added when searching for a file")
1038  call append("$", "\t(local to buffer)")
1039  call <SID>OptionL("sua")
1040endif
1041if has("wildignore")
1042  call append("$", "wildignore\tlist of patterns to ignore files for file name completion")
1043  call <SID>OptionG("wig", &wig)
1044endif
1045if has("wildmenu")
1046  call append("$", "wildmenu\tcommand-line completion shows a list of matches")
1047  call <SID>BinOptionG("wmnu", &wmnu)
1048endif
1049if has("vertsplit")
1050  call append("$", "cedit\tkey used to open the command-line window")
1051  call <SID>OptionG("cedit", &cedit)
1052  call append("$", "cmdwinheight\theight of the command-line window")
1053  call <SID>OptionG("cwh", &cwh)
1054endif
1055call append("$", "undofile\tautomatically save and restore undo history")
1056call <SID>BinOptionG("udf", &udf)
1057call append("$", "undodir\tlist of directories for undo files")
1058call <SID>OptionG("udir", &udir)
1059
1060
1061call <SID>Header("executing external commands")
1062call append("$", "shell\tname of the shell program used for external commands")
1063call <SID>OptionG("sh", &sh)
1064if has("amiga")
1065  call append("$", "shelltype\twhen to use the shell or directly execute a command")
1066  call append("$", " \tset st=" . &st)
1067endif
1068call append("$", "shellquote\tcharacter(s) to enclose a shell command in")
1069call <SID>OptionG("shq", &shq)
1070call append("$", "shellxquote\tlike 'shellquote' but include the redirection")
1071call <SID>OptionG("sxq", &sxq)
1072call append("$", "shellcmdflag\targument for 'shell' to execute a command")
1073call <SID>OptionG("shcf", &shcf)
1074call append("$", "shellredir\tused to redirect command output to a file")
1075call <SID>OptionG("srr", &srr)
1076call append("$", "shelltemp\tuse a temp file for shell commands instead of using a pipe")
1077call <SID>BinOptionG("stmp", &stmp)
1078call append("$", "equalprg\tprogram used for \"=\" command")
1079call append("$", "\t(global or local to buffer)")
1080call <SID>OptionG("ep", &ep)
1081call append("$", "formatprg\tprogram used to format lines with \"gq\" command")
1082call <SID>OptionG("fp", &fp)
1083call append("$", "keywordprg\tprogram used for the \"K\" command")
1084call <SID>OptionG("kp", &kp)
1085call append("$", "warn\twarn when using a shell command and a buffer has changes")
1086call <SID>BinOptionG("warn", &warn)
1087
1088
1089if has("quickfix")
1090  call <SID>Header("running make and jumping to errors")
1091  call append("$", "errorfile\tname of the file that contains error messages")
1092  call <SID>OptionG("ef", &ef)
1093  call append("$", "errorformat\tlist of formats for error messages")
1094  call append("$", "\t(global or local to buffer)")
1095  call <SID>OptionG("efm", &efm)
1096  call append("$", "makeprg\tprogram used for the \":make\" command")
1097  call append("$", "\t(global or local to buffer)")
1098  call <SID>OptionG("mp", &mp)
1099  call append("$", "shellpipe\tstring used to put the output of \":make\" in the error file")
1100  call <SID>OptionG("sp", &sp)
1101  call append("$", "makeef\tname of the errorfile for the 'makeprg' command")
1102  call <SID>OptionG("mef", &mef)
1103  call append("$", "grepprg\tprogram used for the \":grep\" command")
1104  call append("$", "\t(global or local to buffer)")
1105  call <SID>OptionG("gp", &gp)
1106  call append("$", "grepformat\tlist of formats for output of 'grepprg'")
1107  call <SID>OptionG("gfm", &gfm)
1108endif
1109
1110
1111if has("msdos") || has("os2") || has("win16") || has("win32") || has("osfiletype")
1112  call <SID>Header("system specific")
1113  if has("msdos")
1114    call append("$", "bioskey\tcall the BIOS to get a keyoard character")
1115    call <SID>BinOptionG("biosk", &biosk)
1116    call append("$", "conskey\tuse direct console I/O to get a keyboard character")
1117    call <SID>BinOptionG("consk", &consk)
1118  endif
1119  if has("osfiletype")
1120    call append("$", "osfiletype\tOS-specific information about the type of file")
1121    call append("$", "\t(local to buffer)")
1122    call <SID>OptionL("oft")
1123  endif
1124  if has("msdos") || has("os2") || has("win16") || has("win32")
1125    call append("$", "shellslash\tuse forward slashes in file names; for Unix-like shells")
1126    call <SID>BinOptionG("ssl", &ssl)
1127  endif
1128endif
1129
1130
1131call <SID>Header("language specific")
1132call append("$", "isfname\tspecifies the characters in a file name")
1133call <SID>OptionG("isf", &isf)
1134call append("$", "isident\tspecifies the characters in an identifier")
1135call <SID>OptionG("isi", &isi)
1136call append("$", "iskeyword\tspecifies the characters in a keyword")
1137call append("$", "\t(local to buffer)")
1138call <SID>OptionL("isk")
1139call append("$", "isprint\tspecifies printable characters")
1140call <SID>OptionG("isp", &isp)
1141if has("textobjects")
1142  call append("$", "quoteescape\tspecifies escape characters in a string")
1143  call append("$", "\t(local to buffer)")
1144  call <SID>OptionL("qe")
1145endif
1146if has("rightleft")
1147  call append("$", "rightleft\tdisplay the buffer right-to-left")
1148  call append("$", "\t(local to window)")
1149  call <SID>BinOptionL("rl")
1150  call append("$", "rightleftcmd\twhen to edit the command-line right-to-left")
1151  call append("$", "\t(local to window)")
1152  call <SID>OptionL("rlc")
1153  call append("$", "revins\tinsert characters backwards")
1154  call <SID>BinOptionG("ri", &ri)
1155  call append("$", "allowrevins\tallow CTRL-_ in Insert and Command-line mode to toggle 'revins'")
1156  call <SID>BinOptionG("ari", &ari)
1157  call append("$", "aleph\tthe ASCII code for the first letter of the Hebrew alphabet")
1158  call append("$", " \tset al=" . &al)
1159  call append("$", "hkmap\tuse Hebrew keyboard mapping")
1160  call <SID>BinOptionG("hk", &hk)
1161  call append("$", "hkmapp\tuse phonetic Hebrew keyboard mapping")
1162  call <SID>BinOptionG("hkp", &hkp)
1163endif
1164if has("farsi")
1165  call append("$", "altkeymap\tuse Farsi as the second language when 'revins' is set")
1166  call <SID>BinOptionG("akm", &akm)
1167  call append("$", "fkmap\tuse Farsi keyboard mapping")
1168  call <SID>BinOptionG("fk", &fk)
1169endif
1170if has("arabic")
1171  call append("$", "arabic\tprepare for editing Arabic text")
1172  call append("$", "\t(local to window)")
1173  call <SID>BinOptionL("arab")
1174  call append("$", "arabicshape\tperform shaping of Arabic characters")
1175  call <SID>BinOptionG("arshape", &arshape)
1176  call append("$", "termbidi\tterminal will perform bidi handling")
1177  call <SID>BinOptionG("tbidi", &tbidi)
1178endif
1179if has("keymap")
1180  call append("$", "keymap\tname of a keyboard mappping")
1181  call <SID>OptionL("kmp")
1182endif
1183if has("langmap")
1184  call append("$", "langmap\ttranslate characters for Normal mode")
1185  call <SID>OptionG("lmap", &lmap)
1186endif
1187if has("xim")
1188  call append("$", "imdisable\twhen set never use IM; overrules following IM options")
1189  call <SID>BinOptionG("imd", &imd)
1190endif
1191call append("$", "iminsert\tin Insert mode: 1: use :lmap; 2: use IM; 0: neither")
1192call append("$", "\t(local to window)")
1193call <SID>OptionL("imi")
1194call append("$", "imsearch\tentering a search pattern: 1: use :lmap; 2: use IM; 0: neither")
1195call append("$", "\t(local to window)")
1196call <SID>OptionL("ims")
1197if has("xim")
1198  call append("$", "imcmdline\twhen set always use IM when starting to edit a command line")
1199  call <SID>BinOptionG("imc", &imc)
1200endif
1201
1202
1203if has("multi_byte")
1204  call <SID>Header("multi-byte characters")
1205  call append("$", "encoding\tcharacter encoding used in Vim: \"latin1\", \"utf-8\"")
1206  call append("$", "\t\"euc-jp\", \"big5\", etc.")
1207  call <SID>OptionG("enc", &enc)
1208  call append("$", "fileencoding\tcharacter encoding for the current file")
1209  call append("$", "\t(local to buffer)")
1210  call <SID>OptionL("fenc")
1211  call append("$", "fileencodings\tautomatically detected character encodings")
1212  call <SID>OptionG("fencs", &fencs)
1213  call append("$", "termencoding\tcharacter encoding used by the terminal")
1214  call <SID>OptionG("tenc", &tenc)
1215  call append("$", "charconvert\texpression used for character encoding conversion")
1216  call <SID>OptionG("ccv", &ccv)
1217  call append("$", "delcombine\tdelete combining (composing) characters on their own")
1218  call <SID>BinOptionG("deco", &deco)
1219  call append("$", "maxcombine\tmaximum number of combining (composing) characters displayed")
1220  call <SID>OptionG("mco", &mco)
1221  if has("xim") && has("gui_gtk")
1222    call append("$", "imactivatekey\tkey that activates the X input method")
1223    call <SID>OptionG("imak", &imak)
1224  endif
1225  call append("$", "ambiwidth\twidth of ambiguous width characters")
1226  call <SID>OptionG("ambw", &ambw)
1227endif
1228
1229
1230call <SID>Header("various")
1231if has("virtualedit")
1232  call append("$", "virtualedit\twhen to use virtual editing: \"block\", \"insert\" and/or \"all\"")
1233  call <SID>OptionG("ve", &ve)
1234endif
1235if has("autocmd")
1236  call append("$", "eventignore\tlist of autocommand events which are to be ignored")
1237  call <SID>OptionG("ei", &ei)
1238endif
1239call append("$", "loadplugins\tload plugin scripts when starting up")
1240call <SID>BinOptionG("lpl", &lpl)
1241call append("$", "exrc\tenable reading .vimrc/.exrc/.gvimrc in the current directory")
1242call <SID>BinOptionG("ex", &ex)
1243call append("$", "secure\tsafer working with script files in the current directory")
1244call <SID>BinOptionG("secure", &secure)
1245call append("$", "gdefault\tuse the 'g' flag for \":substitute\"")
1246call <SID>BinOptionG("gd", &gd)
1247call append("$", "edcompatible\t'g' and 'c' flags of \":substitute\" toggle")
1248call <SID>BinOptionG("ed", &ed)
1249if exists("+opendevice")
1250  call append("$", "opendevice\tallow reading/writing devices")
1251  call <SID>BinOptionG("odev", &odev)
1252endif
1253if exists("+maxfuncdepth")
1254  call append("$", "maxfuncdepth\tmaximum depth of function calls")
1255  call append("$", " \tset mfd=" . &mfd)
1256endif
1257if has("mksession")
1258  call append("$", "sessionoptions\tlist of words that specifies what to put in a session file")
1259  call <SID>OptionG("ssop", &ssop)
1260  call append("$", "viewoptions\tlist of words that specifies what to save for :mkview")
1261  call <SID>OptionG("vop", &vop)
1262  call append("$", "viewdir\tdirectory where to store files with :mkview")
1263  call <SID>OptionG("vdir", &vdir)
1264endif
1265if has("viminfo")
1266  call append("$", "viminfo\tlist that specifies what to write in the viminfo file")
1267  call <SID>OptionG("vi", &vi)
1268endif
1269if has("quickfix")
1270  call append("$", "bufhidden\twhat happens with a buffer when it's no longer in a window")
1271  call append("$", "\t(local to buffer)")
1272  call <SID>OptionL("bh")
1273  call append("$", "buftype\t\"\", \"nofile\", \"nowrite\" or \"quickfix\": type of buffer")
1274  call append("$", "\t(local to buffer)")
1275  call <SID>OptionL("bt")
1276endif
1277call append("$", "buflisted\twhether the buffer shows up in the buffer list")
1278call append("$", "\t(local to buffer)")
1279call <SID>BinOptionL("bl")
1280call append("$", "debug\tset to \"msg\" to see all error messages")
1281call append("$", " \tset debug=" . &debug)
1282if has("mzscheme")
1283  call append("$", "mzquantum\tinterval in milliseconds between polls for MzScheme threads")
1284  call append("$", " \tset mzq=" . &mzq)
1285endif
1286
1287set cpo&vim
1288
1289" go to first line
12901
1291
1292" reset 'modified', so that ":q" can be used to close the window
1293setlocal nomodified
1294
1295if has("syntax")
1296  " Use Vim highlighting, with some additional stuff
1297  setlocal ft=vim
1298  syn match optwinHeader "^ \=[0-9].*"
1299  syn match optwinName "^[a-z]*\t" nextgroup=optwinComment
1300  syn match optwinComment ".*" contained
1301  syn match optwinComment "^\t.*"
1302  if !exists("did_optwin_syntax_inits")
1303    let did_optwin_syntax_inits = 1
1304    hi link optwinHeader Title
1305    hi link optwinName Identifier
1306    hi link optwinComment Comment
1307  endif
1308endif
1309
1310" Install autocommands to enable mappings in option-window
1311noremap <silent> <buffer> <CR> <C-\><C-N>:call <SID>CR()<CR>
1312inoremap <silent> <buffer> <CR> <Esc>:call <SID>CR()<CR>
1313noremap <silent> <buffer> <Space> :call <SID>Space()<CR>
1314
1315" Make the buffer be deleted when the window is closed.
1316setlocal buftype=nofile bufhidden=delete noswapfile
1317
1318augroup optwin
1319  au! BufUnload,BufHidden option-window nested
1320	\ call <SID>unload() | delfun <SID>unload
1321augroup END
1322
1323fun! <SID>unload()
1324  delfun <SID>CR
1325  delfun <SID>Space
1326  delfun <SID>Find
1327  delfun <SID>Update
1328  delfun <SID>OptionL
1329  delfun <SID>OptionG
1330  delfun <SID>BinOptionL
1331  delfun <SID>BinOptionG
1332  delfun <SID>Header
1333  au! optwin
1334endfun
1335
1336" Restore the previous value of 'title' and 'icon'.
1337let &title = s:old_title
1338let &icon = s:old_icon
1339let &ru = s:old_ru
1340let &sc = s:old_sc
1341let &cpo = s:cpo_save
1342unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum
1343