To: vim-dev@vim.org Subject: Patch 6.1.182 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.182 (depends on 6.1.142) Problem: It is not possible to auto-format comments only. (Moshe Kaminsky) Solution: When the 'a' and 'c' flags are in 'formatoptions' only auto-format comments. Files: runtime/doc/change.txt, src/edit.c *** ../vim61.181/runtime/doc/change.txt Sun Jul 28 22:02:42 2002 --- runtime/doc/change.txt Mon Sep 16 21:22:56 2002 *************** *** 1,4 **** ! *change.txt* For Vim version 6.1. Last change: 2002 Jul 28 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *change.txt* For Vim version 6.1. Last change: 2002 Sep 16 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 1239,1244 **** --- 1246,1253 ---- A line that ends in a non-white character ends a paragraph. a Automatic formatting of paragraphs. Every time text is inserted or deleted the paragraph will be reformatted. See |auto-format|. + When the 'c' flag is present this only happens for recognized + comments. n When formatting text, recognize numbered lists. The indent of the text after the number is used for the next line. The number may optionally be followed by '.', ':', ')', ']' or '}'. Note that *************** *** 1331,1342 **** - You can set the 'formatoptions' based on the type of file |filetype| or specifically for one file with a |modeline|. ! - Set 'formatoptions' to "aw2tcq" to make text with indents like this: bla bla foobar bla bla foobar bla foobar bla bla bla foobar bla bla foobar bla bla foobar And a few warnings: --- 1340,1353 ---- - You can set the 'formatoptions' based on the type of file |filetype| or specifically for one file with a |modeline|. ! - Set 'formatoptions' to "aw2tq" to make text with indents like this: bla bla foobar bla bla foobar bla foobar bla bla bla foobar bla bla foobar bla bla foobar + + - Add the 'c' flag to only auto-format comments. Useful in source code. And a few warnings: *** ../vim61.181/src/edit.c Thu Aug 1 20:47:28 2002 --- src/edit.c Tue Sep 10 19:47:16 2002 *************** *** 4244,4249 **** --- 4250,4260 ---- /* Don't format in Insert mode when the cursor is on a trailing blank, the * user might insert normal text next. */ if (*old != NUL && pos.col == STRLEN(old) && vim_iswhite(old[pos.col - 1])) + return; + + /* With the 'c' flag in 'formatoptions' only format comments. */ + if (has_format_option(FO_WRAP_COMS) + && get_leader_len(old, NULL, FALSE) == 0) return; old = vim_strsave(old); *** ../vim61.181/src/version.c Mon Sep 16 21:17:43 2002 --- src/version.c Mon Sep 16 21:24:13 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 182, /**/ -- An easy way to determine if you have enough teamwork to be doomed is simply to measure how long it takes from the time you decide to go to lunch together until the time you actually eat. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///