diff -rc ../vim-4.1/doc/vim_40.txt ./doc/vim_40.txt *** ../vim-4.1/doc/vim_40.txt Wed Jun 12 07:12:42 1996 --- ./doc/vim_40.txt Wed Jun 12 23:27:04 1996 *************** *** 28,33 **** --- 28,34 ---- 'tildeop' and 'weirdinvert' short names changed |short_name_changed| Use of "v", "V" and "CTRL-V" in Visual mode |use_visual_cmds| CTRL-B in Insert mode removed |toggle_revins| + Q command changed to "gq" |Q_renamed| NEW AND IMPROVED FEATURES |new_features| New on-line help system |new_help| *************** *** 49,54 **** --- 50,56 ---- Support for Windows NT and Windows 95 |new_win32| Support for OS/2 |new_os2| Support for MiNT |new_mint| + Ex mode commands added |new_ex| Miscellaneous |new_misc| VI COMPATIBILITY IMPROVEMENTS |vi_compat| *************** *** 401,406 **** --- 403,415 ---- it. Since hardly anybody uses this feature, it is disabled by default. If you want to use it, define RIGHTLEFT in feature.h before compiling. |'revins'| + Q command in normal mode renamed to "gq" *Q_renamed* + ---------------------------------------- + + The Q command was used in vim 3.0 to rewrap paragraphs, but in standard vi + Q is the command to switch from "visual" mode to "ex" mode, and vim now has + an "ex" mode. + NEW AND IMPROVED FEATURES *new_features* ========================= *************** *** 729,736 **** initializations, so that they work correctly when 'shell' option is set. |'shellpipe'| ! Added '2' to 'formatoptions': 'Q' will keep the indent of the second line of a ! paragraph. |'formatoptions'| Added 'maxmapdepth' option: maximum recursiveness of mapping. |'maxmapdepth'| --- 738,745 ---- initializations, so that they work correctly when 'shell' option is set. |'shellpipe'| ! Added '2' to 'formatoptions': 'gq' (formerly Q) will keep the indent of the ! second line of a paragraph. |'formatoptions'| Added 'maxmapdepth' option: maximum recursiveness of mapping. |'maxmapdepth'| *************** *** 1024,1030 **** |vim_os2.txt| ! Support for MiNT *new_mint* ---------------- There is now a version of Vim for MiNT. It was compiled with gcc under --- 1033,1039 ---- |vim_os2.txt| ! Support for MiNT *new_mint* ---------------- There is now a version of Vim for MiNT. It was compiled with gcc under *************** *** 1032,1037 **** --- 1041,1054 ---- |vim_mint.txt| + Ex mode commands added *new_ex* + ---------------------- + + Vim now works in Ex mode when invoked as "ex" or when the Q command is + used. The :append, :change, :insert, and :z commands now function like + standard vi. + + Miscellaneous new features *new_misc* -------------------------- *************** *** 1130,1151 **** complicated to do right and nobody will probably use it anyway. Reverse insert is still possible. |'revins'| ! The "Q" operator no longer affects empty lines. You can now format a lot of ! paragraphs without losing the separating blank lines. Use "Qp..." to format a ! few consecutive paragraphs. |Q| ! Formatting with "Q" fixes up the indent of the first line (replace with ! minimal number of tabs/spaces). |Q| ! After "Q", put cursor at first non-blank of the last formatted line. This makes it easier to repeat the formatting. ! Made "Q}" put the cursor on the line after the paragraph (where the "}" command would have taken the cursor). Makes it possible to use "." to format ! the next paragraph. |Q| ! When formatting with "Q" while 'tw' and 'wm' are both zero, use a textwidth of 79, or the screen width minus one if that is smaller. Joining all the lines ! doesn't make sense for the "Q" command. |Q| Added CTRL-W CTRL-T (go to top window) and CTRL-W CTRL-B (go to bottom window). |CTRL-W_CTRL-T|. --- 1147,1168 ---- complicated to do right and nobody will probably use it anyway. Reverse insert is still possible. |'revins'| ! The "gq" operator (formerly Q) no longer affects empty lines. You can now ! format a lot of paragraphs without losing the separating blank lines. Use ! "gqp..." to format a few consecutive paragraphs. |gq| ! Formatting with "gq" fixes up the indent of the first line (replace with ! minimal number of tabs/spaces). |gq| ! After "gq", put cursor at first non-blank of the last formatted line. This makes it easier to repeat the formatting. ! Made "gq}" put the cursor on the line after the paragraph (where the "}" command would have taken the cursor). Makes it possible to use "." to format ! the next paragraph. |gq| ! When formatting with "gq" while 'tw' and 'wm' are both zero, use a textwidth of 79, or the screen width minus one if that is smaller. Joining all the lines ! doesn't make sense for the "gq" command. |gq| Added CTRL-W CTRL-T (go to top window) and CTRL-W CTRL-B (go to bottom window). |CTRL-W_CTRL-T|. diff -rc ../vim-4.1/doc/vim_diff.txt ./doc/vim_diff.txt *** ../vim-4.1/doc/vim_diff.txt Wed Jun 12 07:09:24 1996 --- ./doc/vim_diff.txt Wed Jun 12 23:28:47 1996 *************** *** 3,11 **** This is a summary of the differences between VIM and vi. It is not complete. see also |vim_ref.txt|, look for comments in {}, like "{not in Vi}". ! Vim is mostly POSIX 1003.2-1 compliant. The commands known to be missing ! are "Q", ":append", ":change", ":insert", ":open" and ":z". There are ! probably a lot of small differences. THE MOST INTERESTING ADDITIONS --- 3,10 ---- This is a summary of the differences between VIM and vi. It is not complete. see also |vim_ref.txt|, look for comments in {}, like "{not in Vi}". ! Vim is mostly POSIX 1003.2-1 compliant. The only command known to be missing ! is ":open". There are probably a lot of small differences. THE MOST INTERESTING ADDITIONS *************** *** 77,83 **** ! filter through external program = filter through indent : start ":" command for the Visual lines. ! Q format text to 'textwidth' columns J join lines ~ swap case u make lowercase --- 76,82 ---- ! filter through external program = filter through indent : start ":" command for the Visual lines. ! gq format text to 'textwidth' columns J join lines ~ swap case u make lowercase *************** *** 141,148 **** Text formatting. |formatting| The 'textwidth' option can be used to automatically limit the line length. This supplements the 'wrapmargin' option of Vi, which was not ! very useful. The "Q" operator can be used to format a piece of text ! (for example, "Qp" formats the current paragraph). Commands for text alignment: ":center", ":left" and ":right". Edit-compile-edit speedup. |quickfix| --- 140,147 ---- Text formatting. |formatting| The 'textwidth' option can be used to automatically limit the line length. This supplements the 'wrapmargin' option of Vi, which was not ! very useful. The "gq" operator can be used to format a piece of text ! (for example, "gqp" formats the current paragraph). Commands for text alignment: ":center", ":left" and ":right". Edit-compile-edit speedup. |quickfix| *************** *** 320,325 **** --- 319,329 ---- runs under Windows 3.1 and MS-DOS. It supports long file names where available. + Ex mode |new_ex| + You now get Ex mode when you invoke vim as "ex" or use the |Q| + command. The |:append|, |:insert|, |:change|, and |:z| commands + now function like in standard vi. + Miscellaneous new features |new_misc| Implemented incremental search. A whole bunch of commands that start with "g": Goto declaration, show *************** *** 328,334 **** Added the ":retab" command. Can be used to change the size of a , replace spaces with a or a with spaces. Implemented "Vim -r" to list any swap files that can be found. ! The "Q" operator no longer affects empty lines. Added '-' register for deletes of less than one line, see |registers|. Quickfix: Support for several error formats at the same time. Added separate mapping for normal mode and visual mode. --- 332,338 ---- Added the ":retab" command. Can be used to change the size of a , replace spaces with a or a with spaces. Implemented "Vim -r" to list any swap files that can be found. ! The "gq" operator no longer affects empty lines. Added '-' register for deletes of less than one line, see |registers|. Quickfix: Support for several error formats at the same time. Added separate mapping for normal mode and visual mode. *************** *** 379,385 **** In command mode: - Missing command: 'Q' (go to Ex mode). Missing Ex commands: append, change, insert, open and z. The command characters are shown in the last line of the screen. They are --- 383,388 ---- *************** *** 554,559 **** --- 557,565 ---- by using a CTRL-M. For Vi this means you cannot insert a real CTRL-M in the text. With Vim you can put a real CTRL-M in the text by preceding it with a CTRL-V. + + The "Q" operator has been renamed to "gq" so that the "Q" command can switch + to "ex" mode. In insert mode: diff -rc ../vim-4.1/doc/vim_help.txt ./doc/vim_help.txt *** ../vim-4.1/doc/vim_help.txt Wed Jun 12 07:09:59 1996 --- ./doc/vim_help.txt Wed Jun 12 20:06:05 1996 *************** *** 462,468 **** |>| N >{motion} move the lines that are moved over with {motion} one shiftwidth right |>>| N >> move N lines one shiftwidth right ! |Q| N Q{motion} format the lines that are moved over with {motion} to 'textwidth' length |:ce| :[range]ce[nter] [width] center the lines in [range] --- 462,468 ---- |>| N >{motion} move the lines that are moved over with {motion} one shiftwidth right |>>| N >> move N lines one shiftwidth right ! |gq| N gq{motion} format the lines that are moved over with {motion} to 'textwidth' length |:ce| :[range]ce[nter] [width] center the lines in [range] *************** *** 646,652 **** |'expandtab'| |'et'| use spaces when is inserted |'exrc'| read .vimrc and .exrc in the current directory |'formatoptions'| |'fo'| how automatic formatting is to be done ! |'formatprg'| |'fp'| name of external program used with "Q" command |'gdefault'| |'gd'| the ":substitute" flag 'g' is default on |'guifont'| |'gfn'| GUI: Name(s) of font(s) to be used |'guioptions'| |'go'| GUI: Which components and options are used --- 646,652 ---- |'expandtab'| |'et'| use spaces when is inserted |'exrc'| read .vimrc and .exrc in the current directory |'formatoptions'| |'fo'| how automatic formatting is to be done ! |'formatprg'| |'fp'| name of external program used with "gq" command |'gdefault'| |'gd'| the ":substitute" flag 'g' is default on |'guifont'| |'gfn'| GUI: Name(s) of font(s) to be used |'guioptions'| |'go'| GUI: Which components and options are used *************** *** 801,806 **** --- 801,807 ---- C4350, etc.) |:normal| :norm[al][!] {commands} Execute Normal mode commands. + |Q| Q switch to "ex" mode. ------------------------------------------------------------------------------ *X_ce* Command-line editing diff -rc ../vim-4.1/doc/vim_idx.txt ./doc/vim_idx.txt *** ../vim-4.1/doc/vim_idx.txt Wed Jun 12 07:10:16 1996 --- ./doc/vim_idx.txt Wed Jun 12 23:10:33 1996 *************** *** 275,281 **** insert text, repeat N times |P| ["x]P 2 put the text [from buffer x] before the cursor N times ! |Q| Q{motion} 2 format Nmove lines |R| R 2 enter replace mode: overtype existing characters, repeat the entered text N-1 times --- 275,281 ---- insert text, repeat N times |P| ["x]P 2 put the text [from buffer x] before the cursor N times ! |Q| Q switch to "ex" mode |R| R 2 enter replace mode: overtype existing characters, repeat the entered text N-1 times *************** *** 587,592 **** --- 587,593 ---- lines down |gk| gk 1 like "k", but when 'wrap' on go N screen lines up + |gq| gq{motion} 2 format Nmove lines |gs| gs goto sleep for N seconds (default 1) |gu| gu{motion} 2 make Nmove text lowercase |gv| gv reselect the previous Visual area *************** *** 749,755 **** |:@| :@ execute contents of a register |:@@| :@@ repeat the previous ":@" |:Next| :N[ext] go to previous file in the argument list ! |:append| :a[ppend] append text (not implemented) |:abbreviate| :ab[breviate] enter abbreviation |:abclear| :abc[lear] remove all abbreviations |:all| :al[l] open a window for each file in the argument --- 750,756 ---- |:@| :@ execute contents of a register |:@@| :@@ repeat the previous ":@" |:Next| :N[ext] go to previous file in the argument list ! |:append| :a[ppend] append text |:abbreviate| :ab[breviate] enter abbreviation |:abclear| :abc[lear] remove all abbreviations |:all| :al[l] open a window for each file in the argument *************** *** 771,777 **** |:brewind| :br[ewind] go to last file in the buffer list |:buffers| :buffers list all files in the buffer list |:bunload| :bun[load] unload a specific buffer ! |:change| :c[hange] replace a line (not implemented) |:cNext| :cN[ext] go to previous error |:cabbrev| :ca[bbrev] like ":abbreviate" but for command-line mode |:cabclear| :cabc[lear] clear all abbreviations for command-line mode --- 772,778 ---- |:brewind| :br[ewind] go to last file in the buffer list |:buffers| :buffers list all files in the buffer list |:bunload| :bun[load] unload a specific buffer ! |:change| :c[hange] replace a line or series of lines |:cNext| :cN[ext] go to previous error |:cabbrev| :ca[bbrev] like ":abbreviate" but for command-line mode |:cabclear| :cabc[lear] clear all abbreviations for command-line mode *************** *** 811,817 **** |:gui| :gu[i] start the GUI |:gvim| :gv[im] start the GUI |:help| :h[elp] open a help window ! |:insert| :i[nsert] insert text (not implemented) |:iabbrev| :ia[bbrev] like ":abbrev" but for Insert mode |:iabclear| :iabc[lear] like ":abclear" but for Insert mode |:ijump| :ij[ump] jump to definition of identifier --- 812,818 ---- |:gui| :gu[i] start the GUI |:gvim| :gv[im] start the GUI |:help| :h[elp] open a help window ! |:insert| :i[nsert] insert text |:iabbrev| :ia[bbrev] like ":abbrev" but for Insert mode |:iabclear| :iabc[lear] like ":abclear" but for Insert mode |:ijump| :ij[ump] jump to definition of identifier *************** *** 923,929 **** |:unmap| :unm[ap] remove mapping |:version| :ve[rsion] print version number and other info |:vglobal| :v[global] execute commands for not matching lines ! |:visual| :vi[sual] same as ":edit" |:view| :vie[w] edit a file read-only |:vmap| :vm[ap] like ":map" but for Visual mode |:vmapclear| :vmapc[lear] remove all mappings for Visual mode --- 924,930 ---- |:unmap| :unm[ap] remove mapping |:version| :ve[rsion] print version number and other info |:vglobal| :v[global] execute commands for not matching lines ! |:visual| :vi[sual] same as ":edit", but turns off "ex" mode. |:view| :vie[w] edit a file read-only |:vmap| :vm[ap] like ":map" but for Visual mode |:vmapclear| :vmapc[lear] remove all mappings for Visual mode *************** *** 943,947 **** |:xit| :x[it] write if buffer changed and quit window or Vim |:xall| :xa[ll] same as ":wqall" |:yank| :y[ank] yank lines into a register ! |:z| :z print some lines (not implemented) |:~| :~ repeat last ":substitute" --- 944,948 ---- |:xit| :x[it] write if buffer changed and quit window or Vim |:xall| :xa[ll] same as ":wqall" |:yank| :y[ank] yank lines into a register ! |:z| :z print some lines |:~| :~ repeat last ":substitute" diff -rc ../vim-4.1/doc/vim_ref.txt ./doc/vim_ref.txt *** ../vim-4.1/doc/vim_ref.txt Wed Jun 12 07:10:42 1996 --- ./doc/vim_ref.txt Wed Jun 12 23:23:43 1996 *************** *** 424,431 **** foreach i ( *.let ) vim -s subs.vi $i If the executable is called "view", Vim will start in Readonly mode. This is ! useful if you can make a hard or symbolic link from "view" to "vim". ! Starting in Readonly mode can also be done with "vim -v". 3.2 Workbench (Amiga only) *workbench* --- 424,432 ---- foreach i ( *.let ) vim -s subs.vi $i If the executable is called "view", Vim will start in Readonly mode. This is ! useful if you can make a hard or symbolic link from "view" to "vim". Starting ! in Readonly mode can also be done with "vim -v". If the executable is called ! "ex", Vim will start in Ex mode rather than visual mode. 3.2 Workbench (Amiga only) *workbench* *************** *** 1079,1090 **** current insert command. Only differs from "l" when entering non-white characters while crossing the 'textwidth' boundary. ! If you want to format a block of text, you can use the "Q" operator. Type "Q" ! and a movement command to move the cursor to the end of the block. In many ! cases, the command "Q}" will do what you want (format until the end of ! paragraph). Alternatively, you can use "Qp", which will format the whole paragraph, no matter where the cursor currently is. Or you can use Visual ! mode: hit "v", move to the end of the block, and hit "Q". See also |Q|. 4.3.4 'expandtab' and 'smarttab' options *ins_expandtab* --- 1080,1091 ---- current insert command. Only differs from "l" when entering non-white characters while crossing the 'textwidth' boundary. ! If you want to format a block of text, you can use the "gq" operator. Type ! "gq" and a movement command to move the cursor to the end of the block. In ! many cases, the command "gq}" will do what you want (format until the end of ! paragraph). Alternatively, you can use "gqp", which will format the whole paragraph, no matter where the cursor currently is. Or you can use Visual ! mode: hit "v", move to the end of the block, and hit "gq". See also |gq|. 4.3.4 'expandtab' and 'smarttab' options *ins_expandtab* *************** *** 2509,2517 **** *:ex* :ex [+cmd] [file] Same as :edit. {Vi: go from visual to Ex mode} *:vi* *:visual* ! :vi[sual] [+cmd] [file] Same as :edit. {Vi: go from Ex to visual mode} *:vie* *:view* :vie[w] [+cmd] file Same as :edit, but set 'readonly' option for this --- 2510,2519 ---- *:ex* :ex [+cmd] [file] Same as :edit. {Vi: go from visual to Ex mode} + Use the |Q| command to switch to Ex mode. *:vi* *:visual* ! :vi[sual] [+cmd] [file] Same as :edit, but also go from Ex to visual mode. *:vie* *:view* :vie[w] [+cmd] file Same as :edit, but set 'readonly' option for this *************** *** 3459,3465 **** |gU| gU make upper case |!| ! filter through an external program |=| = filter through 'equalprg' or C-indenting if empty ! |Q| Q text formatting |>| > shift right |<| < shift left If the motion includes a count and the operator also had a count before it, --- 3461,3467 ---- |gU| gU make upper case |!| ! filter through an external program |=| = filter through 'equalprg' or C-indenting if empty ! |gq| gq text formatting |>| > shift right |<| < shift left If the motion includes a count and the operator also had a count before it, *************** *** 3665,3670 **** --- 3667,3695 ---- except after the "$" command, then the cursor will be put on the last character of the line. + *:z* + :{range}z[+-^.=]{count} Display several lines of text surrounding the line + specified with {range}, or around the current line + if there is no {range}. If there is a {count}, that's + how many lines you'll see; otherwise, the current + window size is used. + + :z can be used either alone or followed by any of + several punctuation marks. These have the following + effect: + + mark first line last line new location + ---- ---------- --------- ------------ + + current line 1 scr forward 1 scr forward + - 1 scr back current line current line + ^ 2 scr back 1 scr back 1 scr back + . 1/2 scr back 1/2 scr fwd 1/2 src fwd + = 1/2 src back 1/2 scr fwd current line + + Specifying no mark at all is the same as "+". + If the mark is "=", a line of dashes is printed + around the current line. + 6.3 Word motions *word_motions* *************** *** 5049,5054 **** --- 5074,5091 ---- buffer. Useful when you are editing e-mail and want to include a binary file. + *:a* *:append* + :{range}a[ppend] Insert several lines of text below the specified + line. Type a line containing only "." to stop + inserting. If the {range} is missing, the text + will be inserted after the current line. + + *:i* *:insert* + :{range}a[ppend] Insert several lines of text above the specified + line. Type a line containing only "." to stop + inserting. If the {range} is missing, the text + will be inserted before the current line. + 10. Deleting text *deleting* ================= *************** *** 5207,5212 **** --- 5244,5255 ---- followed by other blanks changes only the first blank; this is probably a bug, because "dw" deletes all the blanks} + *:c* *:change* + :{range}c[hange] Replace lines of text with some different text. + Type a line containing only "." to stop replacing. + If the {range} is missing, the current line will + be replaced with the new text. + 11.2 Simple changes *simple_change* *************** *** 5555,5576 **** :[range]le[ft] [indent] left align lines in [range]. Sets the indent in the lines to [indent] (default 0). {not in Vi} ! *Q* ! Q{motion} Format the lines that were moved over. The length of each line will be restricted to the width given with the 'textwidth' option. See below. If the 'textwidth' option is 0, the width of the screen is used (with a maximum of 79). {not in Vi} ! *v_Q* ! {Visual}Q Format the highlighted text. (see the chapter on Visual mode |Visual_mode|). {not in Vi} ! Example: To format the current paragraph use "Qp". ! After the "Q" command the cursor is left in the line where the motion command would take the cursor. This allows for the formatting to be repeated with ! ".". This works fine with "Qj" (format current and next line) and "Q}" (format until end of paragraph). Note: When 'formatprg' is set, the cursor is left on the first formatted line (like when using a filter command). --- 5598,5619 ---- :[range]le[ft] [indent] left align lines in [range]. Sets the indent in the lines to [indent] (default 0). {not in Vi} ! *gq* ! gq{motion} Format the lines that were moved over. The length of each line will be restricted to the width given with the 'textwidth' option. See below. If the 'textwidth' option is 0, the width of the screen is used (with a maximum of 79). {not in Vi} ! *v_gq* ! {Visual}gq Format the highlighted text. (see the chapter on Visual mode |Visual_mode|). {not in Vi} ! Example: To format the current paragraph use "gqp". ! After the "gq" command the cursor is left in the line where the motion command would take the cursor. This allows for the formatting to be repeated with ! ".". This works fine with "gqj" (format current and next line) and "gq}" (format until end of paragraph). Note: When 'formatprg' is set, the cursor is left on the first formatted line (like when using a filter command). *************** *** 5667,5673 **** in insert mode. o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. ! q Allow formatting of comments with Q. Note that blank lines, or lines containing only the comment leader will be left untouched. A new paragraph starts after such a line, or when the comment leader changes. --- 5710,5716 ---- in insert mode. o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. ! q Allow formatting of comments with gq. Note that blank lines, or lines containing only the comment leader will be left untouched. A new paragraph starts after such a line, or when the comment leader changes. *************** *** 5689,5695 **** With 't' and 'c' you can decide when auto-wrapping is done: value action ! "" no automatic formatting, "Q" can be used for manual formatting "t" automatic formatting of text, not for comments "c" automatic formatting for comments, not for text (good for C code) "tc" automatic formatting for text and comments --- 5732,5738 ---- With 't' and 'c' you can decide when auto-wrapping is done: value action ! "" no automatic formatting, "gq" can be used for manual formatting "t" automatic formatting of text, not for comments "c" automatic formatting for comments, not for text (good for C code) "tc" automatic formatting for text and comments *************** *** 5699,5705 **** Note that when 'paste' is on, no formatting is done at all. Note that 'textwidth' can be non-zero even though auto-wrapping never occurs. This is good because it can be used for formatting only in this case (with ! "Q"). If "/*", "*" and/or "*/" are in the 'comments' variable, then Vim has some built in stuff to treat these types of comments a bit more cleverly. --- 5742,5748 ---- Note that when 'paste' is on, no formatting is done at all. Note that 'textwidth' can be non-zero even though auto-wrapping never occurs. This is good because it can be used for formatting only in this case (with ! "gq"). If "/*", "*" and/or "*/" are in the 'comments' variable, then Vim has some built in stuff to treat these types of comments a bit more cleverly. *************** *** 6284,6290 **** < shift left (1)(*) |v_<| ! filter through external command (1) |v_!| = filter through 'equalprg' option command (1) |v_=| ! Q format lines to 'textwidth' length (1) |v_Q| The objects that can be used are: a word |v_a| --- 6327,6333 ---- < shift left (1)(*) |v_<| ! filter through external command (1) |v_!| = filter through 'equalprg' option command (1) |v_=| ! gq format lines to 'textwidth' length (1) |v_gq| The objects that can be used are: a word |v_a| *************** *** 6475,6480 **** --- 6518,6532 ---- sleep". While sleeping the cursor is positioned in the text (if visible). {not in Vi} + *Q* + Q Switch to "ex" mode. This is just like typing ":" + commands one after another, except you don't have to + keep pressing ":" and the screen doesn't get updated + after each command. Use the |:visual| command to + return to the normal visual editor. Vim will enter + this mode by default if it's invoked as "ex" on the + command line. + 15. Repeating commands *repeating* ====================== *************** *** 7400,7406 **** in Insert mode or when using the "o" or "O" command). If you do not type anything on the new line except and then type or , the indent is deleted again. When autoindent is on, ! formatting (with the "Q" command or when you reach 'textwidth' in Insert mode) uses the indentation of the first line. When 'smartindent' or 'cindent' is on the indent is changed in specific cases. The 'autoindent' option is reset when the 'paste' option is --- 7452,7458 ---- in Insert mode or when using the "o" or "O" command). If you do not type anything on the new line except and then type or , the indent is deleted again. When autoindent is on, ! formatting (with the "gq" command or when you reach 'textwidth' in Insert mode) uses the indentation of the first line. When 'smartindent' or 'cindent' is on the indent is changed in specific cases. The 'autoindent' option is reset when the 'paste' option is *************** *** 7916,7922 **** global {not in Vi} The name of an external program that will be used to format the lines ! selected with the "Q" command. The program must take the input on stdin and produce the output on stdout. The Unix program 'fmt' is such a program. If this option is an empty string, the internal format function will be used |C_indenting|. Environment variables are --- 7968,7974 ---- global {not in Vi} The name of an external program that will be used to format the lines ! selected with the "gq" command. The program must take the input on stdin and produce the output on stdout. The Unix program 'fmt' is such a program. If this option is an empty string, the internal format function will be used |C_indenting|. Environment variables are *************** *** 9689,9701 **** These commands are in Vi, but not in Vim. - Q {Vi: go to Ex mode} - - :a[ppend] {Vi: append text} *:a* *:append* - :c[hange] {Vi: replace lines} *:c* *:change* - :i[nsert] {Vi: insert text} *:i* *:insert* :o[pen] {Vi: start editing in open mode}*:o* *:open* - :z {Vi: print some lines} *:z* 21.2 Missing options *missing_options* --- 9741,9747 ---- diff -rc ../vim-4.1/doc/vim_tags ./doc/vim_tags *** ../vim-4.1/doc/vim_tags Wed Jun 12 07:16:15 1996 --- ./doc/vim_tags Wed Jun 12 23:35:22 1996 *************** *** 1160,1165 **** --- 1160,1166 ---- O vim_ref.txt /\*O\* P vim_ref.txt /\*P\* Q vim_ref.txt /\*Q\* + Q_renamed vim_40.txt /\*Q_renamed\* R vim_ref.txt /\*R\* S vim_ref.txt /\*S\* SHELL vim_ref.txt /\*SHELL\* *************** *** 1432,1437 **** --- 1433,1439 ---- gg vim_ref.txt /\*gg\* gj vim_ref.txt /\*gj\* gk vim_ref.txt /\*gk\* + gq vim_ref.txt /\*gq\* graphic_option_gone vim_40.txt /\*graphic_option_gone\* greek vim_ref.txt /\*greek\* gs vim_ref.txt /\*gs\* *************** *** 1593,1598 **** --- 1595,1601 ---- new_cindent vim_40.txt /\*new_cindent\* new_commandline vim_40.txt /\*new_commandline\* new_complete vim_40.txt /\*new_complete\* + new_ex vim_40.txt /\*new_ex\* new_features vim_40.txt /\*new_features\* new_gui vim_40.txt /\*new_gui\* new_help vim_40.txt /\*new_help\* *************** *** 1835,1841 **** v_J vim_ref.txt /\*v_J\* v_K vim_ref.txt /\*v_K\* v_P vim_ref.txt /\*v_P\* - v_Q vim_ref.txt /\*v_Q\* v_R vim_ref.txt /\*v_R\* v_S vim_ref.txt /\*v_S\* v_U vim_ref.txt /\*v_U\* --- 1838,1843 ---- *************** *** 1845,1850 **** --- 1847,1853 ---- v_a vim_ref.txt /\*v_a\* v_c vim_ref.txt /\*v_c\* v_d vim_ref.txt /\*v_d\* + v_gq vim_ref.txt /\*v_gq\* v_gv vim_ref.txt /\*v_gv\* v_o vim_ref.txt /\*v_o\* v_p vim_ref.txt /\*v_p\* Only in ./src: TAGS Only in ./src: alloc.o Only in ./src: buffer.o Only in ./src: charset.o diff -rc ../vim-4.1/src/cmdcmds.c ./src/cmdcmds.c *** ../vim-4.1/src/cmdcmds.c Sun Jun 9 16:35:01 1996 --- ./src/cmdcmds.c Wed Jun 12 23:26:03 1996 *************** *** 1188,1190 **** --- 1188,1348 ---- /* print full filename if :cd used */ fileinfo(did_cd, FALSE, forceit); } + + /* + * do the Ex mode :insert and :append commands + */ + + void + ex_insert (int before, linenr_t whatline) + { + /* put the cursor somewhere sane if we insert nothing */ + + if (whatline > curbuf->b_ml.ml_line_count) { + curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + } else { + curwin->w_cursor.lnum = whatline; + } + + while (1) { + char_u *theline; + + if (((theline = getcmdline (' ', 1L)) == 0) || + ((theline[0] == '.') && (theline[1] == 0))) { + break; + } + + if (before) { + mark_adjust (whatline, MAXLNUM, 1, 0L); + ml_append (whatline - 1, theline, (colnr_t) 0, FALSE); + curwin->w_cursor.lnum = whatline; + } else { + mark_adjust (whatline + 1, MAXLNUM, 1, 0L); + ml_append (whatline, theline, (colnr_t) 0, FALSE); + curwin->w_cursor.lnum = whatline + 1; + } + + vim_free (theline); + whatline++; + } + + CHANGED; + beginline (MAYBE); + updateScreen (NOT_VALID); + } + + /* + * do the Ex mode :change command + */ + + void + ex_change (linenr_t start, linenr_t end) + { + while (end >= start) { + ml_delete (start, FALSE); + end--; + } + + ex_insert (TRUE, start); + } + + void + ex_z (linenr_t line, char_u *arg) + { + char_u *x; + int bigness = curwin->w_height - 3; + char_u kind; + int minus = 0; + linenr_t start, end, curs, i; + + if (arg == 0) { /* is this possible? I don't remember */ + arg = ""; + } + + if (bigness < 1) { + bigness = 1; + } + + x = arg; + if (*x == '-' || *x == '+' || *x == '=' || *x == '^' || *x == '.') x++; + + if (*x != 0) { + if (!isdigit (*x)) { + EMSG ("non-numeric argument to :z"); + return; + } else { + bigness = atoi (x); + } + } + + kind = *arg; + + switch (kind) { + case '-': + start = line - bigness; + end = line; + curs = line; + break; + + case '=': + start = line - bigness / 2 + 1; + end = line + bigness / 2 - 1; + curs = line; + minus = 1; + break; + + case '^': + start = line - bigness * 2; + end = line - bigness; + curs = line - bigness; + break; + + case '.': + start = line - bigness / 2; + end = line + bigness / 2; + curs = end; + break; + + default: /* '+' */ + start = line; + end = line + bigness; + curs = end; + break; + } + + if (start < 1) { + start = 1; + } + + if (end > curbuf->b_ml.ml_line_count) { + end = curbuf->b_ml.ml_line_count; + } + + if (curs > curbuf->b_ml.ml_line_count) { + curs = curbuf->b_ml.ml_line_count; + } + + for (i = start; i <= end; i++) { + int j; + + if (minus && (i == line)) { + msg_outchar ('\n'); + + for (j = 1; j < Columns; j++) { + msg_outchar ('-'); + } + } + + print_line (i, FALSE); + + if (minus && (i == line)) { + msg_outchar ('\n'); + + for (j = 1; j < Columns; j++) { + msg_outchar ('-'); + } + } + } + + curwin->w_cursor.lnum = curs; + } Only in ./src: cmdcmds.o diff -rc ../vim-4.1/src/cmdline.c ./src/cmdline.c *** ../vim-4.1/src/cmdline.c Wed Jun 12 06:00:20 1996 --- ./src/cmdline.c Wed Jun 12 23:31:13 1996 *************** *** 279,284 **** --- 279,285 ---- #endif gotocmdline(TRUE); msg_outchar(firstc); + /* * Avoid scrolling when called by a recursive do_cmdline(), e.g. when doing * ":@0" when register 0 doesn't contain a CR. *************** *** 1001,1006 **** --- 1002,1041 ---- } /* + * ex_mode(): repeatedly get ex commands for the Q command, until we + * return to visual mode. + */ + + void + do_exmode() + { + int save_msg_scroll; + + save_msg_scroll = msg_scroll; + ++RedrawingDisabled; + + exmode_active = TRUE; + msg_scroll = TRUE; + need_wait_return = FALSE; + + while (exmode_active) { + linenr_t oldline = curwin->w_cursor.lnum; + + do_cmdline ((char_u *) 0, TRUE, TRUE); + lines_left = Rows - 1; + + if (oldline != curwin->w_cursor.lnum && !ex_no_reprint) { + print_line (curwin->w_cursor.lnum, FALSE); + } + + ex_no_reprint = FALSE; + } + + --RedrawingDisabled; + msg_scroll = save_msg_scroll; + } + + /* * do_cmdline(): execute an Ex command line * * 1. If no line given, get one. *************** *** 1184,1189 **** --- 1219,1230 ---- for (cmd = *cmdlinep; vim_strchr((char_u *)" \t:", *cmd) != NULL; cmd++) ; + /* in ex mode, an empty line works like :+ */ + + if (*cmd == NUL && exmode_active) { + cmd = "+"; + } + if (*cmd == '"' || *cmd == NUL) /* ignore comment and empty lines */ goto doend; *************** *** 2362,2367 **** --- 2403,2414 ---- case CMD_ex: case CMD_visual: case CMD_view: + if (cmdidx == CMD_visual || cmdidx == CMD_view) { + exmode_active = FALSE; + + if (*arg == NUL) break; + } + if ((cmdidx == CMD_new) && *arg == NUL) { setpcmark(); *************** *** 2520,2525 **** --- 2567,2574 ---- if (cmdidx == CMD_list) curwin->w_p_list = i; + ex_no_reprint = TRUE; + break; case CMD_shell: *************** *** 3071,3076 **** --- 3120,3142 ---- *cmd == 'd' ? FIND_DEFINE : FIND_ANY, n, i, line1, line2); } + break; + + case CMD_insert: + ex_insert (TRUE, line2); + break; + + case CMD_append: + ex_insert (FALSE, line2); + break; + + case CMD_change: + ex_change (line1, line2); + break; + + case CMD_z: + ex_z (line2, arg); + ex_no_reprint = TRUE; break; default: Only in ./src: cmdline.o Only in ./src: cmdtab.h diff -rc ../vim-4.1/src/cmdtab.tab ./src/cmdtab.tab *** ../vim-4.1/src/cmdtab.tab Wed May 29 15:46:43 1996 --- ./src/cmdtab.tab Wed Jun 12 22:45:07 1996 *************** *** 239,245 **** {(char_u *)"xit", RANGE+BANG+FILE1+DFLALL+TRLBAR}, {(char_u *)"xall", BANG+TRLBAR}, {(char_u *)"yank", RANGE+REGSTR+COUNT+TRLBAR}, ! {(char_u *)"z", RANGE+COUNT+TRLBAR}, /* not supported */ {(char_u *)"@", RANGE+EXTRA+TRLBAR}, {(char_u *)"!", RANGE+BANG+NAMEDFS}, {(char_u *)"<", RANGE+COUNT+TRLBAR}, --- 239,245 ---- {(char_u *)"xit", RANGE+BANG+FILE1+DFLALL+TRLBAR}, {(char_u *)"xall", BANG+TRLBAR}, {(char_u *)"yank", RANGE+REGSTR+COUNT+TRLBAR}, ! {(char_u *)"z", RANGE+EXTRA+TRLBAR}, /* not supported */ {(char_u *)"@", RANGE+EXTRA+TRLBAR}, {(char_u *)"!", RANGE+BANG+NAMEDFS}, {(char_u *)"<", RANGE+COUNT+TRLBAR}, Only in ./src: config.cache Only in ./src: config.h Only in ./src: config.log diff -rc ../vim-4.1/src/config.mk ./src/config.mk *** ../vim-4.1/src/config.mk Sun Jun 2 08:22:53 1996 --- ./src/config.mk Wed Jun 12 17:40:11 1996 *************** *** 1 **** ! the first targets to make vim are: scratch config myself --- 1,48 ---- ! # ! # config.mk.in -- autoconf template for Vim on Unix vim:ts=8:sw=8: ! # ! # DO NOT EDIT config.mk!! Do not edit config.mk.in!! Edit Makefile and run ! # configure again. config.mk will be overwritten by configure. ! # ! # Configure does not edit the makefile directly. This method is not the ! # standard use of GNU autoconf, but it has two advantages: ! # a) The user can override every choice made by configure. ! # b) Modifications to the makefile are not lost when configure is run. ! # ! # I hope this is worth being nonstandard. jw. ! ! ! CC = gcc ! DEFS = -DHAVE_CONFIG_H ! CFLAGS = -O2 -fno-strength-reduce -Wall -Wshadow ! srcdir = . ! LDFLAGS = ! LIBS = -ltermcap ! CTAGS = ctags -t ! ! CPP = gcc -E ! CPP_MM = M ! X_CFLAGS = -I/usr/X11R6/include ! X_LIBS_DIR = -L/usr/X11R6/lib ! X_PRE_LIBS = -lSM -lICE ! X_EXTRA_LIBS = ! X_LIBS = -lX11 ! ! ### Prefix for location of files ! PREFIX = /usr/local ! # to fix a bug in autoconf, also do this: ! prefix = /usr/local ! ! ### Location of binary ! EXEC_PREFIX = ${prefix} ! ! ### Location for help files ! HELPDIR = /lib ! ! ### Do we have a GUI ! GUI_INC_LOC = . ! GUI_LIB_LOC = . ! MOTIF_COMMENT = ZZZ ! ATHENA_COMMENT = ! NARROW_PROTO = -DFUNCPROTO=15 -DNARROWPROTO ! GUI_X_LIBS = -lXext Only in ./src: config.status Only in ./src: csearch.o Only in ./src: digraph.o Only in ./src: edit.o Only in ./src: ex Only in ./src: fileio.o Only in ./src: foo.source Only in ./src: getchar.o diff -rc ../vim-4.1/src/globals.h ./src/globals.h *** ../vim-4.1/src/globals.h Sun Jun 9 16:34:58 1996 --- ./src/globals.h Wed Jun 12 23:33:22 1996 *************** *** 378,383 **** --- 378,397 ---- EXTERN char_u no_lines_msg[] INIT(="--No lines in buffer--"); /* + * ex mode (Q) state + */ + + EXTERN int exmode_active INIT(= FALSE); + EXTERN int ex_no_reprint INIT(= FALSE); /* no need to print after z or p */ + + /* + * message.c: lines left before a "more" message. Ex mode needs to + * be able to reset this after you type something. + */ + + EXTERN int lines_left INIT(= -1); /* lines left for listing */ + + /* * The error messages that can be shared are included here. * Excluded are very specific errors and debugging messages. */ Only in ./src: gui.o Only in ./src: gui_at_sb.o Only in ./src: gui_athena.o Only in ./src: gui_x11.o Only in ./src: help.o Only in ./src: linefunc.o diff -rc ../vim-4.1/src/main.c ./src/main.c *** ../vim-4.1/src/main.c Sun Jun 9 16:35:01 1996 --- ./src/main.c Wed Jun 12 22:10:51 1996 *************** *** 150,155 **** --- 150,156 ---- int arg_idx = 0; /* index for arg_files[] */ int check_version = FALSE; /* check .vimrc version number */ int argv_idx; /* index in argv[n][] */ + int invoked_as_ex = FALSE; /* argv[0] is "ex" */ #if defined(MSDOS) || defined(WIN32) || defined(OS2) static struct initmap *************** *** 246,251 **** --- 247,261 ---- } /* + * If the executable is called "ex" we start in ex mode. + */ + + if (STRCMP(gettail((char_u *)argv[0]), (char_u *)"ex") == 0) + { + invoked_as_ex = TRUE; + } + + /* * If the executable is called "gvim" we run the GUI version. */ if (STRCMP(gettail((char_u *)argv[0]), (char_u *)"gvim") == 0) *************** *** 849,855 **** secure = 0; scroll_start(); ! screenclear(); /* clear screen */ no_wait_return = TRUE; --- 859,868 ---- secure = 0; scroll_start(); ! ! if (!invoked_as_ex) { ! screenclear(); /* clear screen */ ! } no_wait_return = TRUE; *************** *** 984,990 **** * If there is nothing in the stuff_buffer or do_redraw is TRUE, * update cursor and redraw. */ ! if (skip_redraw) skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { --- 997,1003 ---- * If there is nothing in the stuff_buffer or do_redraw is TRUE, * update cursor and redraw. */ ! if (skip_redraw || invoked_as_ex) skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { *************** *** 1025,1030 **** --- 1038,1060 ---- setcursor(); cursor_on(); + } + + /* + * if we're invoked as ex, do a round of ex commands before + * going on to normal mode + */ + + if (invoked_as_ex) { + do_exmode(); + + cursupdate(); + updateScreen(TRUE); + showmode(); + setcursor(); + cursor_on(); + + invoked_as_ex = FALSE; } /* Only in ./src: main.o Only in ./src: mark.o Only in ./src: memfile.o Only in ./src: memline.o diff -rc ../vim-4.1/src/message.c ./src/message.c *** ../vim-4.1/src/message.c Wed Jun 12 06:13:32 1996 --- ./src/message.c Wed Jun 12 23:33:27 1996 *************** *** 19,25 **** static void msg_screen_outchar __ARGS((int c)); static int msg_check_screen __ARGS((void)); ! static int lines_left = -1; /* lines left for listing */ /* * msg(s) - displays the string 's' on the status line --- 19,25 ---- static void msg_screen_outchar __ARGS((int c)); static int msg_check_screen __ARGS((void)); ! /* lines_left moved to globals so do_exmode could see it */ /* * msg(s) - displays the string 's' on the status line *************** *** 230,235 **** --- 230,241 ---- quit_more = FALSE; got_int = FALSE; } + else if (exmode_active) + { + MSG_OUTSTR(" "); /* make sure the cursor is on the right line */ + c = CR; /* no need for a return in ex mode */ + got_int = FALSE; + } else { State = HITRETURN; *************** *** 531,536 **** --- 537,552 ---- int n_spaces = 0; char_u *p = NULL; /* init to make SASC shut up */ int n; + + /* + * if it's a blank line, echo a space, because otherwise if we're + * in ex mode, the : for the next command will end up on the wrong + * line. I don't know why -- hooray for cargo cult programming! + */ + + if (*s == 0) { + msg_outchar(' '); + } for (;;) { Only in ./src: message.o Only in ./src: misccmds.o Only in ./src: mkcmdtab diff -rc ../vim-4.1/src/normal.c ./src/normal.c *** ../vim-4.1/src/normal.c Mon Jun 10 18:51:27 1996 --- ./src/normal.c Wed Jun 12 19:42:39 1996 *************** *** 511,516 **** --- 511,521 ---- do_cmdline(NULL, FALSE, FALSE); break; + case 'Q': + do_exmode(); + updateScreen(CLEAR); + break; + case K_HELP: case K_F1: if (checkclearopq()) *************** *** 1573,1579 **** case '<': case '!': case '=': ! case 'Q': dooperator: n = vim_strchr(opchars, c) - opchars + 1; if (n == op_type) /* double operator works on lines */ --- 1578,1586 ---- case '<': case '!': case '=': ! /* ! * case 'Q': ! */ dooperator: n = vim_strchr(opchars, c) - opchars + 1; if (n == op_type) /* double operator works on lines */ *************** *** 1840,1845 **** --- 1847,1861 ---- case 'g': switch (nchar) { + /* + * "gq": rewrap the current paragraph (old Q command) + */ + + case 'q': /* which of these should this be? if either? */ + case 'Q': + c = 'Q'; + goto dooperator; + /* * "gv": reselect the previous visual area */ Only in ./src: normal.o Only in ./src: ops.o Only in ./src: option.o diff -rc ../vim-4.1/src/osdef.h ./src/osdef.h *** ../vim-4.1/src/osdef.h Sun Jun 9 16:34:58 1996 --- ./src/osdef.h Wed Jun 12 17:40:28 1996 *************** *** 1,6 **** /* ! * osdef.h is automagically created from osdef?.h.in by osdef.sh -- DO NOT EDIT ! */ /* autoconf cannot fiddle out declarations. Use our homebrewn tools. (jw) */ /* * Declarations that may cause conflicts belong here so that osdef.sh --- 1,6 ---- /* ! * osdef.h is automagically created from osdef?.h.in by osdef.sh -- DO NOT EDIT ! */ /* autoconf cannot fiddle out declarations. Use our homebrewn tools. (jw) */ /* * Declarations that may cause conflicts belong here so that osdef.sh *************** *** 35,40 **** --- 35,41 ---- #ifdef USEBCOPY #else # ifdef USEMEMCPY + extern void memcpy __ARGS((char *, char *, int)); # else # ifdef USEMEMMOVE # endif Only in ./src: pathdef.c Only in ./src: pathdef.o diff -rc ../vim-4.1/src/proto/cmdcmds.pro ./src/proto/cmdcmds.pro *** ../vim-4.1/src/proto/cmdcmds.pro Wed Jun 12 06:30:32 1996 --- ./src/proto/cmdcmds.pro Wed Jun 12 22:46:10 1996 *************** *** 14,16 **** --- 14,19 ---- void do_fixdel __PARMS((void)); void print_line __PARMS((linenr_t lnum, int use_number)); void do_file __PARMS((char_u *arg, int forceit)); + void ex_insert __PARMS((int before, linenr_t whatline)); + void ex_change __PARMS((linenr_t start, linenr_t end)); + void ex_z __PARMS((linenr_t line, char_u *arg)); diff -rc ../vim-4.1/src/proto/cmdline.pro ./src/proto/cmdline.pro *** ../vim-4.1/src/proto/cmdline.pro Wed Jun 12 06:30:35 1996 --- ./src/proto/cmdline.pro Wed Jun 12 17:49:44 1996 *************** *** 21,23 **** --- 21,24 ---- int read_viminfo_history __PARMS((char_u *line, FILE *fp)); void finish_viminfo_history __PARMS((void)); void write_viminfo_history __PARMS((FILE *fp)); + void do_exmode __PARMS((void)); Only in ./src: pty.o Only in ./src: quickfix.o Only in ./src: regexp.o Only in ./src: regsub.o Only in ./src: screen.o Only in ./src: search.o Only in ./src: tables.o Only in ./src: tag.o Only in ./src: term.o Only in ./src: undo.o Only in ./src: unix.o Only in ./src: version.o Only in ./src: vim Only in ./src: window.o