Mercurial > vim
changeset 32:41f9fd58cf13 v7.0019
updated for version 7.0019
author | vimboss |
---|---|
date | Tue, 12 Oct 2004 20:02:24 +0000 |
parents | 6f8b1be930a6 |
children | f6033dcbaf31 |
files | runtime/doc/change.txt runtime/doc/eval.txt runtime/doc/syntax.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/version7.txt runtime/syntax/2html.vim src/auto/configure src/configure.in src/eval.c src/os_unix.c src/testdir/Makefile |
diffstat | 12 files changed, 241 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.0aa. Last change: 2004 Sep 16 +*change.txt* For Vim version 7.0aa. Last change: 2004 Oct 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -13,6 +13,10 @@ 1. Deleting text |deleting| 2. Delete and insert |delete-insert| 3. Simple changes |simple-change| *changing* 4. Complex changes |complex-change| + 4.1 Filter commands |filter| + 4.2 Substitute |:substitute| + 4.3 Search and replace |search-replace| + 4.4 Changing tabs |change-tabs| 5. Copying and moving text |copy-move| 6. Formatting text |formatting| @@ -449,7 +453,19 @@ For example: > ============================================================================== 4. Complex changes *complex-change* - *!* *filter* +4.1 Filter commands *filter* + +A filter is a program that accepts text at standard input, changes it in some +way, and sends it to standard output. You can use the commands below to send +some text through a filter, so that it is replace by the filter output. +Examples of filters are "sort", which sorts lines alphabetically, and +"indent", which formats C program files (you need a version of indent that +works like a filter; not all versions do). The 'shell' option specifies the +shell Vim uses to execute the filter command (See also the 'shelltype' +option). You can repeat filter commands with ".". Vim does not recognize a +comment (starting with '"') after the ":!" command. + + *!* !{motion}{filter} Filter {motion} text lines through the external program {filter}. @@ -492,17 +508,9 @@ 4. Complex changes *complex-change* {Visual}= Filter the highlighted lines like with ={motion}. {not in Vi} -A filter is a program that accepts text at standard input, changes it in some -way, and sends it to standard output. You can use the commands above to send -some text through a filter. Examples of filters are "sort", which sorts lines -alphabetically, and "indent", which formats C program files (you need a -version of indent that works like a filter; not all versions do). The 'shell' -option specifies the shell Vim uses to execute the filter command (See also -the 'shelltype' option). You can repeat filter commands with ".". Vim does -not recognize a comment (starting with '"') after the ":!" command. - - *:s* *:su* *:substitute* +4.2 Substitute *:substitute* + *:s* *:su* :[range]s[ubstitute]/{pattern}/{string}/[&][c][e][g][p][r][i][I] [count] For each line in [range] replace a match of {pattern} with {string}. @@ -741,7 +749,9 @@ Example: > This replaces an end-of-line with a new line containing the value of $HOME. - *:pro* *:promptfind* +4.3 Search and replace *search-replace* + + *:pro* *:promptfind* :promptf[ind] [string] Put up a Search dialog. When [string] is given, it is used as the initial search string. @@ -753,6 +763,8 @@ This replaces an end-of-line with a new given, it is used as the initial search string. {only for Win32, Motif and GTK GUI} + +4.4 Changing tabs *change-tabs* *:ret* *:retab* :[range]ret[ab][!] [new_tabstop] Replace all sequences of white-space containing a
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2004 Oct 10 +*eval.txt* For Vim version 7.0aa. Last change: 2004 Oct 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -831,6 +831,8 @@ cscope_connection( [{num} , {dbpath} [, cursor( {lnum}, {col}) Number position cursor at {lnum}, {col} delete( {fname}) Number delete file {fname} did_filetype() Number TRUE if FileType autocommand event used +diff_filler( {lnum}) Number diff filler lines about {lnum} +diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col} escape( {string}, {chars}) String escape {chars} in {string} with '\' eventhandler( ) Number TRUE if inside an event handler executable( {expr}) Number 1 if executable {expr} exists @@ -932,7 +934,7 @@ strtrans( {expr}) String translate stri submatch( {nr}) String specific match in ":substitute" substitute( {expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} -synID( {line}, {col}, {trans}) Number syntax ID at {line} and {col} +synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} synIDattr( {synID}, {what} [, {mode}]) String attribute {what} of syntax ID {synID} synIDtrans( {synID}) Number translated syntax ID of {synID} @@ -1270,6 +1272,26 @@ did_filetype() Returns non-zero when aut editing another buffer to set 'filetype' and load a syntax file. +diff_filler({lnum}) *diff_filler()* + Returns the number of filler lines above line {lnum}. + These are the lines that were inserted at this point in + another diff'ed window. These filler lines are shown in the + display but don't exist in the buffer. + {lnum} is used like with |getline()|. Thus "." is the current + line, "'m" mark m, etc. + Returns 0 if the current window is not in diff mode. + +diff_hlID({lnum}, {col}) *diff_hlID()* + Returns the highlight ID for diff mode at line {lnum} column + {col} (byte index). When the current line does not have a + diff change zero is returned. + {lnum} is used like with |getline()|. Thus "." is the current + line, "'m" mark m, etc. + {col} is 1 for the leftmost column, {lnum} is 1 for the first + line. + The highlight ID can be used with |synIDattr()| to obtain + syntax information about the highlighting. + escape({string}, {chars}) *escape()* Escape the characters in {chars} that occur in {string} with a backslash. Example: > @@ -2630,12 +2652,12 @@ substitute({expr}, {pat}, {sub}, {flags} :echo substitute("testing", ".*", "\\U\\0", "") < results in "TESTING". -synID({line}, {col}, {trans}) *synID()* +synID({lnum}, {col}, {trans}) *synID()* The result is a Number, which is the syntax ID at the position - {line} and {col} in the current window. + {lnum} and {col} in the current window. The syntax ID can be used with |synIDattr()| and |synIDtrans()| to obtain syntax information about text. - {col} is 1 for the leftmost column, {line} is 1 for the first + {col} is 1 for the leftmost column, {lnum} is 1 for the first line. When {trans} is non-zero, transparent items are reduced to the item that they reveal. This is useful when wanting to know
--- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.0aa. Last change: 2004 Oct 10 +*syntax.txt* For Vim version 7.0aa. Last change: 2004 Oct 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -420,6 +420,16 @@ To go back to the automatic mechanism, d variable: > :unlet html_use_encoding < +Closed folds are kept as they are displayed. If you don't want closed folds +in the HTML use the |zR| command before converting. + +For diff mode a sequence of more than 3 filler lines is displayed as three +lines with the middle line mentioning the total number of inserted lines. If +you prefer to see all the inserted lines use: > + :let html_whole_filler = 1 +And to go back to displaying up to three lines again: > + :unlet html_whole_filler + *convert-to-XML* *convert-to-XHTML* An alternative is to have the script generate XHTML (XML compliant HTML). To do this set the "use_xhtml" variable: >
--- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4161,6 +4161,7 @@ cc change.txt /*cc* ch-syntax syntax.txt /*ch-syntax* ch.vim syntax.txt /*ch.vim* change-list-jumps motion.txt /*change-list-jumps* +change-tabs change.txt /*change-tabs* change.txt change.txt /*change.txt* changed-5.1 version5.txt /*changed-5.1* changed-5.2 version5.txt /*changed-5.2* @@ -4417,6 +4418,8 @@ diff-mode diff.txt /*diff-mode* diff-options diff.txt /*diff-options* diff-patchexpr diff.txt /*diff-patchexpr* diff.txt diff.txt /*diff.txt* +diff_filler() eval.txt /*diff_filler()* +diff_hlID() eval.txt /*diff_hlID()* digraph-arg change.txt /*digraph-arg* digraph-encoding digraph.txt /*digraph-encoding* digraph-table digraph.txt /*digraph-table* @@ -4691,6 +4694,7 @@ foldlevel() eval.txt /*foldlevel()* foldlevel-variable eval.txt /*foldlevel-variable* foldstart-variable eval.txt /*foldstart-variable* foldtext() eval.txt /*foldtext()* +foldtextresult() eval.txt /*foldtextresult()* font-sizes gui_x11.txt /*font-sizes* fontset mbyte.txt /*fontset* foreground() eval.txt /*foreground()* @@ -5935,6 +5939,7 @@ search-commands pattern.txt /*search-com search-offset pattern.txt /*search-offset* search-pattern pattern.txt /*search-pattern* search-range pattern.txt /*search-range* +search-replace change.txt /*search-replace* searchpair() eval.txt /*searchpair()* section motion.txt /*section* sed-syntax syntax.txt /*sed-syntax*
--- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2004 Oct 10 +*todo.txt* For Vim version 7.0aa. Last change: 2004 Oct 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,9 +30,6 @@ be worked on, but only if you sponsor Vi *known-bugs* -------------------- Known bugs and current work ----------------------- -Folding support for 2html. (Carl Osterwisch, Oct 4) -Now diff output! - Aborting at the ATTENTION prompt causes trouble: buffer remains active, nwindows isn't closed (fixed in buffer.c) alternate buffer gets "read error" flag. @@ -196,6 +193,10 @@ For version 7.0: Also: when the environment variable exists, use it. If it doesn't exist, set it. Requires good names: $VIM_USER_VIMRC $VIM_USER_DIR +xterm title: After setting a title, obtaining the title still may result in +the old one. Sometimes happens with the test scripts. Setting the title is +done with an ESC sequence, obtaining the old title with an X library call. +Invoking XFlush() before getting the title doesn't help. - In the kvim/KDE source files fix the formatting. - KDE version is called "kvim". Make it "gvim", like the others? @@ -360,6 +361,8 @@ name. (Charles Campbell) Add gui_mch_browsedir() for Motif, KDE and Mac OS/X. +Translated manual pages: Install German one in /usr/local/man/de/man1/vim.1 + Vi incompatibility: 9 In Ex mode, "u" undoes all changes, not just the last one. (John Cowan) @@ -1281,9 +1284,6 @@ 8 Add an option 'foldskip' with values commands skip over a closed fold. 8 "H" and "L" count buffer lines instead of window lines. (Servatius Brandt) 8 Add a way to add fold-plugins. Johannes Zellner has one for VB. -7 When using 2html.vim, also reproduce folds as you can see them. When - someone doesn't want the folds he can disable them before converting. - First attempt by Carl Osterwisch, 2004 May 10. 7 When using manual folding, the undo command should also restore folds. - Allow completely hiding a closed fold. Require showing a character in 'foldcolumn' to avoid the missing line goes unnoticed.
--- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2004 Oct 11 +*version7.txt* For Vim version 7.0aa. Last change: 2004 Oct 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -54,6 +54,7 @@ isn't set. This avoids creating buffers The "2html.vim" script now converts closed folds to HTML. This means the HTML looks like its displayed, with the same folds open and closed. Use "zR" if no folds should appear in the HTML. (partly by Carl Osterwisch) +Diff mode now is also converted as it is displayed. ============================================================================== NEW FEATURES *new-7* @@ -187,6 +188,11 @@ SQL-Informix syntax file. (Dean L Hill) PHP compiler plugin. (Doug Kearns) +New Keymaps: ~ + +Sinhala (Sri Lanka) (Harshula Jayasuriya) + + New message translations: ~ The Ukranian messages are now also available in cp1251.
--- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2004 Oct 10 +" Last Change: 2004 Oct 12 " (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>) " (XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>) @@ -251,20 +251,67 @@ if has('folding') unlet s:c endif +" For diff filler lines +if has('diff') + if s:numblines + let s:fillerline = strpart(' ', 0, strlen(line("$"))) . ' ' + else + let s:fillerline = '' + endif + let s:fillchar = &fillchars[matchend(&fillchars, 'diff:')] + if s:fillchar == '' + let s:fillchar = '-' + endif + while strlen(s:fillerline) < &columns + let s:fillerline = s:fillerline . s:fillchar + endwhile +endif while s:lnum <= s:end + " If there are filler lines for diff mode, show these above the line. + let s:filler = diff_filler(s:lnum) + if s:filler > 0 + let s:n = s:filler + while s:n > 0 + if s:n > 2 && s:n < s:filler && !exists("html_whole_filler") + let s:new = strpart(s:fillerline, 0, 3) . " " . s:filler . " inserted lines " + let s:new = s:new . strpart(s:fillerline, strlen(s:new)) + let s:n = 2 + else + let s:new = s:fillerline + endif + let s:id_name = "DiffDelete" + let s:id = hlID(s:id_name) + let s:new = '<span class="' . s:id_name . '">' . s:new . '</span>' + " Add the class to class list if it's not there yet + if stridx(s:idlist, "," . s:id . ",") == -1 + let s:idlist = s:idlist . s:id . "," + endif + + exe s:newwin . "wincmd w" + exe "normal! a" . strtrans(s:new) . "\n\e" + exe s:orgwin . "wincmd w" + let s:n = s:n - 1 + endwhile + unlet s:n + endif + unlet s:filler + + " Start the line with the line number. + if s:numblines + let s:new = strpart(' ', 0, strlen(line("$")) - strlen(s:lnum)) . s:lnum . ' ' + else + let s:new = "" + endif + " Get the current line let s:line = getline(s:lnum) - let s:new = "" if has('folding') && foldclosed(s:lnum) > -1 " " This is the beginning of a folded block " - if s:numblines - let s:new = strpart(' ', 0, strlen(line("$")) - strlen(s:lnum)) . s:lnum . ' ' - endif let s:line = foldtextresult(s:lnum) let s:new = s:new . s:line @@ -293,18 +340,34 @@ while s:lnum <= s:end let s:len = strlen(s:line) if s:numblines - let s:new = '<span class="lnr">' . strpart(' ', 0, strlen(line("$")) - strlen(s:lnum)) . s:lnum . '</span> ' + let s:new = '<span class="lnr">' . s:new . '</span> ' endif + " Get the diff attribute, if any. + let s:diffattr = diff_hlID(s:lnum, 1) + " Loop over each character in the line let s:col = 1 while s:col <= s:len let s:startcol = s:col " The start column for processing text - let s:id = synID(s:lnum, s:col, 1) - let s:col = s:col + 1 - " Speed loop (it's small - that's the trick) - " Go along till we find a change in synID - while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile + if s:diffattr + let s:id = diff_hlID(s:lnum, s:col) + let s:col = s:col + 1 + " Speed loop (it's small - that's the trick) + " Go along till we find a change in hlID + while s:col <= s:len && s:id == diff_hlID(s:lnum, s:col) | let s:col = s:col + 1 | endwhile + while s:len < &columns + " Add spaces at the end to mark the changed line. + let s:line = s:line . ' ' + let s:len = s:len + 1 + endwhile + else + let s:id = synID(s:lnum, s:col, 1) + let s:col = s:col + 1 + " Speed loop (it's small - that's the trick) + " Go along till we find a change in synID + while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile + endif " Output the text with the same synID, with class set to {s:id_name} let s:id = synIDtrans(s:id) @@ -457,3 +520,4 @@ if !exists("html_use_css") delfunc s:HtmlOpening delfunc s:HtmlClosing endif +silent! unlet s:htmlfoldtext s:fillerline s:diffattr
--- a/src/auto/configure +++ b/src/auto/configure @@ -2271,7 +2271,7 @@ echo "configure:2266: checking Tcl versi echo $ac_n "checking for location of Tcl include""... $ac_c" 1>&6 echo "configure:2273: checking for location of Tcl include" >&5 if test "x$MACOSX" != "xyes"; then - tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include" + tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include" else tclinc="/System/Library/Frameworks/Tcl.framework/Headers" fi
--- a/src/configure.in +++ b/src/configure.in @@ -713,7 +713,7 @@ if test "$enable_tclinterp" = "yes"; the AC_MSG_CHECKING(for location of Tcl include) if test "x$MACOSX" != "xyes"; then - tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include" + tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include" else dnl For Mac OS X 10.3, use the OS-provided framework location tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
--- a/src/eval.c +++ b/src/eval.c @@ -274,6 +274,8 @@ static void f_cscope_connection __ARGS(( static void f_cursor __ARGS((VAR argsvars, VAR retvar)); static void f_delete __ARGS((VAR argvars, VAR retvar)); static void f_did_filetype __ARGS((VAR argvars, VAR retvar)); +static void f_diff_filler __ARGS((VAR argvars, VAR retvar)); +static void f_diff_hlID __ARGS((VAR argvars, VAR retvar)); static void f_escape __ARGS((VAR argvars, VAR retvar)); static void f_eventhandler __ARGS((VAR argvars, VAR retvar)); static void f_executable __ARGS((VAR argvars, VAR retvar)); @@ -2837,6 +2839,8 @@ static struct fst {"cursor", 2, 2, f_cursor}, {"delete", 1, 1, f_delete}, {"did_filetype", 0, 0, f_did_filetype}, + {"diff_filler", 1, 1, f_diff_filler}, + {"diff_hlID", 2, 2, f_diff_hlID}, {"escape", 2, 2, f_escape}, {"eventhandler", 0, 0, f_eventhandler}, {"executable", 1, 1, f_executable}, @@ -3977,6 +3981,79 @@ f_did_filetype(argvars, retvar) } /* + * "diff_filler()" function + */ +/*ARGSUSED*/ + static void +f_diff_filler(argvars, retvar) + VAR argvars; + VAR retvar; +{ +#ifdef FEAT_DIFF + retvar->var_val.var_number = diff_check_fill(curwin, get_var_lnum(argvars)); +#endif +} + +/* + * "diff_hlID()" function + */ +/*ARGSUSED*/ + static void +f_diff_hlID(argvars, retvar) + VAR argvars; + VAR retvar; +{ +#ifdef FEAT_DIFF + linenr_T lnum = get_var_lnum(argvars); + static linenr_T prev_lnum = 0; + static int changedtick = 0; + static int fnum = 0; + static int change_start = 0; + static int change_end = 0; + static enum hlf_value hlID = 0; + int filler_lines; + int col; + + if (lnum != prev_lnum + || changedtick != curbuf->b_changedtick + || fnum != curbuf->b_fnum) + { + /* New line, buffer, change: need to get the values. */ + filler_lines = diff_check(curwin, lnum); + if (filler_lines < 0) + { + if (filler_lines == -1) + { + change_start = MAXCOL; + change_end = -1; + if (diff_find_change(curwin, lnum, &change_start, &change_end)) + hlID = HLF_ADD; /* added line */ + else + hlID = HLF_CHD; /* changed line */ + } + else + hlID = HLF_ADD; /* added line */ + } + else + hlID = (enum hlf_value)0; + prev_lnum = lnum; + changedtick = curbuf->b_changedtick; + fnum = curbuf->b_fnum; + } + + if (hlID == HLF_CHD || hlID == HLF_TXD) + { + col = get_var_number(&argvars[1]) - 1; + if (col >= change_start && col <= change_end) + hlID = HLF_TXD; /* changed text */ + else + hlID = HLF_CHD; /* changed line */ + } + retvar->var_val.var_number = hlID == (enum hlf_value)0 ? 0 : (int)hlID; +#endif +} + +/* * "escape({string}, {chars})" function */ static void
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -1535,13 +1535,7 @@ get_x11_windis() get_x11_title(test_only) int test_only; { - int retval; - - retval = get_x11_thing(TRUE, test_only); - - /* could not get old title: oldtitle == NULL */ - - return retval; + return get_x11_thing(TRUE, test_only); } /* @@ -1829,7 +1823,8 @@ mch_settitle(title, icon) * than x11 calls, because the x11 calls don't always work */ #ifdef FEAT_GUI_KDE - /* dont know why but KDE needs this one as we don't go through the next function... */ + /* dont know why but KDE needs this one as we don't go through the next + * function... */ gui_mch_settitle(title, icon); #endif if ((type || *T_TS != NUL) && title != NULL)
--- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -47,6 +47,8 @@ test1.out: test1.in .in.out: -rm -f $*.failed test.ok X* cp $*.ok test.ok + # Sleep a moment to avoid that the xterm title is messed up + @-sleep .2 $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in @/bin/sh -c "if diff test.out $*.ok; \ then mv -f test.out $*.out; \