home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume41 / vim / part12 < prev    next >
Text File  |  1993-12-20  |  52KB  |  1,588 lines

  1. Newsgroups: comp.sources.misc
  2. From: mool@oce.nl (Bram Moolenaar)
  3. Subject: v41i062:  vim - Vi IMitation editor, v2.0, Part12/25
  4. Message-ID: <1993Dec21.035036.28379@sparky.sterling.com>
  5. X-Md4-Signature: 280646c5e2a950ad3a4719a4d0f2848b
  6. Keywords: utility, editor, vi, vim
  7. Sender: kent@sparky.sterling.com (Kent Landfield)
  8. Organization: Sterling Software
  9. Date: Tue, 21 Dec 1993 03:50:36 GMT
  10. Approved: kent@sparky.sterling.com
  11.  
  12. Submitted-by: mool@oce.nl (Bram Moolenaar)
  13. Posting-number: Volume 41, Issue 62
  14. Archive-name: vim/part12
  15. Environment: UNIX, AMIGA, MS-DOS
  16. Supersedes: vim: Volume 37, Issue 1-24
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 12 (of 25)."
  25. # Contents:  vim/readme2.0 vim/src/param.c
  26. # Wrapped by mool@oce-rd2 on Wed Dec 15 09:50:06 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'vim/readme2.0' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'vim/readme2.0'\"
  30. else
  31. echo shar: Extracting \"'vim/readme2.0'\" \(23966 characters\)
  32. sed "s/^X//" >'vim/readme2.0' <<'END_OF_FILE'
  33. XThis is a summary of the modifications from Vim version 1.27 to version 2.0.
  34. X
  35. XIncompatible changes
  36. X====================
  37. X
  38. XThe 'exrc' and 'secure' options are default off. If you want Vim to read a
  39. X.exrc or .vimrc in the current directory, you will have to set 'exrc' in your
  40. Xglobal .exrc or .vimrc. People doing this are supposed to know about the
  41. Xsecurity problems, so they don't need the 'secure' option set. This is also
  42. Xmore vi-compatible.
  43. X
  44. XRenamed quoting to visual select and swapped 'q' and 'v' keys to avoid
  45. Xproblems with CTRL-Q. This is also more Elvis compatible. The commands now are:
  46. X    'v'        start character-wise visual select
  47. X    'V'        start line-wise visual select
  48. X    CTRL-V        start block-wise visual select
  49. X
  50. X    'q'        start recording
  51. X    'Q'        formatting operator
  52. X
  53. XChanged CTRL-R into CTRL-Y for insert mode (copy character from line above).
  54. XThis is more logical when comparing the meaning of CTRL-E and CTRL-Y in
  55. Xcommand mode and insert mode.
  56. X
  57. XReplaced CTRL-B with CTRL-R (insert contents of a register) in insert mode.
  58. XThis mnemonic is more logical, because "register" is used in the documentation. 
  59. X
  60. XAdded ":pwd" command and made ":cd" without an argument for Unix go to home
  61. Xdirectory. This is more vi-compatible and behaves the same as the unix cd
  62. Xcommand. The ":cd" command for MSDOS and Amiga versions is unchanged, these
  63. Xmachines don't have a home directory.
  64. X
  65. XWith the 'confirm' option to :s anything but 'y', 'n', ESC, CTRL-C or 'q' is
  66. Xignored. Nothing happens until you type a valid character. Quit substitution
  67. Xwith <q>, ESC and CTRL-C. 
  68. X
  69. XSwapped 'u' and 'U' for visual mode. 'u' makes lower case, 'U' upper. This is
  70. Xmore logical.
  71. X
  72. XAdded 'wildchar' option for filename completion. The default is <TAB> instead
  73. Xof <ESC>. Most other programs use this and it avoids problems with terminal
  74. Xsequences that start with <ESC> (one second wait before filename completion
  75. Xstarts).
  76. X
  77. XChanged short name of 'showmode' option from "mo" to "smd".
  78. X
  79. XChanged short name of 'modelines' from 'ml' into 'mls'. This is vi-compatible.
  80. X
  81. XChanged meaning of the argument to :cf. The 'errorfile' option will now be
  82. Xset to the argument.
  83. X
  84. X
  85. XMajor improvements
  86. X==================
  87. X
  88. XAdded horizontal scrolling and 'wrap' option. This allows the user to choose
  89. Xbetween line wrap (you see all the text but long lines mess up the layout)
  90. Xand horizontal scrolling (correct layout but you see only a part of long
  91. Xlines).
  92. X
  93. XAdded 'sidescroll' option. It is the number of columns to jump when the
  94. Xcursor gets off of the screen while the 'wrap' option is off. The default is
  95. X0, which means that the cursor is centered on the screen. Set it to a small
  96. Xnumber if you have fast screen I/O.
  97. X
  98. XWildcard expansion has been made more compatible with other programs. Added
  99. X'wildchar' option; default is <TAB> instead of <ESC>. With multiple matches
  100. Xfirst match is inserted. CTRL-A inserts all matches. With CTRL-D command: If
  101. Xfile is a dir '/' is added. WILD_CARDS code now always included, no
  102. Xcompile-time option anymore. 'wildchar' is only recognized when typed, not in
  103. Xa macro (prevents problems with macros containing TABs).
  104. X
  105. XCTRL-L on commandline inserts longest common part of filename completion. Now
  106. Xyou can choose between using TAB (or 'wildchar') for getting the first match
  107. Xor CTRL-L for getting the longest match.
  108. X
  109. XAdded automatic textmode (lines ending in CR-LF instead of LF) detection and
  110. X'textauto' option. This works when starting to edit a file and when doing a
  111. X":r" command. This is useful on MS-DOS systems with a network file system and
  112. Xwhen editing an MS-DOS floppy on Unix or Amiga. Added [(no)textmode] message
  113. Xto readfile() and writeit(). Now you can see when unexpected line separators
  114. Xhave been detected or are being used.
  115. X
  116. XAdded "-b" command line option. This makes it more easy to edit binary files
  117. Xwithout unexpected effects.
  118. X
  119. XAdded ":make" command, 'errorformat' option and argument to -e option. Now you
  120. Xcan do your compiling from within Vim and automatically jump to the line where
  121. Xthe error is. Can be adjusted to work with many compilers. The command to be
  122. Xexecuted with ":make" can be set with the  'makeprg' option. '%' and '#' in
  123. Xthe 'makeprg' option are expanded as usual in a command line. 
  124. X
  125. XAdded reverse insert mode, 'revins' option and CTRL-P command. Now you can
  126. Xtype backwards!
  127. X
  128. XAdded abbreviations. They work in insert mode and in command line mode, just
  129. Xlike Vi. Also added :iabbr, :cabbr and friends: abbreviations for command line
  130. Xonly or insert mode only. Added dumping of abbreviations to :mkexrc.
  131. X
  132. XAdded ":center" (center the lines), ":left" (left adjustment) and ":right"
  133. X(right adjustment). ":center" and ":right" use the 'textwith' option.
  134. X
  135. XAdded bios calls for MSDOS screen output, ansi.sys no longer required.
  136. XScreen updating much faster now and works with more video modes. Added pcansi
  137. Xtermcap for when not using the console.
  138. X
  139. X
  140. XOther improvements
  141. X==================
  142. X
  143. XIf 'expandtab' is set, spaces will also be used in indents.
  144. X
  145. X'tabstop' maximum removed.
  146. X
  147. XDigraphs also work in the command line.
  148. X
  149. XAdded :redo, same as CTRL-R.
  150. X
  151. XAdded '-x' option for the Amiga version. The current window will be used, but
  152. Xshell commands are not possible. Handy when starting Vim from a mail program.
  153. X
  154. XAdded 'secure' option. When reset you don't get the warnings from reading a
  155. X.vimrc/.exrc file in the current directory.
  156. X
  157. XAdded 'exrc' option. Now you can switch the reading of ".exrc/.vimrc" off.
  158. X
  159. XAdded "vim:" modelines. Other vi versions allowed all ex commands in
  160. Xmodelines, vim only allows set commands. Use "vim:" to avoid confusion.
  161. X
  162. XOptimized position of ruler and shown command.
  163. X
  164. XImproved redrawing of long command lines.
  165. X
  166. XAdded <SC_UP> and <SC_DOWN> to command line editing. This finds the
  167. Xnext/previous command that starts with the text in front of the cursor.
  168. X
  169. XAdded CTRL-B and CTRL-E to command line editing. Go to begin/end of the
  170. Xcommand line.
  171. X
  172. XWith ":w!" readonly is reset.
  173. X
  174. XIf possible the cursor is switched off while visual selecting. Makes it more
  175. Xclear what is selected.
  176. X
  177. XFormat deletes blanks at end of lines. This makes it possible to use
  178. Xformatting to limit the text to a certain number of columns (e.g. 80).
  179. X
  180. XModelines quits after first error. This avoids a long list of errors when
  181. Xediting a text with "vi:" accidently embedded (e.g. vim.hlp).
  182. X
  183. XOptimized undo for delete. Now only 2/3 of the memory used and less copying of
  184. Xlines. Speed up when deleting a lot of lines in a big file.
  185. X
  186. XAdded :suspend, same as CTRL-Z.
  187. X
  188. XAdded command-line-only mapping ":cmap", insert-mode-only ":imap" and the
  189. Xassociated unmap and noremap commands. Now you can enter mappings for every
  190. Xmode (command/insert/command-line) separately.
  191. X
  192. XChanged smart-indent a little.
  193. X
  194. XNow one free chunk list per allocated block in storage.c. Makes editing big
  195. Xfiles a bit faster.
  196. X
  197. XAdded repeat to visual select. now you can select the same area again.
  198. X
  199. XImproved showmatch() for uneven number of quotes.
  200. X
  201. XAdded 'paste' option. This makes it easy to swith between typing and inserting
  202. Xtext with a cut/paste method. Doing ":set nopaste" before ":set paste" does
  203. Xnot do anything. 
  204. X
  205. XAdded sFilename: Filename without path. Mostly only the name you typed is
  206. Xshown, but internally the full path name is remembered. Otherwise the ":cd"
  207. Xcommand would mess up the real file name. Use short file name as long as :cd
  208. Xnot used. If one does not use :cd the short file name will be valid. This
  209. Xwill avoid long path names to be printed on the status line and having to
  210. X"hit return to continue". It is also better to avoid problems with some
  211. Xnetworks where the absolute path is not valid after a while. If :cd has been
  212. Xused the full path name needs to be used to get to the right file.
  213. X
  214. XChanged :digraph in :digraphs. Now "digraph" and "digraphs" both work.
  215. X
  216. XAdded emsg2() for more informative error messages. For example: "Cannot open
  217. X<filename> for writing" with :mkexrc.
  218. X
  219. XMade 'r' command use get_literal(). Now you enter the decimal code for the
  220. Xreplacement character with CTRL-V nnn, where nnn is any decimal number.
  221. X
  222. XAdded default digraphs for MSDOS.
  223. X
  224. XAdded 'timoutlen' option. One can set this depending on the speed of the
  225. Xterminal used. Helps when cursor keys start with ESC while working on the
  226. Xconsole: get out of insert mode fast. Or when using a terminal over a very
  227. Xslow line, although you better set 'notimeout' then.
  228. X
  229. XAdded wildcard expansion to tags, so environment variables in the file name
  230. Xget expanded.
  231. X
  232. XNo error message for a non-existant tags file, only for a not-found tag.
  233. X
  234. XExpandWildCards() in unix.c does not start the shell when there are no
  235. Xwildcards. Speeds up editing new files.
  236. X
  237. X:set can now show several values in one command, e.g. ":set columns lines".
  238. X
  239. XIn MSDOS use $COMSPEC to init 'shell' option.
  240. X
  241. XAdded 'formatprg' option for external formatting. This is the program to use
  242. Xwhen the 'Q' command is given. If it is an empty string (which is the
  243. Xdefault) the internal formatting is used.
  244. X
  245. XMade ioctl() first in mch_get_winsize() in unix.c. The environment variables
  246. Xare now only used if the ioctl() fails. This works without problems on more
  247. Xsystems.
  248. X
  249. XAdded second column number to ruler. Now you can see both the column number
  250. Xin the file and on the screen.
  251. X
  252. XWith MSDOS also accept '/' as file name separator. Works better in combination
  253. Xwith 4dos.
  254. X
  255. XScreen redrawn after t_tp set. You can now directly see the result of the new
  256. Xcolors.
  257. X
  258. XImproved error handling from write() in writeit(). Made the write_buf
  259. Xfunction to repeat write() until all characters have been written or an error
  260. Xis detected. Fixes a possible problem with signals (which has never been
  261. Xreported).
  262. X
  263. XWorkaround for cursor key that sends ^H. The televideo 925 sends codes for
  264. Xcursor keys that cannot be distinguished from normal commands. At least the
  265. Xbackspace is working again now.
  266. X
  267. XIf you are using a csh use 'glob' instead of 'echo' in WildExpand in unix.c.
  268. XThis makes it possible to find file names with embedded spaces. Spaces in the
  269. Xentered file name are still not possible (vi can't do it either).
  270. X
  271. XCall_shell() in unix.c uses fork/exec instead of system. This makes it about
  272. Xtwice as fast and fixes problems with special characters in the command, e.g.
  273. X"!!awk '{ print "ok" }'.
  274. X
  275. XFixed call_shell in amiga.c for space in shell option. You can now give
  276. Xoptions to the shell command, but the name of the shell cannot contain
  277. Xspaces anymore (big deal).
  278. X
  279. XWarn if no inversion is possible. Poor user, now you can't use visual select.
  280. X
  281. XUse termcap entries 'se' and 'so' when 'mr' or 'me' are not available. Makes
  282. Xusing inversion possible on more terminals.
  283. X
  284. XAdded 'esckeys' option. If your special keys have codes that start with an
  285. XESC you can switch them off in insert mode. When typing ESC you will
  286. Xdirectly exit insert mode, instead of having to wait for more characters to
  287. Xfind out if it might be a special key.
  288. X
  289. XAdded register name "% for the current file name. Handy when you want to use
  290. Xthe current file name in macros.
  291. X
  292. XAdded <"> as a name for the unnamed register. Added the use of more registers
  293. Xto some commands.
  294. X
  295. XAdded expansion of environment variable to most string parameters. Any non-id
  296. Xcharacter can be used after the environment variable name.
  297. X
  298. XTrailing '/' in 'dir' option not required.
  299. X
  300. XAdded [Not edited] message to ":file".
  301. X
  302. XIf errors occur when starting to edit a file (e.g. out of memory) the
  303. Xreadonly flag is set to prevent accidently overwriting the original file with
  304. Xa truncated version.
  305. X
  306. XTrailing spaces are removed from ":" commands (except map, abbreviate, ":s",
  307. X":g" and ":!" commands and after <|>). Useful when accidently typing a space
  308. Xafter a filename.
  309. X
  310. XAdded TIOCLGET to mch_settmode() in unix.c. Restores some terminal settings
  311. Xafter exiting Vim.
  312. X
  313. XA "recursive mapping" followed by another "recursive mapping" would loop
  314. Xvery long.
  315. X
  316. XAllow entering CTRL-@ in command line mode.
  317. X
  318. XAdded 'A' - 'Z' for helpfile pages. You can add your own pages if you like.
  319. X
  320. XDisplay several help pages at once on a big screen.
  321. X
  322. XDon't give ".vim file exists" message when recovering.
  323. X
  324. XPut command line terminated with ESC in history. If you accidently try to
  325. Xuse ESC for wildcard completion, you can get back what you typed.
  326. X
  327. XChanged display method for CTRL-D on command line. Now the redraw is done
  328. Xafter the whole command line has been entered. Big speed win on slow
  329. Xterminals.
  330. X
  331. XDon't call flushbuf() in normal() when p_sc is off (speeds up "x").
  332. X
  333. XDon't redisplay in main() when there is something in the stuff buffer. Speeds
  334. Xup display a bit.
  335. X
  336. X:tag shows short filename. Reduces the need for "hit return to continue".
  337. X
  338. XAdded "#<" for command line: current filename without extension.
  339. X
  340. XChanged digraphs 208 and 240. Fixed digraph 172.
  341. X
  342. XIn help mode the keys CTRL-B and CTRL-F go one page back or forward. With
  343. XMSDOS page-up and page-down can also be used.
  344. X
  345. XImplemented the drive specifier for the :cd command on MSDOS, ":cd c:" goes
  346. Xto the C drive.
  347. X
  348. XImplemented FullName for msdos. Makes ":cd" really work.
  349. X
  350. XWhen the cursor is off the screen, put it at 1/2 of the screen. Used to be 1/3
  351. Xor 2/3, depending on the direction.
  352. X
  353. X
  354. XBug fixes
  355. X=========
  356. X
  357. XFixed small screen updating bug in dodelete().
  358. X
  359. XInserting tab in Replace mode with 'et' option set did not delete char.
  360. X
  361. XFixed bug when start and end of operator are the same, e.g. "^d^".
  362. X
  363. XFixed 'w' on last word in file and 'b' on first word in the file.
  364. X
  365. XFixed 'dw' on empty line.
  366. X
  367. XFixed storage.c for 64 bit longs.
  368. X
  369. XFixed :w[!]>>newfile. Without the '!' the file must already exist.
  370. X
  371. XIn insert mode ^O had to be typed twice before the change command.
  372. X
  373. XFixed ":r !ls *". Wildcard expansion was done on "!ls".
  374. X
  375. XChanged flag not reset with ":w !wc".
  376. X
  377. XAfter CTRL-C go to normal mode. You could end up in insert mode when
  378. Xinterrupting a macro (e.g. with the maze solving macros).
  379. X
  380. Xdoarglist() called FreeWild() with argv[]. This could cause a crash!
  381. X
  382. XRepaired FullName() in unix.c. Now "../" and links are correctly dealth with.
  383. XAdded error handling. If a file or directory does not exist this is dealth
  384. Xwith correctly.
  385. X
  386. XFixed ":g/pat/p". There is now a wait for "hit return" at the end.
  387. XAlso fixed a double redraw.
  388. X
  389. XChanged key codes for MSDOS. The old ones overlapped with a few useful
  390. Xaccented characters. Now only some graphics characters cannot be entered
  391. Xdirectly from the keyboard.
  392. X
  393. XDelete "recording" when p_smd is off.
  394. X
  395. XFixed ":/pat" on last line. It would give an "illegal nr" error.
  396. X
  397. XFixed "invalid chunk" bug in insertchar(). Too many blanks were deleted when
  398. Xdoing text formatting when the cursor is just after several blanks.
  399. X
  400. XBlockwise quoting did not work with upper case operators.
  401. X
  402. XRemoved forceit from getfile(); makes autowrite work with CTRL-^ after :n!.
  403. X
  404. XNo beep when search fails. When errorbells option was set you would get two
  405. Xbeeps.
  406. X
  407. XIsdir() in msdos.c now returns -1 when file does not exist. It would see a
  408. Xnon-existant file as a directory.
  409. X
  410. XFixed [new file] message for MSDOS.
  411. X
  412. XFixed screen updating in edit.c when entering CTRL-V TAB in front of a TAB.
  413. XThe '^' would not be deleted.
  414. X
  415. XMade t_ options working again. You couldn't set them at all!
  416. X
  417. XSetting a terminal option to an empty string caused a hang.
  418. X
  419. XChanged flag was set for an option when it was printed.
  420. X
  421. XFixed makeset() for spaces in string options. Now a backslash is prepended.
  422. X
  423. XFixed makemap() for special characters. Now a CTRL-V is prepended.
  424. X
  425. XFixed dosource() for a line containing CTRL-V newline. The following line is
  426. Xnow appended.
  427. X
  428. XMakeset() and makemap() add '\r' for MSDOS.
  429. X
  430. X'r' command no longer uses replace mode, except for CR, LF and TAB. Some
  431. Xreplacement characters would give strange results, e.g. CTRL-O.
  432. X
  433. XFixed screen updating with ":s/a/A/gc". Now the screen is updated after each
  434. Xreplacement, not after finishing a line.
  435. X
  436. XFixed MSDOS problem in lalloc(): Cannot handle block >64K.
  437. X
  438. XFixed bug in writeit(): Faulty write to memory when write() fails. This was a
  439. Xnasty one, caused my Amiga to crash when writing to a full disk!
  440. X
  441. XFixed problem with cursor keys in xterm. This stupid terminal emulator sends
  442. Xonly one character at each read().
  443. X
  444. XFixed problem with linewise visual and 'o' command. The column would be
  445. Xchanged, making the visual mode character wise.
  446. X
  447. XFixed bug in u_undoredo() when newsize and oldsize are both zero. You would
  448. Xget an error message when doing "!!foo", 'u', CTRL-R, 'u', when the command
  449. X'foo' does not exist.
  450. X
  451. XFixed bug: not doing all lines with ":%s/ /^M/g" in dosub(). The number of
  452. Xlines processed was not incremented by the number of new lines created.
  453. X
  454. XFixed crash caused by call to MatchEnd() while using ARP. This would mean
  455. Xthat you could not use Vim with DOS 1.3. Only one person complained! Is
  456. Xnobody using 1.3 anymore?
  457. X
  458. XIn out-of-memory situations writeit() would fail. It needed to allocate a
  459. Xbuffer of 4K. It would be impossible to save your changes! Now a small
  460. Xemergency buffer is used.
  461. X
  462. XFixed illegal memory access when not-set terminal option was printed.
  463. X
  464. XFixed hang with V~ on last line in file when the line was empty.
  465. X
  466. XFixed crash when typing "//".
  467. X
  468. XUpdated builtin termcap entry for xterm. Function keys now work.
  469. X
  470. XFixed bug with allocating argv in call_shell() for unix. Could cause a crash.
  471. X
  472. XFixed deletion of "no write since last change" message with :q command.
  473. X
  474. XAdded call to screenalloc() in screenclear(), fixes crash when resizing
  475. Xwindow while viewing help. 
  476. X
  477. XFixed screen updating with '$' in block mode.
  478. X
  479. XRedisplay INSERT message after visual bell.
  480. X
  481. XFixed backspace in column 1 in reverse insert mode.
  482. XFixed "illegal nr" when doing i^P^H in an empty file.
  483. X
  484. XFixed ruler on empty line. Column number was wrong.
  485. X
  486. XTypehead not flushed with every error, fixes problems with 'notimeout' and
  487. Xerrors in scripts (recovery!).
  488. X
  489. XNo beep with "qxq".
  490. X
  491. XAdded setting of Changed flag to readfile(), needed for :r !cmd.
  492. X
  493. XJumplist entries were not deleted properly, causing "no alternate file" and
  494. X"illegal nr" errors.
  495. X
  496. XFixed entering CTRL-V CTRL-@ in insert mode.
  497. X
  498. XDefault values for 'showcommand' and 'showmode' for unix exchanged.
  499. X
  500. XPut braces around filter command for unix, allows ":r! echo this; echo that".
  501. X
  502. XFixed screen redraw after ".vim file exists" message with :e command.
  503. X
  504. XChanged CTRL-W for insert mode: stop before spaces.
  505. X
  506. XWhen changing more than 8000 lines at once undo is prohibited on Amiga and
  507. XMSDOS (used to cause out of memory errors with "10000dd").
  508. X
  509. XFixed problem with undo after delete without undo. (?)
  510. X
  511. XFixed error messages with ":set".
  512. X
  513. XTerminal type not reset to default with ":set term=xxx", where xxx is not a
  514. Xvalid terminal type.
  515. X
  516. XFixed problem in search pattern: With 'ignorecase' set the first character
  517. Xafter '*' was case-sensitive.
  518. X
  519. XUpdate screen with ":g/the/s//THE/c".
  520. X
  521. XWith "hit return" use command-mode mappings.
  522. X
  523. XFixed "(" and ")" for sentence ending at end of line.
  524. X
  525. XFixed screen updating with very long lines. Cursor could end up in the middle
  526. Xof nowhere.
  527. X
  528. XFixed message for yank with blockwise visual (was one line off).
  529. X
  530. XFixed :copy when destination is within source range.
  531. X
  532. X"r" in visual mode wanted to get another character.
  533. X
  534. XWith 'nowrapscan' "Q}" scrolled the screen horizontally.
  535. X
  536. XDon't allocate screen if Rows or Columns is 0.
  537. X
  538. XFixed CTRL-D in insert mode: First round indent to multiple of shiftwidth.
  539. X
  540. X"z<number><CR>" is limited to physical screen height. Fixes screen updating
  541. Xproblems when set to large number. Also fixed screen updating for CTRL-D on
  542. Xcommand line and for ":set all".
  543. X
  544. XRe-inserted forceit in getfile to make ":ta!" work. Now forceit is reset at
  545. Xthe end of DoOneCmd() to keep CTRL-^ working.
  546. X
  547. XCheck for :unmap without valid number of arguments in domap(). Ctrl-V was
  548. Xremoved twice from :unmap.
  549. X
  550. XAdded noremaplist in buffers.c; makes mixing @a and noremap mappings work.
  551. X
  552. XDo not check for terminal-code in mapped characters.
  553. X
  554. XRecording now stores the trailing 'q' in the register; the 'q' command is
  555. Xdisabled while executing a register (solves problem when final 'q' is result
  556. Xfrom mapping).
  557. X
  558. XFixed '\~' in substitute string being recognized as '~'.
  559. X
  560. XFixed ":s/ */ /g", inserted one space per line instead of one space per
  561. Xcharacter.
  562. X
  563. XFixed ungetchr() in regexp.c: backslashed characters were not handled
  564. Xcorrectly.
  565. X
  566. XFixed screen being messed up with long commands when 'sc' is set.
  567. X
  568. X
  569. XVi-compatibility fixes
  570. X======================
  571. X
  572. XWhen not editing last file in a file list, typing :q twice will quit.
  573. X
  574. XAdded [readonly] to fileinfo(). 
  575. X
  576. XUndo in macros allowed. But it only works correctly once.
  577. X
  578. XAdded hidden options to avoid error messages when reading .exrc.
  579. X
  580. XAllow '-ttag' (no space after -t) on command line.
  581. X
  582. XChanged short name for 'showmode' option from "mo" to "smd".
  583. X
  584. XAdded check for "view" in main(). Vim will start in readonly mode. On Unix you
  585. Xcan make a link from "view" to "vim".
  586. X
  587. XUndo keeps marks if line count does not change.
  588. X
  589. XFixed operators to be linewise in some cases.
  590. X
  591. XCTRL-Z is :stop instead of :stop!.
  592. X
  593. X'}' command does not stop at '{' at start of line.
  594. X
  595. XWith :s lines are split at CR, unless preceded with a CTRL-V. In fact this is
  596. Xbetter than Vi, because vi can't insert a CR in the text with :s.
  597. X
  598. XTextwidth now off when 0, also when wrapmargin set to 0.
  599. X
  600. XFixed autoindent when inserting <CR> in front of some blanks.
  601. X
  602. XRemoved 'repdel' option: BS in replace mode puts replaced character back
  603. X(within one line).
  604. X
  605. XOption 'sect' short for 'sections'.
  606. X
  607. XAdjusted 'M' when '~' lines on screen. Now put cursor in the middle of the
  608. Xlines that are present on the screen, not on the middle of the screen.
  609. X
  610. XMultiple spaces to separate fields in tags file allowed.
  611. X
  612. XDEL displayed as ^? instead of ~?.
  613. X
  614. XAdded 'mesg', 'edcompatible', 'modeline', 'sourceany' and 'ttytype' options.
  615. XOnly 'edcompatible' is really implemented.
  616. X
  617. XAdded test for trying to edit/read/write a direcory. Now you get an error
  618. Xmessage instead of [new file] (on Amiga/MSDOS) or garbage (Unix).
  619. X
  620. X'%' now works on \(this\).
  621. X
  622. XIn UNIX and MSDOS ignore spaces after filename. In Amiga the spaces may be
  623. Xpart of the filename, on other systems this is very unlikely.
  624. X
  625. XMoved code from inchar() to vgetorpeek(): Key sequences can now be mapped
  626. Xbefore recogized as key codes. But they are still stored with a special code
  627. Xin the script files, which makes them terminal-independent.
  628. X
  629. XAdded recognition of vi-compatible modeline with set command.
  630. X
  631. XImplemented 'warn' option.
  632. X
  633. XAdded CTRL-W to command line editing.
  634. X
  635. XImplemented 0^D and ^^D in insert mode.
  636. X
  637. XNon-linewise deletes within one line do not go into numbered registers.
  638. X
  639. XSet previous context mark with 'L', 'M' and 'H' commands.
  640. X
  641. XMake "cc" work like "S": indent not deleted when 'autoindent' set.
  642. XCTRL-U in insert mode does not delete indent when 'autoindent' set.
  643. X
  644. XWith the "J" command the cursor is put just after the first line instead of
  645. Xat the start of the second.
  646. X
  647. XConcatenated mapstr and typestr in buffers.c; makes ":map x y" ":map yz foo"
  648. Xwork (mixing mapped and typed characters in another mapping).
  649. X
  650. XCTRL-C quits command line and insert mode.
  651. X
  652. XESC in macro executes command line (but typed ESC still quits command line).
  653. X
  654. XDeleted "#include <ctype.h>" from regexp.c.
  655. X
  656. XCall_shell does not always use cooked mode, fixes problem with typing CR
  657. Xwhile doing filename completion in unix.
  658. X
  659. XFixed return value for FullName in unix.c.
  660. X
  661. XRemoved redraw on exit for msdos.
  662. X
  663. X":v" without argument was not handled correctly in doglob().
  664. X
  665. XCR-LF in tags file was not handled correctly.
  666. X
  667. X
  668. XPorting
  669. X=======
  670. X
  671. XAdded _UNIX to BSD and SYSV because 'BSD' already used by Alpha.
  672. X
  673. XAdded three changes for Apollo DOMAIN.
  674. X
  675. XAdded a few things for Amdahl UTS.
  676. X
  677. XUse fork() in unix.c, not all systems have vfork().
  678. X
  679. XAdded POSIX compatible file type checking.
  680. X
  681. XAdded small changes for USL 4.2.
  682. X
  683. XAdded additional set of termcap entries for terminfo.
  684. X
  685. XAdded memmove() function for SYSV. Not all versions of memcpy() can handle
  686. Xoverlapped areas.
  687. X
  688. XSmall fixes for a few unix versions: AIX (on rs6000) and NeXT.
  689. X
  690. XChanged SETWINSIZE to SETWSIZE and a few other changes for Convex.
  691. X
  692. XAdded a few changes for Borland C++. Phew, it compiles really fast!
  693. X
  694. XMany other small changes for different Unix versions.
  695. END_OF_FILE
  696. if test 23966 -ne `wc -c <'vim/readme2.0'`; then
  697.     echo shar: \"'vim/readme2.0'\" unpacked with wrong size!
  698. fi
  699. chmod +x 'vim/readme2.0'
  700. # end of 'vim/readme2.0'
  701. fi
  702. if test -f 'vim/src/param.c' -a "${1}" != "-c" ; then 
  703.   echo shar: Will not clobber existing file \"'vim/src/param.c'\"
  704. else
  705. echo shar: Extracting \"'vim/src/param.c'\" \(23470 characters\)
  706. sed "s/^X//" >'vim/src/param.c' <<'END_OF_FILE'
  707. X/* vi:ts=4:sw=4
  708. X *
  709. X * VIM - Vi IMproved
  710. X *
  711. X * Code Contributions By:    Bram Moolenaar            mool@oce.nl
  712. X *                            Tim Thompson            twitch!tjt
  713. X *                            Tony Andrews            onecom!wldrdg!tony 
  714. X *                            G. R. (Fred) Walter        watmath!watcgl!grwalter 
  715. X */
  716. X
  717. X/*
  718. X * Code to handle user-settable parameters. This is all pretty much table-
  719. X * driven. To add a new parameter, put it in the params array, and add a
  720. X * variable for it in param.h. If it's a numeric parameter, add any necessary
  721. X * bounds checks to doset().
  722. X */
  723. X
  724. X#include "vim.h"
  725. X#include "globals.h"
  726. X#include "proto.h"
  727. X#include "param.h"
  728. X
  729. Xstruct param
  730. X{
  731. X    char        *fullname;        /* full parameter name */
  732. X    char        *shortname;     /* permissible abbreviation */
  733. X    int         flags;            /* see below */
  734. X    char        *var;            /* pointer to variable */
  735. X};
  736. X
  737. X/*
  738. X * Flags
  739. X */
  740. X#define P_BOOL            0x01    /* the parameter is boolean */
  741. X#define P_NUM            0x02    /* the parameter is numeric */
  742. X#define P_STRING        0x04    /* the parameter is a string */
  743. X#define P_CHANGED        0x08    /* the parameter has been changed */
  744. X#define P_EXPAND        0x10    /* environment expansion */
  745. X
  746. X/*
  747. X * The param structure is initialized here.
  748. X * The order of the parameters should be alfabetic
  749. X * The parameters with a NULL variable are 'hidden': a set command for
  750. X * them is ignored and they are not printed.
  751. X */
  752. Xstruct param params[] =
  753. X{
  754. X        {"autoindent",    "ai",    P_BOOL,        (char *)&p_ai},
  755. X        {"autoprint",    "ap",    P_BOOL,        (char *)NULL},
  756. X        {"autowrite",    "aw",    P_BOOL,        (char *)&p_aw},
  757. X        {"backspace",    "bs",    P_NUM,        (char *)&p_bs},
  758. X        {"backup",        "bk",    P_BOOL,        (char *)&p_bk},
  759. X#ifdef UNIX
  760. X         {"backupdir",    "bdir",    P_STRING|P_EXPAND,    (char *)&p_bdir},
  761. X#endif
  762. X        {"beautify",    "bf",    P_BOOL,        (char *)NULL},
  763. X        {"binary",        "bin",    P_BOOL,        (char *)&p_bin},
  764. X#ifdef MSDOS
  765. X        {"bioskey",        "biosk",P_BOOL,        (char *)&p_biosk},
  766. X#endif
  767. X        {"columns",        "co",    P_NUM,        (char *)&Columns},
  768. X        {"compatible",    "cp",    P_BOOL,        (char *)&p_cp},
  769. X#ifdef DIGRAPHS
  770. X        {"digraph",        "dg",    P_BOOL,        (char *)&p_dg},
  771. X#endif /* DIGRAPHS */
  772. X         {"directory",    "dir",    P_STRING|P_EXPAND,    (char *)&p_dir},
  773. X        {"edcompatible",NULL,    P_BOOL,        (char *)&p_ed},
  774. X        {"equalprg",    "ep",      P_STRING|P_EXPAND,    (char *)&p_ep},
  775. X        {"errorbells",    "eb",    P_BOOL,        (char *)&p_eb},
  776. X        {"errorfile",    "ef",      P_STRING|P_EXPAND,    (char *)&p_ef},
  777. X        {"errorformat",    "efm",     P_STRING,    (char *)&p_efm},
  778. X        {"esckeys",        "ek",    P_BOOL,        (char *)&p_ek},
  779. X        {"expandtab",    "et",    P_BOOL,        (char *)&p_et},
  780. X        {"exrc",        NULL,    P_BOOL,        (char *)&p_exrc},
  781. X        {"formatprg",    "fp",      P_STRING|P_EXPAND,    (char *)&p_fp},
  782. X        {"graphic",        "gr",    P_BOOL,        (char *)&p_gr},
  783. X        {"hardtabs",    "ht",    P_NUM,        (char *)NULL},
  784. X        {"helpfile",    "hf",      P_STRING|P_EXPAND,    (char *)&p_hf},
  785. X        {"history",     "hi",     P_NUM,        (char *)&p_hi},
  786. X        {"ignorecase",    "ic",    P_BOOL,        (char *)&p_ic},
  787. X        {"insertmode",    "im",    P_BOOL,        (char *)&p_im},
  788. X        {"joinspaces",     "js",    P_BOOL,        (char *)&p_js},
  789. X        {"keywordprg",    "kp",      P_STRING|P_EXPAND,    (char *)&p_kp},
  790. X        {"lines",        NULL,     P_NUM,        (char *)&Rows},
  791. X        {"lisp",        NULL,    P_BOOL,        (char *)NULL},
  792. X        {"list",        NULL,    P_BOOL,        (char *)&p_list},
  793. X        {"magic",        NULL,    P_BOOL,        (char *)&p_magic},
  794. X        {"makeprg",        "mp",      P_STRING|P_EXPAND,    (char *)&p_mp},
  795. X        {"mesg",        NULL,    P_BOOL,        (char *)NULL},
  796. X        {"modeline",    "ml",    P_BOOL,        (char *)&p_ml},
  797. X        {"modelines",    "mls",    P_NUM,        (char *)&p_mls},
  798. X        {"number",        "nu",    P_BOOL,        (char *)&p_nu},
  799. X        {"open",        NULL,    P_BOOL,        (char *)NULL},
  800. X        {"optimize",    "opt",    P_BOOL,        (char *)NULL},
  801. X        {"paragraphs",    "para",    P_STRING,    (char *)&p_para},
  802. X        {"paste",        NULL,    P_BOOL,        (char *)&p_paste},
  803. X        {"prompt",        NULL,    P_BOOL,        (char *)NULL},
  804. X        {"readonly",    "ro",    P_BOOL,        (char *)&p_ro},
  805. X        {"redraw",        NULL,    P_BOOL,        (char *)NULL},
  806. X        {"remap",        NULL,    P_BOOL,        (char *)&p_remap},
  807. X        {"report",        NULL,    P_NUM,        (char *)&p_report},
  808. X        {"revins",        "ri",    P_BOOL,        (char *)&p_ri},
  809. X        {"ruler",        "ru",    P_BOOL,        (char *)&p_ru},
  810. X        {"secure",        NULL,    P_BOOL,        (char *)&p_secure},
  811. X        {"scroll",        NULL,     P_NUM,        (char *)&p_scroll},
  812. X        {"scrolljump",    "sj",     P_NUM,        (char *)&p_sj},
  813. X        {"sections",    "sect",    P_STRING,    (char *)&p_sections},
  814. X        {"shell",        "sh",    P_STRING|P_EXPAND,    (char *)&p_sh},
  815. X        {"shelltype",    "st",    P_NUM,        (char *)&p_st},
  816. X        {"shiftround",    "sr",    P_BOOL,        (char *)&p_sr},
  817. X        {"shiftwidth",    "sw",    P_NUM,        (char *)&p_sw},
  818. X#ifndef MSDOS
  819. X        {"shortname",    "sn",    P_BOOL,        (char *)&p_sn},
  820. X#endif
  821. X        {"showcmd",        "sc",    P_BOOL,        (char *)&p_sc},
  822. X        {"showmatch",    "sm",    P_BOOL,        (char *)&p_sm},
  823. X        {"showmode",    "smd",    P_BOOL,        (char *)&p_smd},
  824. X        {"sidescroll",    "ss",    P_NUM,        (char *)&p_ss},
  825. X        {"slowopen",    "slow",    P_BOOL,        (char *)NULL},
  826. X        {"smartindent", "si",    P_BOOL,        (char *)&p_si},
  827. X        {"sourceany", NULL,    P_BOOL,        (char *)NULL},
  828. X        {"suffixes",    "su",    P_STRING,    (char *)&p_su},
  829. X        {"tabstop",     "ts",    P_NUM,        (char *)&p_ts},
  830. X        {"taglength",    "tl",    P_NUM,        (char *)&p_tl},
  831. X        {"tags",        NULL,    P_STRING|P_EXPAND,    (char *)&p_tags},
  832. X        {"term",        NULL,    P_STRING|P_EXPAND,    (char *)&term_strings.t_name},
  833. X        {"terse",        NULL,    P_BOOL,        (char *)NULL},
  834. X        {"textauto",    "ta",    P_BOOL,        (char *)&p_ta},
  835. X        {"textmode",    "tx",    P_BOOL,        (char *)&p_tx},
  836. X        {"textwidth",    "tw",    P_NUM,        (char *)&p_tw},
  837. X        {"tildeop",     "to",    P_BOOL,        (char *)&p_to},
  838. X        {"timeout",     NULL,    P_BOOL,        (char *)&p_timeout},
  839. X        {"timeoutlen",    "tm",    P_NUM,        (char *)&p_tm},
  840. X        {"ttimeout",     NULL,    P_BOOL,        (char *)&p_ttimeout},
  841. X        {"ttytype",        NULL,    P_STRING,    (char *)NULL},
  842. X        {"undolevels",    "ul",    P_NUM,        (char *)&p_ul},
  843. X        {"updatecount",    "uc",    P_NUM,        (char *)&p_uc},
  844. X        {"updatetime",    "ut",    P_NUM,        (char *)&p_ut},
  845. X        {"visualbell",    "vb",    P_BOOL,        (char *)&p_vb},
  846. X        {"warn",        NULL,    P_BOOL,        (char *)&p_warn},
  847. X        {"wildchar",    "wc",     P_NUM,        (char *)&p_wc},
  848. X        {"window",        NULL,     P_NUM,        (char *)NULL},
  849. X        {"w300",        NULL,     P_NUM,        (char *)NULL},
  850. X        {"w1200",        NULL,     P_NUM,        (char *)NULL},
  851. X        {"w9600",        NULL,     P_NUM,        (char *)NULL},
  852. X        {"wrap",        NULL,    P_BOOL,        (char *)&p_wrap},
  853. X        {"wrapscan",    "ws",    P_BOOL,        (char *)&p_ws},
  854. X        {"wrapmargin",    "wm",    P_NUM,        (char *)&p_wm},
  855. X        {"writeany",    "wa",    P_BOOL,        (char *)&p_wa},
  856. X        {"writebackup",    "wb",    P_BOOL,        (char *)&p_wb},
  857. X        {"yankendofline", "ye",    P_BOOL,        (char *)&p_ye},
  858. X
  859. X/* terminal output codes */
  860. X        {"t_el",        NULL,    P_STRING,    (char *)&term_strings.t_el},
  861. X        {"t_il",        NULL,    P_STRING,    (char *)&term_strings.t_il},
  862. X        {"t_cil",        NULL,    P_STRING,    (char *)&term_strings.t_cil},
  863. X        {"t_dl",        NULL,    P_STRING,    (char *)&term_strings.t_dl},
  864. X        {"t_cdl",        NULL,    P_STRING,    (char *)&term_strings.t_cdl},
  865. X        {"t_ed",        NULL,    P_STRING,    (char *)&term_strings.t_ed},
  866. X        {"t_ci",        NULL,    P_STRING,    (char *)&term_strings.t_ci},
  867. X        {"t_cv",        NULL,    P_STRING,    (char *)&term_strings.t_cv},
  868. X        {"t_tp",        NULL,    P_STRING,    (char *)&term_strings.t_tp},
  869. X        {"t_ti",        NULL,    P_STRING,    (char *)&term_strings.t_ti},
  870. X        {"t_cm",        NULL,    P_STRING,    (char *)&term_strings.t_cm},
  871. X        {"t_sr",        NULL,    P_STRING,    (char *)&term_strings.t_sr},
  872. X        {"t_cri",        NULL,    P_STRING,    (char *)&term_strings.t_cri},
  873. X        {"t_vb",        NULL,    P_STRING,    (char *)&term_strings.t_vb},
  874. X        {"t_ks",        NULL,    P_STRING,    (char *)&term_strings.t_ks},
  875. X        {"t_ke",        NULL,    P_STRING,    (char *)&term_strings.t_ke},
  876. X        {"t_ts",        NULL,    P_STRING,    (char *)&term_strings.t_ts},
  877. X        {"t_te",        NULL,    P_STRING,    (char *)&term_strings.t_te},
  878. X
  879. X/* terminal key codes */
  880. X        {"t_ku",        NULL,    P_STRING,    (char *)&term_strings.t_ku},
  881. X        {"t_kd",        NULL,    P_STRING,    (char *)&term_strings.t_kd},
  882. X        {"t_kr",        NULL,    P_STRING,    (char *)&term_strings.t_kr},
  883. X        {"t_kl",        NULL,    P_STRING,    (char *)&term_strings.t_kl},
  884. X        {"t_sku",        NULL,    P_STRING,    (char *)&term_strings.t_sku},
  885. X        {"t_skd",        NULL,    P_STRING,    (char *)&term_strings.t_skd},
  886. X        {"t_skr",        NULL,    P_STRING,    (char *)&term_strings.t_skr},
  887. X        {"t_skl",        NULL,    P_STRING,    (char *)&term_strings.t_skl},
  888. X        {"t_f1",        NULL,    P_STRING,    (char *)&term_strings.t_f1},
  889. X        {"t_f2",        NULL,    P_STRING,    (char *)&term_strings.t_f2},
  890. X        {"t_f3",        NULL,    P_STRING,    (char *)&term_strings.t_f3},
  891. X        {"t_f4",        NULL,    P_STRING,    (char *)&term_strings.t_f4},
  892. X        {"t_f5",        NULL,    P_STRING,    (char *)&term_strings.t_f5},
  893. X        {"t_f6",        NULL,    P_STRING,    (char *)&term_strings.t_f6},
  894. X        {"t_f7",        NULL,    P_STRING,    (char *)&term_strings.t_f7},
  895. X        {"t_f8",        NULL,    P_STRING,    (char *)&term_strings.t_f8},
  896. X        {"t_f9",        NULL,    P_STRING,    (char *)&term_strings.t_f9},
  897. X        {"t_f10",        NULL,    P_STRING,    (char *)&term_strings.t_f10},
  898. X        {"t_sf1",        NULL,    P_STRING,    (char *)&term_strings.t_sf1},
  899. X        {"t_sf2",        NULL,    P_STRING,    (char *)&term_strings.t_sf2},
  900. X        {"t_sf3",        NULL,    P_STRING,    (char *)&term_strings.t_sf3},
  901. X        {"t_sf4",        NULL,    P_STRING,    (char *)&term_strings.t_sf4},
  902. X        {"t_sf5",        NULL,    P_STRING,    (char *)&term_strings.t_sf5},
  903. X        {"t_sf6",        NULL,    P_STRING,    (char *)&term_strings.t_sf6},
  904. X        {"t_sf7",        NULL,    P_STRING,    (char *)&term_strings.t_sf7},
  905. X        {"t_sf8",        NULL,    P_STRING,    (char *)&term_strings.t_sf8},
  906. X        {"t_sf9",        NULL,    P_STRING,    (char *)&term_strings.t_sf9},
  907. X        {"t_sf10",        NULL,    P_STRING,    (char *)&term_strings.t_sf10},
  908. X        {"t_help",        NULL,    P_STRING,    (char *)&term_strings.t_help},
  909. X        {"t_undo",        NULL,    P_STRING,    (char *)&term_strings.t_undo},
  910. X        {NULL, NULL, 0, NULL}            /* end marker */
  911. X};
  912. X
  913. Xstatic void param_expand __ARGS((int, int));
  914. Xstatic int findparam __ARGS((char *));
  915. Xstatic void    showparams __ARGS((int));
  916. Xstatic void showonep __ARGS((struct param *));
  917. Xstatic int  istermparam __ARGS((struct param *));
  918. X
  919. X/*
  920. X * Initialize the shell parameter and scroll size.
  921. X */
  922. X    void
  923. Xset_init()
  924. X{
  925. X    char    *p;
  926. X    int        i;
  927. X
  928. X    if ((p = (char *)vimgetenv("SHELL")) != NULL
  929. X#ifdef MSDOS
  930. X            || (p = (char *)vimgetenv("COMSPEC")) != NULL
  931. X#endif
  932. X                                                            )
  933. X    {
  934. X        p = strsave(p);
  935. X        if (p != NULL)        /* we don't want a NULL */
  936. X            p_sh = p;
  937. X    }
  938. X
  939. X    p_scroll = (Rows >> 1);
  940. X    comp_col();
  941. X
  942. X    /*
  943. X     * expand environment variables in some string options
  944. X     */
  945. X    for (i = 0; params[i].fullname != NULL; i++)
  946. X        param_expand(i, FALSE);
  947. X}
  948. X
  949. X/*
  950. X * parse 'arg' for option settings
  951. X * 'arg' may be IObuff, but only when no errors can be present.
  952. X */
  953. X    int
  954. Xdoset(arg)
  955. X    char        *arg;    /* parameter string (may be written to!) */
  956. X{
  957. X    register int i;
  958. X    char        *s;
  959. X    char        *errmsg;
  960. X    char        *startarg;
  961. X    int            prefix;    /* 0: nothing, 1: "no", 2: "inv" in front of name */
  962. X    int         nextchar;
  963. X    int         len;
  964. X    int         flags;
  965. X    long        value;
  966. X    long        olduc = p_uc;        /* remember old update count */
  967. X    long        oldRows = Rows;        /* remember old Rows */
  968. X    int            errcnt = 0;            /* number of errornous entries */
  969. X    static long    save_tw = 0;        /* saved options for 'paste' */
  970. X    static int    save_ai = 0;
  971. X    static int    save_si = 0;
  972. X    static int    save_sm = 0;
  973. X    static int    save_ru = 0;
  974. X    static int    save_ri = 0;
  975. X    static int    did_paste = FALSE;    /* when TRUE saved values have been set */
  976. X    int            do_wait = FALSE;    /* call wait_return() at the end */
  977. X    int            did_show = FALSE;    /* already showed one value */
  978. X
  979. X    if (*arg == NUL)
  980. X    {
  981. X        showparams(0);
  982. X        return 0;
  983. X    }
  984. X
  985. X    while (*arg)        /* loop to process all parameters */
  986. X    {
  987. X        errmsg = NULL;
  988. X        startarg = arg;        /* remember for error message */
  989. X        if (strncmp(arg, "all", (size_t)3) == 0)
  990. X            showparams(1);
  991. X        else if (strncmp(arg, "termcap", (size_t)7) == 0)
  992. X            showparams(2);
  993. X        else
  994. X        {
  995. X            prefix = 1;
  996. X            if (strncmp(arg, "no", (size_t)2) == 0)
  997. X            {
  998. X                prefix = 0;
  999. X                arg += 2;
  1000. X            }
  1001. X            else if (strncmp(arg, "inv", (size_t)3) == 0)
  1002. X            {
  1003. X                prefix = 2;
  1004. X                arg += 3;
  1005. X            }
  1006. X                /* find end of name */
  1007. X            for (len = 0; isalnum(arg[len]) || arg[len] == '_'; ++len)
  1008. X                ;
  1009. X            nextchar = arg[len];
  1010. X            arg[len] = 0;                                /* name ends with 0 */
  1011. X            i = findparam(arg);
  1012. X            arg[len] = nextchar;                        /* restore nextchar */
  1013. X
  1014. X            if (i == -1)        /* found a mismatch: skip the rest */
  1015. X            {
  1016. X                errmsg = "Unknown option";
  1017. X                goto skip;
  1018. X            }
  1019. X
  1020. X            if (!params[i].var)            /* hidden option */
  1021. X                goto skip;
  1022. X
  1023. X            flags = params[i].flags;
  1024. X            /*
  1025. X             * allow '=' and ':' as MSDOS command.com allows only one
  1026. X             * '=' character per "set" command line. grrr. (jw)
  1027. X             */
  1028. X            if (nextchar == '?' || 
  1029. X                (prefix == 1 && nextchar != '=' &&
  1030. X                 nextchar != ':' && !(flags & P_BOOL)))
  1031. X            {                                        /* print value */
  1032. X                if (did_show)
  1033. X                {
  1034. X                    outchar('\n');            /* cursor below last one */
  1035. X                    do_wait = TRUE;            /* have to call wait_return() */
  1036. X                }
  1037. X                else
  1038. X                {
  1039. X                    gotocmdline(TRUE, NUL);    /* cursor at status line */
  1040. X                    did_show = TRUE;        /* remember that we did a line */
  1041. X                }
  1042. X                showonep(¶ms[i]);
  1043. X
  1044. X                    /* check if the message is too long to fit in one line */
  1045. X                if ((flags & P_STRING) && strlen(params[i].fullname) +
  1046. X                            (*(char **)(params[i].var) == NULL ? 0 :
  1047. X                            strsize(*(char **)(params[i].var))) + 1 >= (unsigned)sc_col)
  1048. X                    do_wait = TRUE;
  1049. X            }
  1050. X            else
  1051. X            {
  1052. X                if (nextchar != NUL && strchr("=: \t", nextchar) == NULL)
  1053. X                {
  1054. X                    errmsg = e_invarg;
  1055. X                    goto skip;
  1056. X                }
  1057. X                else if (flags & P_BOOL)                    /* boolean */
  1058. X                {
  1059. X                        if (nextchar == '=' || nextchar == ':')
  1060. X                        {
  1061. X                            errmsg = e_invarg;
  1062. X                            goto skip;
  1063. X                        }
  1064. X                        /*
  1065. X                         * in secure mode, setting of the secure option is not allowed
  1066. X                         */
  1067. X                        if (secure && (int *)params[i].var == &p_secure)
  1068. X                        {
  1069. X                            errmsg = "not allowed here";
  1070. X                            goto skip;
  1071. X                        }
  1072. X                        if (prefix == 2)
  1073. X                            *(int *)(params[i].var) ^= 1;    /* invert it */
  1074. X                        else
  1075. X                            *(int *)(params[i].var) = prefix;
  1076. X                            /* handle compatbile option here */
  1077. X                        if ((int *)params[i].var == &p_cp && p_cp)
  1078. X                        {
  1079. X                            p_bs = 0;        /* normal backspace */
  1080. X                            p_bk = 0;        /* no backup file */
  1081. X#ifdef DIGRAPHS
  1082. X                            p_dg = 0;        /* no digraphs */
  1083. X#endif /* DIGRAPHS */
  1084. X                            p_ek = 0;        /* no ESC keys in insert mode */
  1085. X                            p_et = 0;        /* no expansion of tabs */
  1086. X                            p_hi = 0;        /* no history */
  1087. X                            p_im = 0;        /* do not start in insert mode */
  1088. X                            p_js = 1;        /* insert 2 spaces after period */
  1089. X                            p_ml = 0;        /* no modelines */
  1090. X                            p_ru = 0;        /* no ruler */
  1091. X                            p_ri = 0;        /* no reverse insert */
  1092. X                            p_sj = 1;        /* no scrolljump */
  1093. X                            p_sr = 0;        /* do not round indent to shiftwidth */
  1094. X                            p_sc = 0;        /* no showcommand */
  1095. X                            p_smd = 0;        /* no showmode */
  1096. X                            p_si = 0;        /* no smartindent */
  1097. X                            p_ta = 0;        /* no automatic textmode detection */
  1098. X                            p_tw = 0;        /* no automatic line wrap */
  1099. X                            p_to = 0;        /* no tilde operator */
  1100. X                            p_ttimeout = 0;    /* no terminal timeout */
  1101. X                            p_ul = 0;        /* no multilevel undo */
  1102. X                            p_uc = 0;        /* no autoscript file */
  1103. X                            p_wb = 0;        /* no backup file */
  1104. X                            if (p_wc == TAB)
  1105. X                                p_wc = Ctrl('E');    /* normal use for TAB */
  1106. X                            p_ye = 0;        /* no yank to end of line */
  1107. X                        }
  1108. X                        if ((int *)params[i].var == &p_bin && p_bin)    /* handle bin */
  1109. X                        {
  1110. X                            p_tw = 0;        /* no automatic line wrap */
  1111. X                            p_tx = 0;        /* no text mode */
  1112. X                            p_ta = 0;        /* no text auto */
  1113. X                            p_ml = 0;        /* no modelines */
  1114. X                            p_et = 0;        /* no expandtab */
  1115. X                        }
  1116. X                        if ((int *)params[i].var == &p_paste)    /* handle paste here */
  1117. X                        {
  1118. X                            if (p_paste)
  1119. X                            {
  1120. X                                save_tw = p_tw;        /* save current values */
  1121. X                                save_ai = p_ai;
  1122. X                                save_si = p_si;
  1123. X                                save_sm = p_sm;
  1124. X                                save_ru = p_ru;
  1125. X                                save_ri = p_ri;
  1126. X                                p_tw = 0;            /* textwidth is 0 */
  1127. X                                p_ai = 0;            /* no auto-indent */
  1128. X                                p_si = 0;            /* no smart-indent */
  1129. X                                p_sm = 0;            /* no showmatch */
  1130. X                                p_ru = 0;            /* no ruler */
  1131. X                                p_ri = 0;            /* no reverse insert */
  1132. X                                did_paste = TRUE;
  1133. X                            }
  1134. X                            else if (did_paste)        /* restore old values */
  1135. X                            {
  1136. X                                p_tw = save_tw;
  1137. X                                p_ai = save_ai;
  1138. X                                p_si = save_si;
  1139. X                                p_sm = save_sm;
  1140. X                                p_ru = save_ru;
  1141. X                                p_ri = save_ri;
  1142. X                            }
  1143. X                        }
  1144. X                }
  1145. X                else                                /* numeric or string */
  1146. X                {
  1147. X                    if ((nextchar != '=' && nextchar != ':') || prefix != 1)
  1148. X                    {
  1149. X                        errmsg = e_invarg;
  1150. X                        goto skip;
  1151. X                    }
  1152. X                    if (flags & P_NUM)                /* numeric */
  1153. X                    {
  1154. X                        value = atol(arg + len + 1);
  1155. X                            /* wrapmargin is translated into textwidth */
  1156. X                        if ((long *)params[i].var == &p_wm)
  1157. X                        {
  1158. X                            if (value == 0)        /* switch it off */
  1159. X                                p_tw = 0;
  1160. X                            else
  1161. X                            {
  1162. X                                if (value >= (int)Columns)
  1163. X                                    value = (int)Columns - 1;
  1164. X                                p_tw = Columns - value;
  1165. X                            }
  1166. X                        }
  1167. X                        *(long *)(params[i].var) = value;
  1168. X                    }
  1169. X                    else                            /* string */
  1170. X                    {
  1171. X                        arg += len + 1;        /* jump to after the '=' */
  1172. X                        prefix = *arg;        /* remember first char of arg */
  1173. X                        s = alloc((unsigned)(strlen(arg) + 1)); /* get a bit too much */
  1174. X                        if (s == NULL)
  1175. X                            break;
  1176. X                        if (flags & P_CHANGED)
  1177. X                            free(*(char **)(params[i].var));
  1178. X                        *(char **)(params[i].var) = s;
  1179. X                                    /* copy the string */
  1180. X                        while (*arg && *arg != ' ')
  1181. X                        {
  1182. X                            if (*arg == '\\' && *(arg + 1)) /* skip over escaped chars */
  1183. X                                    ++arg;
  1184. X                            *s++ = *arg++;
  1185. X                        }
  1186. X                        *s = NUL;
  1187. X                        if (prefix == '$')
  1188. X                            param_expand(i, TRUE);    /* expand environment variables */
  1189. X                        /*
  1190. X                         * options that need some action
  1191. X                         * to perform when changed (jw)
  1192. X                         */
  1193. X                        if (params[i].var == (char *)&term_strings.t_name)
  1194. X                            set_term(term_strings.t_name);
  1195. X                        else if (istermparam(¶ms[i]))
  1196. X                        {
  1197. X                            ttest(FALSE);
  1198. X                            if (params[i].var == (char *)&term_strings.t_tp)
  1199. X                            {
  1200. X                                outstr(T_TP);
  1201. X                                updateScreen(CLEAR);
  1202. X                            }
  1203. X                        }
  1204. X                    }
  1205. X                }
  1206. X                params[i].flags |= P_CHANGED;
  1207. X            }
  1208. X        }
  1209. X
  1210. Xskip:
  1211. X        /*
  1212. X         * Check the bounds for numeric parameters here
  1213. X         */
  1214. X        if (Rows < 2)
  1215. X        {
  1216. X            Rows = 2;
  1217. X            errmsg = "Need at least 2 lines";
  1218. X        }
  1219. X        /*
  1220. X         * If the screenheight has been changed, assume it is the physical
  1221. X         * screenheight, set Rows_max.
  1222. X         */
  1223. X        if (oldRows != Rows)
  1224. X        {
  1225. X            Rows_max = Rows;
  1226. X#ifdef MSDOS
  1227. X            set_window();        /* active window may have changed */
  1228. X#endif
  1229. X        }
  1230. X
  1231. X        if (p_ts <= 0)
  1232. X        {
  1233. X            errmsg = e_positive;
  1234. X            p_ts = 8;
  1235. X        }
  1236. X        if (p_tm < 0)
  1237. X        {
  1238. X            errmsg = e_positive;
  1239. X            p_tm = 0;
  1240. X        }
  1241. X        if (p_scroll <= 0 || p_scroll > Rows)
  1242. X        {
  1243. X            if (p_scroll != 0)
  1244. X                errmsg = e_scroll;
  1245. X            p_scroll = Rows >> 1;
  1246. X        }
  1247. X        if (p_report < 0)
  1248. X        {
  1249. X            errmsg = e_positive;
  1250. X            p_report = 1;
  1251. X        }
  1252. X        if (p_sj < 0 || p_sj >= Rows)
  1253. X        {
  1254. X            errmsg = e_scroll;
  1255. X            p_sj = 1;
  1256. X        }
  1257. X        if (p_uc < 0)
  1258. X        {
  1259. X            errmsg = e_positive;
  1260. X            p_uc = 100;
  1261. X        }
  1262. X        if (p_ut < 0)
  1263. X        {
  1264. X            errmsg = e_positive;
  1265. X            p_ut = 2000;
  1266. X        }
  1267. X        if (p_ss < 0)
  1268. X        {
  1269. X            errmsg = e_positive;
  1270. X            p_ss = 0;
  1271. X        }
  1272. X        if (errmsg)
  1273. X        {
  1274. X            strcpy(IObuff, errmsg);
  1275. X            strcat(IObuff, ": ");
  1276. X            s = IObuff + strlen(IObuff);
  1277. X            while (*startarg && !isspace(*startarg))
  1278. X                *s++ = *startarg++;
  1279. X            *s = NUL;
  1280. X            emsg(IObuff);
  1281. X            arg = startarg;        /* skip to next argument */
  1282. X            ++errcnt;            /* count number of errors */
  1283. X        }
  1284. X        skiptospace(&arg);                /* skip to next white space */
  1285. X        skipspace(&arg);                /* skip spaces */
  1286. X    }
  1287. X
  1288. X    if (p_uc == 0 && olduc != 0)        /* p_uc changed from on to off */
  1289. X        stopscript();
  1290. X    if (p_uc > 0 && olduc == 0)            /* p_uc changed from off to on */
  1291. X        startscript();
  1292. X    comp_col();
  1293. X
  1294. X    /*
  1295. X     * Update the screen in case we changed something like "tabstop" or
  1296. X     * "lines" or "list" that will change its appearance.
  1297. X     * If we messed up the screen by showing more than one line of param
  1298. X     * values call wait_return(), which will also update the screen..
  1299. X     */
  1300. X    if (do_wait)
  1301. X    {
  1302. X        outchar('\n');
  1303. X        wait_return(TRUE);
  1304. X    }
  1305. X    else
  1306. X        updateScreen(NOT_VALID);
  1307. X    return errcnt;
  1308. X}
  1309. X
  1310. X/*
  1311. X * expand environment variable at the start of some string options
  1312. X */
  1313. X    static void
  1314. Xparam_expand(i, dofree)
  1315. X    int        i;
  1316. X    int        dofree;
  1317. X{
  1318. X    char *p;
  1319. X
  1320. X    if ((params[i].flags & P_EXPAND) && (p = *(char **)(params[i].var)) != NULL && *p == '$')
  1321. X    {
  1322. X        expand_env(*(char **)(params[i].var), IObuff, IOSIZE);
  1323. X        p = strsave(IObuff);
  1324. X        if (p)
  1325. X        {
  1326. X            if (dofree)
  1327. X                free(*(char **)(params[i].var));
  1328. X            *(char **)(params[i].var) = p;
  1329. X        }
  1330. X    }
  1331. X}
  1332. X
  1333. X/*
  1334. X * find index for option 'arg'
  1335. X * return -1 if not found
  1336. X */
  1337. X    static int
  1338. Xfindparam(arg)
  1339. X    char *arg;
  1340. X{
  1341. X    int        i;
  1342. X    char    *s;
  1343. X
  1344. X    for (i = 0; (s = params[i].fullname) != NULL; i++)
  1345. X    {
  1346. X        if (strcmp(arg, s) == 0) /* match full name */
  1347. X            break;
  1348. X    }
  1349. X    if (s == NULL)
  1350. X    {
  1351. X        for (i = 0; params[i].fullname != NULL; i++)
  1352. X        {
  1353. X            s = params[i].shortname;
  1354. X            if (s != NULL && strcmp(arg, s) == 0) /* match short name */
  1355. X                break;
  1356. X            s = NULL;
  1357. X        }
  1358. X    }
  1359. X    if (s == NULL)
  1360. X        i = -1;
  1361. X    return i;
  1362. X}
  1363. X
  1364. X/*
  1365. X * mark option 'arg' changed
  1366. X */
  1367. X    void
  1368. Xparamchanged(arg)
  1369. X    char *arg;
  1370. X{
  1371. X    int i;
  1372. X
  1373. X    i = findparam(arg);
  1374. X    if (i >= 0)
  1375. X        params[i].flags |= P_CHANGED;
  1376. X}
  1377. X
  1378. X/*
  1379. X * if 'all' == 0: show changed parameters
  1380. X * if 'all' == 1: show all normal parameters
  1381. X * if 'all' == 2: show all terminal parameters
  1382. X */
  1383. X    static void
  1384. Xshowparams(all)
  1385. X    int            all;
  1386. X{
  1387. X    struct param   *p;
  1388. X    int                col = 0;
  1389. X    int                inc;
  1390. X    int                isterm;
  1391. X
  1392. X    gotocmdline(TRUE, NUL);
  1393. X    outstrn("Parameters:\n");
  1394. X
  1395. X#ifdef AMIGA
  1396. X    settmode(0);                /* set cooked mode so output can be halted */
  1397. X#endif
  1398. X    for (p = ¶ms[0]; p->fullname != NULL; p++)
  1399. X    {
  1400. X        isterm = istermparam(p);
  1401. X        if (p->var && (
  1402. X            (all == 2 && isterm) ||
  1403. X            (all == 1 && !isterm) ||
  1404. X            (all == 0 && (p->flags & P_CHANGED))))
  1405. X        {
  1406. X            if ((p->flags & P_STRING) && *(char **)(p->var) != NULL)
  1407. X            {
  1408. X                inc = strlen(p->fullname) + strsize(*(char **)(p->var)) + 1;
  1409. X                if (inc < 18)
  1410. X                    inc = 18;
  1411. X            }
  1412. X            else
  1413. X                inc = 18;
  1414. X            if (col + inc >= Columns)
  1415. X            {
  1416. X                col = 0;
  1417. X                if (Rows != Rows_max)
  1418. X                    windgoto((int)Rows_max - 1, 0);
  1419. X                outchar('\n');                /* scroll screen one line up */
  1420. X            }
  1421. X            windgoto((int)Rows - 1, col); /* make columns */
  1422. X            showonep(p);
  1423. X            col += inc;
  1424. X            col += 19 - col % 19;
  1425. X            flushbuf();
  1426. X        }
  1427. X    }
  1428. X
  1429. X    if (col)
  1430. X        outchar('\n');
  1431. X#ifdef AMIGA
  1432. X    settmode(1);
  1433. X#endif
  1434. X    wait_return(TRUE);
  1435. X}
  1436. X
  1437. X/*
  1438. X * showonep: show the value of one option
  1439. X * must not be called with a hidden option!
  1440. X */
  1441. X    static void
  1442. Xshowonep(p)
  1443. X        struct param *p;
  1444. X{
  1445. X    char            buf[64];
  1446. X
  1447. X    if ((p->flags & P_BOOL) && !*(int *)(p->var))
  1448. X        outstrn("no");
  1449. X    outstrn(p->fullname);
  1450. X    if (!(p->flags & P_BOOL))
  1451. X    {
  1452. X        outchar('=');
  1453. X        if (p->flags & P_NUM)
  1454. X        {
  1455. X            sprintf(buf, "%ld", *(long *)(p->var));
  1456. X            outstrn(buf);
  1457. X        }
  1458. X        else if (*(char **)(p->var) != NULL)
  1459. X            outtrans(*(char **)(p->var), -1);
  1460. X    }
  1461. X}
  1462. X
  1463. X/*
  1464. X * Write modified parameters as set command to a file.
  1465. X * Return 1 on error.
  1466. X */
  1467. X    int
  1468. Xmakeset(fd)
  1469. X    FILE *fd;
  1470. X{
  1471. X    struct param    *p;
  1472. X    char            *s;
  1473. X    int                e;
  1474. X
  1475. X    for (p = ¶ms[0]; p->fullname != NULL; p++)
  1476. X        if ((p->flags & P_CHANGED) && p->var)
  1477. X        {
  1478. X            if (p->flags & P_BOOL)
  1479. X                fprintf(fd, "set %s%s", *(int *)(p->var) ? "" : "no", p->fullname);
  1480. X            else if (p->flags & P_NUM)
  1481. X                fprintf(fd, "set %s=%ld", p->fullname, *(long *)(p->var));
  1482. X            else
  1483. X            {
  1484. X                fprintf(fd, "set %s=", p->fullname);
  1485. X                s = *(char **)(p->var);
  1486. X                    /* some characters hav to be escaped with CTRL-V or backslash */
  1487. X                if (s != NULL && putescstr(fd, s, TRUE) < 0)
  1488. X                    return 1;
  1489. X            }
  1490. X#ifdef MSDOS
  1491. X            putc('\r', fd);
  1492. X#endif
  1493. X                /*
  1494. X                 * Only check error for this putc, should catch at least
  1495. X                 * the "disk full" situation.
  1496. X                 */
  1497. X            e = putc('\n', fd);
  1498. X            if (e < 0)
  1499. X                return 1;
  1500. X        }
  1501. X    return 0;
  1502. X}
  1503. X
  1504. X/*
  1505. X * Clear all the terminal parameters.
  1506. X * If the parameter has been changed, free the allocated memory.
  1507. X * Reset the "changed" flag, so the new value will not be freed.
  1508. X */
  1509. X    void
  1510. Xclear_termparam()
  1511. X{
  1512. X    struct param   *p;
  1513. X
  1514. X    for (p = ¶ms[0]; p->fullname != NULL; p++)
  1515. X        if (istermparam(p))            /* terminal parameters must never be hidden */
  1516. X        {
  1517. X            if (p->flags & P_CHANGED)
  1518. X                free(*(char **)(p->var));
  1519. X            *(char **)(p->var) = NULL;
  1520. X            p->flags &= ~P_CHANGED;
  1521. X        }
  1522. X}
  1523. X
  1524. X    static int
  1525. Xistermparam(p)
  1526. X    struct param *p;
  1527. X{
  1528. X    return (p->fullname[0] == 't' && p->fullname[1] == '_');
  1529. X}
  1530. X
  1531. X/*
  1532. X * Compute columns for ruler and shown command. 'sc_col' is also used to
  1533. X * decide what the maximum length of a message on the status line can be.
  1534. X */
  1535. X
  1536. X#define COL_SHOWCMD 10        /* columns needed by shown command */
  1537. X#define COL_RULER 17        /* columns needed by ruler */
  1538. X
  1539. X    void
  1540. Xcomp_col()
  1541. X{
  1542. X    sc_col = 0;
  1543. X    ru_col = 0;
  1544. X    if (p_ru)
  1545. X        ru_col = sc_col = COL_RULER + 1;
  1546. X    if (p_sc)
  1547. X    {
  1548. X        sc_col += COL_SHOWCMD;
  1549. X        if (!p_ru)
  1550. X            ++sc_col;
  1551. X    }
  1552. X    sc_col = Columns - sc_col;
  1553. X    ru_col = Columns - ru_col;
  1554. X}
  1555. END_OF_FILE
  1556. if test 23470 -ne `wc -c <'vim/src/param.c'`; then
  1557.     echo shar: \"'vim/src/param.c'\" unpacked with wrong size!
  1558. fi
  1559. chmod +x 'vim/src/param.c'
  1560. # end of 'vim/src/param.c'
  1561. fi
  1562. echo shar: End of archive 12 \(of 25\).
  1563. cp /dev/null ark12isdone
  1564. MISSING=""
  1565. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ; do
  1566.     if test ! -f ark${I}isdone ; then
  1567.     MISSING="${MISSING} ${I}"
  1568.     fi
  1569. done
  1570. if test "${MISSING}" = "" ; then
  1571.     echo You have unpacked all 25 archives.
  1572.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1573. else
  1574.     echo You still need to unpack the following archives:
  1575.     echo "        " ${MISSING}
  1576. fi
  1577. ##  End of shell archive.
  1578. exit 0
  1579.  
  1580. ===============================================================================
  1581. Bram Moolenaar                             | DISCLAIMER:  This  note  does  not
  1582. Oce Nederland B.V., Research & Development | necessarily represent the position
  1583. p.o. box 101, 5900 MA  Venlo               | of  Oce-Nederland  B.V.  Therefore
  1584. The Netherlands        phone +31 77 594077 | no liability or responsibility for
  1585. UUCP: mool@oce.nl        fax +31 77 595473 | whatever will be accepted.
  1586.  
  1587. exit 0 # Just in case...
  1588.