optwin.vim 55 KB

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