# HG changeset patch # User vimboss # Date 1088782715 0 # Node ID bdeee1504ac1c4e71baf095b8c68b1559934d4b8 # Parent 4424b47a0797cf9d096e5bf354ee2453d0f4dfa9 updated for version 7.0004 diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.0aa. Last change: 2004 Jun 30 +*autocmd.txt* For Vim version 7.0aa. Last change: 2004 Jul 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -486,6 +486,8 @@ InsertLeave When leaving Insert mode. *FileEncoding* FileEncoding Obsolete. It still works and is equivalent to |EncodingChanged|. + *ColorScheme* +ColorScheme After loading a color scheme. |:colorscheme| *RemoteReply* RemoteReply When a reply from a Vim that functions as server was received |server2client()|. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.0aa. Last change: 2004 Mar 31 +*cmdline.txt* For Vim version 7.0aa. Last change: 2004 Jul 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -45,12 +45,13 @@ thus you cannot edit beyond that. *cmdline-history* *history* The command-lines that you enter are remembered in a history table. You can -recall them with the up and down cursor keys. There are actually four +recall them with the up and down cursor keys. There are actually five history tables: - one for ':' commands - one for search strings - one for expressions - one for input lines, typed for the |input()| function. +- one for debug mode commands These are completely separate. Each history can only be accessed when entering the same type of line. Use the 'history' option to set the number of lines that are remembered @@ -305,6 +306,7 @@ terminals) s[earch] or / search string history e[xpr] or = expression register history i[nput] or @ input line history + d[ebug] or > debug command history a[ll] all of the above {not in Vi} diff --git a/runtime/doc/gui_x11.txt b/runtime/doc/gui_x11.txt --- a/runtime/doc/gui_x11.txt +++ b/runtime/doc/gui_x11.txt @@ -1,4 +1,4 @@ -*gui_x11.txt* For Vim version 7.0aa. Last change: 2004 Mar 16 +*gui_x11.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -435,7 +435,7 @@ the WM to identify the window by restori command line argument). ============================================================================== -7. KDE version *gui-kde* *KDE* *KVim* +7. KDE version *gui-kde* *kde* *KDE* *KVim* The KDE version of Vim works with KDE 2.x and KDE 3.x. KVim (name code for gui-kde) does not use traditional X settings for its diff --git a/runtime/doc/hangulin.txt b/runtime/doc/hangulin.txt --- a/runtime/doc/hangulin.txt +++ b/runtime/doc/hangulin.txt @@ -96,6 +96,6 @@ Bug or Comment Send comments, patches and suggestions to: Chi-Deok Hwang - Nam SungHyun + Nam SungHyun vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.0aa. Last change: 2004 Jun 16 +*index.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -89,7 +89,7 @@ tag char action ~ |i_CTRL-V_digit| CTRL-V {number} insert three digit decimal number as a single byte. |i_CTRL-W| CTRL-W delete word before the cursor -|i_CTRL-X| CTRL-X {mode} enter CTRL-X sub mode, see below +|i_CTRL-X| CTRL-X {mode} enter CTRL-X sub mode, see |i_CTRL-X_index| |i_CTRL-Y| CTRL-Y insert the character which is above the cursor |i_CTRL-Z| CTRL-Z when 'insertmode' set: suspend Vim |i_| end insert mode (unless 'insertmode' set) @@ -141,7 +141,7 @@ tag char action ~ |i_| scroll three lines upwards |i_| scroll a full page upwards -commands in CTRL-X submode +commands in CTRL-X submode *i_CTRL-X_index* |i_CTRL-X_CTRL-D| CTRL-X CTRL-D complete defined identifiers |i_CTRL-X_CTRL-E| CTRL-X CTRL-E scroll up @@ -153,6 +153,8 @@ commands in CTRL-X submode |i_CTRL-X_CTRL-P| CTRL-X CTRL-P previous completion |i_CTRL-X_CTRL-T| CTRL-X CTRL-T complete identifiers from thesaurus |i_CTRL-X_CTRL-Y| CTRL-X CTRL-Y scroll down +|i_CTRL-X_CTRL-U| CTRL-X CTRL-U complete with 'completefunc' +|i_CTRL-X_CTRL-V| CTRL-X CTRL-V complete like in : command line |i_CTRL-X_CTRL-]| CTRL-X CTRL-] complete tags {not available when compiled without the +insert_expand feature} @@ -449,6 +451,8 @@ These can be used after an operator or i tag command action in Normal mode ~ ------------------------------------------------------------------------------ +|v_aquote| a" double quoted string +|v_a'| a' single quoted string |v_a(| a( same as ab |v_a)| a) same as ab |v_a<| a< "a <>" from '<' to the matching '>' @@ -457,12 +461,15 @@ tag command action in Normal mode ~ |v_aW| aW "a WORD" (with white space) |v_a[| a[ "a []" from '[' to the matching ']' |v_a]| a] same as a[ +|v_a`| a` string in backticks |v_ab| ab "a block" from "[(" to "])" (with braces) |v_ap| ap "a paragraph" (with white space) |v_as| as "a sentence" (with white space) |v_aw| aw "a word" (with white space) |v_a{| a{ same as aB |v_a}| a} same as aB +|v_iquote| i" double quoted string without the quotes +|v_i'| i' single quoted string without the quotes |v_i(| i( same as ib |v_i)| i) same as ib |v_i<| i< "inner <>" from '<' to the matching '>' @@ -471,6 +478,7 @@ tag command action in Normal mode ~ |v_iW| iW "inner WORD" |v_i[| i[ "inner []" from '[' to the matching ']' |v_i]| i] same as i[ +|v_i`| i` string in backticks without the backticks |v_ib| ib "inner block" from "[(" to "])" |v_ip| ip "inner paragraph" |v_is| is "inner sentence" diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.0aa. Last change: 2004 Jun 24 +*insert.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -854,6 +854,23 @@ CTRL-X CTRL-V Guess what kind of item i completion, for example: > :imap +User defined completing *compl-function* + +Completion is done by a function that can be defined by the user with the +'completefunc' option. See the option for how the function is called and an +example. + + *i_CTRL-X_CTRL-U* +CTRL-X CTRL-U Guess what kind of item is in front of the cursor and + find the first match for it. + CTRL-U or + CTRL-N Use the next match. This match replaces the previous + one. + + CTRL-P Use the previous match. This match replaces the + previous one. + + Completing keywords from different sources *compl-generic* *i_CTRL-N* diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -1360,7 +1360,7 @@ options.txt for detailed information. Contributions specifically for the multi-byte features by: Chi-Deok Hwang - Nam SungHyun + Nam SungHyun K.Nagano Taro Muraoka Yasuhiro Matsumoto diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 7.0aa. Last change: 2004 Jun 17 +*motion.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -597,6 +597,26 @@ iB "inner Block", select [count] Block |[{|). When used in Visual mode it is made characterwise. +a" *v_aquote* *aquote* +a' *v_a'* *a'* +a` *v_a`* *a`* + "a quoted string". Selects the text from the previous + quote until the next quote. The 'quoteescape' is used + to skip escaped quotes. + When the cursor starts on a quote, Vim will figure out + which quote pairs form a string by searching from the + start of the line. + Any trailing or leading white space is included. + When used in Visual mode it is made characterwise. + Repeating this object in Visual mode another string is + included. A count is currently not used. + +i" *v_iquote* *iquote* +i' *v_i'* *i'* +i` *v_i`* *i`* + Like a", a' and a`, but exclude the quotes and + repeating won't extend the Visual selection. + When used after an operator: For non-block objects: For the "a" commands: The operator applies to the object and the white diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2004 Jun 28 +*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1514,6 +1514,51 @@ A jump table for the options with a shor based expansion (eg dictionary |i_CTRL-X_CTRL-K|, included patterns |i_CTRL-X_CTRL-I|, tags |i_CTRL-X_CTRL-]| and normal expansions) + *'completefunc'* *'cfu'* +'completefunc' 'cfu' string (default: empty) + local to buffer + {not in Vi} + This option specifies a completion function to be used for CTRL-X + CTRL-X. The function will be invoked with four arguments: + a:line the text of the current line + a:base the text with which matches should match + a:col column in a:line where the cursor is, first column is + zero + a:findstart either 1 or 0 + When the a:findstart argument is 1, the function must return the + column of where the completion starts. It must be a number between + zero and "a:col". This involves looking at the characters in a:line + before column a:col and include those characters that could be part of + the completed item. + When the a:findstart argument is 0 the function must return a string + with the matching words, separated by newlines. When there are no + matches return an empty string. + An example that completes the names of the months: > + fun! CompleteMonths(line, base, col, findstart) + if a:findstart + " locate start column of word + let start = a:col + while start > 0 && a:line[start - 1] =~ '\a' + let start = start - 1 + endwhile + return start + else + " find months matching with "a:base" + let res = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" + if a:base != '' + let res = substitute(res, '\c\<\(\(' . a:base . '.\{-}\>\)\|.\{-}\>\)', '\2', 'g') + endif + let res = substitute(res, ' \+', "\n", 'g') + return res + endif + endfun + set completefunc=CompleteMonths +< Note that a substitute() function is used to reduce the list of + possible values and remove the ones that don't match the base. The + part before the "\|" matches the base, the part after it is used + when there is no match. The "\2" in the replacement is empty if the + part before the "\|" does not match. + *'confirm'* *'cf'* *'noconfirm'* *'nocf'* 'confirm' 'cf' boolean (default off) global @@ -3082,6 +3127,7 @@ A jump table for the options with a shor hidden although the 'hidden' option is off: When the buffer is modified, 'autowrite' is off or writing is not possible, and the '!' flag was used. See also |windows.txt|. + To only make one buffer hidden use the 'bufhidden' option. This option is set for one command with ":hide {command}" |:hide|. WARNING: It's easy to forget that you have changes in hidden buffers. Think twice when using ":q!" or ":qa!". @@ -3835,6 +3881,8 @@ A jump table for the options with a shor precedes:c Character to show in the first column, when 'wrap' is off and there is text preceding the character visible in the first column. + nbsp:c Character to show for non-breakable space. Left to + blank when omitted. The characters ':' and ',' should not be used. UTF-8 characters can be used when 'encoding' is "utf-8", otherwise only printable @@ -3842,10 +3890,10 @@ A jump table for the options with a shor Examples: > :set lcs=tab:>-,trail:- - :set lcs=tab:>-,eol:< + :set lcs=tab:>-,eol:<,nbsp:% :set lcs=extends:>,precedes:< < The "NonText" highlighting will be used for "eol", "extends" and - "precedes". "SpecialKey" for "tab" and "trail". + "precedes". "SpecialKey" for "nbsp", "tab" and "trail". *'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'* 'loadplugins' 'lpl' boolean (default on) @@ -4652,6 +4700,16 @@ A jump table for the options with a shor Example: > :set printoptions=paper:letter,duplex:off < + *'quoteescape''* *'qe'* +'quoteescape' 'qe' string (default "\") + local to buffer + {not in Vi} + The characters that are used to escape quotes in a string. Used for + objects like a', a" and a` |a'|. + When one of the characters in this option is found inside a string, + the following character will be skipped. The default value makes the + text "foo\"bar\\" considered to be one string. + *'readonly'* *'ro'* *'noreadonly'* *'noro'* 'readonly' 'ro' boolean (default off) local to buffer diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -17,6 +17,20 @@ 4. Transparent File Transfer........... 5. Ex Commands.........................................|netrw-ex| 6. Variables and Options...............................|netrw-var| 7. Remote Directory Browser............................|netrw-browse| + ?..........Help....................................|netrw-help| + .......Browsing................................|netrw-cr| + ......Refreshing the Listing..................|netrw-c-l| + ......Removing Files or Directories...........|netrw-delete| + D..........Removing Files or Directories...........|netrw-D| + R..........Renaming Files or Directories...........|netrw-R| + -..........Going Up................................|netrw--| + a..........Hiding Files or Directories.............|netrw-a| + h..........Edit File/Directory Hiding..............|netrw-h| + o..........Browsing with a Horizontal Split........|netrw-o| + r..........Reversing Sorting Order.................|netrw-r| + s..........Selecting Sorting Style.................|netrw-s| + v..........Browsing with a Vertical Split..........|netrw-v| + x..........Customizing Browsing....................|netrw-x| 8. Debugging...........................................|netrw-debug| 9. History.............................................|netrw-history| 10. Credits.............................................|netrw-credits| @@ -414,6 +428,7 @@ variables listed below, and may be modif g:netrw_sftp_cmd variable ="sftp" > ------------------------------------------------------------------------- < + *netrw-ftp* The first two options both help with certain ftp's that give trouble otherwise. In order to best understand how to use these options if ftp is giving you troubles, a bit of discussion follows on how netrw does ftp reads. @@ -455,6 +470,11 @@ requested it and the temporary file dele If your ftp doesn't accept the "user" command and immediately just demands a userid, then try putting "let netrw_ftp=1" in your <.vimrc>. + *netrw-cadaver* +To handle the SSL certificate dialog for untrusted servers, one may pull +down the certificate and place it into /usr/ssl/cert.pem. This operation +renders the server treatment as "trusted". + *netrw-fixup* If your ftp for whatever reason generates unwanted lines (such as AUTH messages) you may write a NetReadFixup(tmpfile) function: @@ -493,24 +513,26 @@ from itself: > ============================================================================== -7. Remote Directory Browser *netrw-browse* *netrw-dir* *netrw-list* +7. Remote Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help* > - ------- ----------- Command Explanation ------- ----------- + ? Causes Netrw to issue help Netrw will enter the directory or read the file Netrw will attempt to remove the file/directory + Causes Netrw to refresh the directory listing D Netrw will attempt to remove the file(s)/directory(ies) R Netrw will attempt to rename the file(s)/directory(ies) - Makes Netrw go up one directory a Show all of a directory (temporarily ignore g:netrw_list_hide) + h Edit file hiding list o Enter the file/directory under the cursor in a new browser window. A horizontal split is used. + r Reverse sorting order + s Select sorting style: by name, time, or file size v Enter the file/directory under the cursor in a new browser window. A vertical split is used. x Apply a function to a file. - Causes Netrw to refresh the directory listing - ? Causes Netrw to issue help < *netrw-browse-var* > @@ -524,18 +546,38 @@ 7. Remote Directory Browser *netrw-brow g:netrw_winsize specify initial size of new o/v windows g:netrw_list_hide comma separated list of patterns for hiding files + g:netrw_sort_by sort by "name", "time", or "size" + g:netrw_sort_direction sorting direction: "normal" or "reverse" + g:netrw_sort_sequence when sorting by name, first sort by the + comma-separated pattern sequence < +INTRODUCTION TO REMOTE DIRECTORY BROWSING + Netrw supports the browsing of directories on remote hosts, including -generating listing directories, entering directories, editing files -therein, deleting files/directories, and moving (renaming) files and -directories. +generating listing directories, entering directories, editing files therein, +deleting files/directories, and moving (renaming) files and directories. The +Netrw browser generally implements the file explorer methods but for remote +directories, although details (such as pertinent global variable names) +necessarily differ. To enter the netrw directory browser, simply attempt to read a "file" with a trailing slash and it will be interpreted as a request to list a directory: vim [protocol]://[user@]hostname/path/ -Netrw will modify the command in g:netrw_list_cmd to perform the directory + +REFRESHING THE LISTING *netrw-c-l* + +To refresh the directory listing, press ctrl-l () or hit the +when atop the ./ directory entry in the listing. + + +GOING UP *netrw--* + +To go up a directory, press - or his the when atop the ../ directory +entry in the listing. + +Netrw will modify the command in *g:netrw_list_cmd* to perform the directory listing operation. By default the command is: ssh HOSTNAME ls -FLa @@ -545,58 +587,121 @@ to read. Naturally, the user may overri preferred. The NetList function which implements remote directory browsing expects that directories will be flagged by a trailing slash. + +BROWSING *netrw-cr* + Browsing is simple: move the cursor onto a file or directory of interest. Hitting the (the return key) will select the file or directory. Directories will themselves be listed, and files will be opened using the protocol given in the original read request. - *netrw-delete* *netrw-remove* + +REMOVING FILES OR DIRECTORIES *netrw-delete* *netrw-remove* *netrw-D* Deleting/removing files and directories involves moving the cursor to the -file/directory to be deleted and pressing "D". Directories must be empty -first before they can be successfully removed. If the directory is a softlink -to a directory, then netrw will make two requests to remove the directory -before succeeding. Netrw will ask for confirmation before doing the -removal(s). You may select a range of lines with the "V" command (visual -selection), and then pressing "D". +file/directory to be deleted and pressing "D". Directories must be empty first +before they can be successfully removed. If the directory is a softlink to a +directory, then netrw will make two requests to remove the directory before +succeeding. Netrw will ask for confirmation before doing the removal(s). +You may select a range of lines with the "V" command (visual selection), +and then pressing "D". -The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are -used to control the attempts to remove files and directories. The -g:netrw_rm_cmd is used with files, and its default value is: + *g:netrw_rm_cmd* +The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used +to control the attempts to remove files and directories. The g:netrw_rm_cmd +is used with files, and its default value is: g:netrw_rm_cmd: ssh HOSTNAME rm -The g:netrw_rmdir_cmd is used with directories. Its default value is: + *g:netrw_rmdir_cmd* +The g:netrw_rmdir_cmd variable is used to support the removal of directories. +Its default value is: g:netrw_rmdir_cmd: ssh HOSTNAME rmdir + *g:netrw_rmf_cmd* If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt -to remove it again using the g:netrw_rmf_cmd. Its default value is: +to remove it again using the g:netrw_rmf_cmd variable. Its default value is: g:netrw_rmf_cmd: ssh HOSTNAME rm -f - *netrw-x* -The Netrw executor applies a user-defined function to a file, based on its -extension. Of course, the handler function must exist for it to be called. -> - Ex. mypgm.html x -> NetrwFileHandler_html("scp://user@host/some/path/mypgm.html") -< -See the - - *netrw-move* *netrw-rename* +RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* Renaming/moving files and directories involves moving the cursor to the file/directory to be moved (renamed) and pressing "R". You will then be queried for where you want the file/directory to be moved. You may select a range of lines with the "V" command (visual selection), and then pressing "R". -The g:netrw_rename_cmd is used to implement renaming. By default its +The g:netrw_rename_cmd variable is used to implement renaming. By default its value is: ssh HOSTNAME mv - *netrw-list-hack* + +HIDING FILES OR DIRECTORIES *g:netrw_a* *g:netrw_list_hide* + +The "a" map lets the browser ignore the g:netrw_list_hide variable. Normally +the g:netrw_list_hide variable holds a comma separated list of patterns which +will be hidden (removed) from the directory listing. + + +EDIT FILE OR DIRECTORY HIDING *netrw-h* + +The "h" map brings up a requestor allowing the user to change the +file/directory hiding list. + + +BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* + +Normally one enters a file or directory using the . However, the "o" +map allows one to open a new window to hold the new directory listing or +file. A horizontal split is used. (also see |netrw-v|) + + +SELECTING SORTING STYLE *netrw-s* + +One may select the sorting style by name, time, or (file) size. The +"s" map allows one to circulate among the three choices; the directory +listing will automatically be refreshed to reflect the selected style. + + +REVERSING SORTING ORDER *netrw-r* + +One may toggle between normal and reverse sorting order by pressing the +"r" key. + + +BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* + +Normally one enters a file or directory using the . However, the "v" +map allows one to open a new window to hold the new directory listing or +file. A vertical split is used. (also see |netrw-o|) + + +CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* + +One may "enter" a file with a special handler, thereby firing up a browser or +other application, for example, on a file by hitting the "x" key. Presumably +one could write handlers that would start OpenOffice programs (oowriter), etc, +based on the file's extension coupled with the user's hitting the "x" key atop +the file. + +The Netrw executor applies a user-defined function to a file, based on its +extension. Of course, the handler function must exist for it to be called! +> + Ex. mypgm.html x -> + NetrwFileHandler_html("scp://user@host/some/path/mypgm.html") +< +See the for an example of how to handle an html +file with mozilla. + + +IMPROVING DIRECTORY BROWSING *netrw-list-hack* + +Especially with the remote directory browser, constantly entering the password +is tedious. + For Linux/Unix systems, I suggest looking into http://hacks.oreilly.com/pub/h/66 diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.0aa. Last change: 2004 May 05 +*quickref.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -630,6 +630,7 @@ Short explanation of each option: *opti |'commentstring'| |'cms'| template for comments; used for fold marker |'compatible'| |'cp'| behave Vi-compatible as much as possible |'complete'| |'cpt'| specify how Insert mode completion works +|'completefunc'| |'cfu'| function to be used for Insert mode completion |'confirm'| |'cf'| ask what to do about unsaved/read-only files |'conskey'| |'consk'| get keys directly from console (MS-DOS only) |'copyindent'| |'ci'| make 'autoindent' use existing indent structure @@ -779,6 +780,7 @@ Short explanation of each option: *opti |'printfont'| |'pfn'| name of the font to be used for :hardcopy |'printheader'| |'pheader'| format of the header used for :hardcopy |'printoptions'| |'popt'| controls the format of :hardcopy output +|'quoteescape'| |'qe'| escape characters used in a string |'readonly'| |'ro'| disallow writing the buffer |'remap'| allow mappings to work recursively |'report'| threshold for reporting nr. of lines changed diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.0aa. Last change: 2004 Jun 16 +*syntax.txt* For Vim version 7.0aa. Last change: 2004 Jul 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3495,6 +3495,8 @@ in their own color. :echo g:colors_name < Doesn't work recursively, thus you can't use ":colorscheme" in a color scheme script. + After the color scheme has been loaded the + |ColorScheme| autocommand event is triggered. :hi[ghlight] List all the current highlight groups that have attributes set. diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -92,6 +92,7 @@ 'cdpath' options.txt /*'cdpath'* 'cedit' options.txt /*'cedit'* 'cf' options.txt /*'cf'* +'cfu' options.txt /*'cfu'* 'ch' options.txt /*'ch'* 'character' intro.txt /*'character'* 'charconvert' options.txt /*'charconvert'* @@ -116,6 +117,7 @@ 'commentstring' options.txt /*'commentstring'* 'compatible' options.txt /*'compatible'* 'complete' options.txt /*'complete'* +'completefunc' options.txt /*'completefunc'* 'confirm' options.txt /*'confirm'* 'consk' options.txt /*'consk'* 'conskey' options.txt /*'conskey'* @@ -623,7 +625,9 @@ 'pt' options.txt /*'pt'* 'pvh' options.txt /*'pvh'* 'pvw' options.txt /*'pvw'* +'qe' options.txt /*'qe'* 'quote motion.txt /*'quote* +'quoteescape'' options.txt /*'quoteescape''* 'readonly' options.txt /*'readonly'* 'redraw' vi_diff.txt /*'redraw'* 'remap' options.txt /*'remap'* @@ -2866,6 +2870,7 @@ Cmdline cmdline.txt /*Cmdline* Cmdline-mode cmdline.txt /*Cmdline-mode* CmdwinEnter autocmd.txt /*CmdwinEnter* CmdwinLeave autocmd.txt /*CmdwinLeave* +ColorScheme autocmd.txt /*ColorScheme* Command-line cmdline.txt /*Command-line* Command-line-mode cmdline.txt /*Command-line-mode* Contents quickref.txt /*Contents* @@ -3863,6 +3868,7 @@ ZZ editing.txt /*ZZ* `{ motion.txt /*`{* `} motion.txt /*`}* a insert.txt /*a* +a' motion.txt /*a'* a( motion.txt /*a(* a) motion.txt /*a)* a4 options.txt /*a4* @@ -3875,6 +3881,7 @@ aB motion.txt /*aB* aW motion.txt /*aW* a[ motion.txt /*a[* a] motion.txt /*a]* +a` motion.txt /*a`* ab motion.txt /*ab* abandon editing.txt /*abandon* abbreviations map.txt /*abbreviations* @@ -3920,6 +3927,7 @@ ap motion.txt /*ap* apache-syntax syntax.txt /*apache-syntax* apache.vim syntax.txt /*apache.vim* append() eval.txt /*append()* +aquote motion.txt /*aquote* arabic.txt arabic.txt /*arabic.txt* arabicfonts arabic.txt /*arabicfonts* arabickeymap arabic.txt /*arabickeymap* @@ -4185,6 +4193,7 @@ compl-current insert.txt /*compl-current compl-define insert.txt /*compl-define* compl-dictionary insert.txt /*compl-dictionary* compl-filename insert.txt /*compl-filename* +compl-function insert.txt /*compl-function* compl-generic insert.txt /*compl-generic* compl-keyword insert.txt /*compl-keyword* compl-tag insert.txt /*compl-tag* @@ -4950,6 +4959,7 @@ htmlos-syntax syntax.txt /*htmlos-syntax htmlos.vim syntax.txt /*htmlos.vim* http pi_netrw.txt /*http* i insert.txt /*i* +i' motion.txt /*i'* i( motion.txt /*i(* i) motion.txt /*i)* i< motion.txt /*i<* @@ -5032,9 +5042,11 @@ i_CTRL-X_CTRL-L insert.txt /*i_CTRL-X_CT i_CTRL-X_CTRL-N insert.txt /*i_CTRL-X_CTRL-N* i_CTRL-X_CTRL-P insert.txt /*i_CTRL-X_CTRL-P* i_CTRL-X_CTRL-T insert.txt /*i_CTRL-X_CTRL-T* +i_CTRL-X_CTRL-U insert.txt /*i_CTRL-X_CTRL-U* i_CTRL-X_CTRL-V insert.txt /*i_CTRL-X_CTRL-V* i_CTRL-X_CTRL-Y insert.txt /*i_CTRL-X_CTRL-Y* i_CTRL-X_CTRL-] insert.txt /*i_CTRL-X_CTRL-]* +i_CTRL-X_index index.txt /*i_CTRL-X_index* i_CTRL-Y insert.txt /*i_CTRL-Y* i_CTRL-Z options.txt /*i_CTRL-Z* i_CTRL-[ insert.txt /*i_CTRL-[* @@ -5049,6 +5061,7 @@ i_^_CTRL-D insert.txt /*i_^_CTRL-D* i_backspacing insert.txt /*i_backspacing* i_digraph digraph.txt /*i_digraph* i_esc intro.txt /*i_esc* +i` motion.txt /*i`* ia64-syntax syntax.txt /*ia64-syntax* ia64.vim syntax.txt /*ia64.vim* ib motion.txt /*ib* @@ -5122,6 +5135,7 @@ internet intro.txt /*internet* intro intro.txt /*intro* intro.txt intro.txt /*intro.txt* ip motion.txt /*ip* +iquote motion.txt /*iquote* is motion.txt /*is* isdirectory() eval.txt /*isdirectory()* iw motion.txt /*iw* @@ -5139,6 +5153,7 @@ jumplist motion.txt /*jumplist* jumpto-diffs diff.txt /*jumpto-diffs* k motion.txt /*k* kcc uganda.txt /*kcc* +kde gui_x11.txt /*kde* kde-toolbar gui_x11.txt /*kde-toolbar* key-codes intro.txt /*key-codes* key-codes-changed version4.txt /*key-codes-changed* @@ -5437,6 +5452,7 @@ new-highlighting version5.txt /*new-high new-indent-flex version6.txt /*new-indent-flex* new-items-6 version6.txt /*new-items-6* new-items-7 version7.txt /*new-items-7* +new-kde version7.txt /*new-kde* new-line-continuation version5.txt /*new-line-continuation* new-multi-byte version5.txt /*new-multi-byte* new-multi-lang version6.txt /*new-multi-lang* @@ -6334,6 +6350,7 @@ v_V visual.txt /*v_V* v_X change.txt /*v_X* v_Y change.txt /*v_Y* v_a motion.txt /*v_a* +v_a' motion.txt /*v_a'* v_a( motion.txt /*v_a(* v_a) motion.txt /*v_a)* v_a< motion.txt /*v_a<* @@ -6342,8 +6359,10 @@ v_aB motion.txt /*v_aB* v_aW motion.txt /*v_aW* v_a[ motion.txt /*v_a[* v_a] motion.txt /*v_a]* +v_a` motion.txt /*v_a`* v_ab motion.txt /*v_ab* v_ap motion.txt /*v_ap* +v_aquote motion.txt /*v_aquote* v_as motion.txt /*v_as* v_aw motion.txt /*v_aw* v_a{ motion.txt /*v_a{* @@ -6374,6 +6393,7 @@ v_gq change.txt /*v_gq* v_gv visual.txt /*v_gv* v_gw change.txt /*v_gw* v_i motion.txt /*v_i* +v_i' motion.txt /*v_i'* v_i( motion.txt /*v_i(* v_i) motion.txt /*v_i)* v_i< motion.txt /*v_i<* @@ -6382,8 +6402,10 @@ v_iB motion.txt /*v_iB* v_iW motion.txt /*v_iW* v_i[ motion.txt /*v_i[* v_i] motion.txt /*v_i]* +v_i` motion.txt /*v_i`* v_ib motion.txt /*v_ib* v_ip motion.txt /*v_ip* +v_iquote motion.txt /*v_iquote* v_is motion.txt /*v_is* v_iw motion.txt /*v_iw* v_i{ motion.txt /*v_i{* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2004 Jun 30 +*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -32,23 +32,6 @@ be worked on, but only if you sponsor Vi For version 7.0: - Include many PATCHES: - - Include the kvim patch. http://freenux.org/vim/ (Mickael Marchand) - Do not add Qtopia yet, it doesn't work very well. - update from Mickael 2004 Jun 20. - 8 Unix: When libcall() fails there is no clear error message. Johannes - Zellner has a patch for this. - updated patch 2004 June 16. - 7 Add the MzScheme interface. Patch on http://iamphet.nm.ru/scheme/ - (Sergey Khorev) - Alt URL: http://cyber.miem.edu.ru/~iamphet/scheme/mzvim-0.560.tar.gz - 8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac? - New patch 2004 Jun 16 - 8 Add expression-expansion, so that the user can define his own kind of - completion. Patch from Taro Muraoka, 2003 Aug 26. - New patch 2004 Jun 16 - 8 Text objects: Add "a'" and 'a"': a single or double quoted string. - (Tim Chase) Patch from Taro Muraoka (2003 Dec 16). - New patch 2004 Jun 16 7 Add "nbsp" in 'listchars'? Patch from David Blanchet, 2003 Jul 28. again 2004 Jun 16 8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible. @@ -173,7 +156,6 @@ For version 7.0: Matsumoto) How to get the messages into the .po files? Update 2004 Jun 17 - --- realname() Get user name (first, last, full) user_fullname() patch by Nikolai Weibull, Nov 3 2002) @@ -189,6 +171,7 @@ For version 7.0: search() Add optional offset argument. Add 'n' flag. (patch from Nikolai Weibull 2003 Jan 13) + --- confirm() add "flags" argument, with 'v' for vertical layout and 'c' for console dialog. (Haegg) Flemming Madsen has a patch for the 'c' flag @@ -236,6 +219,8 @@ For version 7.0: incomplete patch Mar 18) +- In the kvim/KDE source files fix the formatting. +- KDE version is called "kvim". Make it "gvim", like the others? - Change ga_room into ga_maxlen, so that it doesn't need to be incremented/decremented each time. - For string variables, use length instead of NUL termination. @@ -302,7 +287,12 @@ 8 Support four composing characters, n file. Can be used to update statusline oslt. - Displaying size of Visual area: use 24-33 column display. - Mac: Unicode input and display (Eckehard Berns, June 27) - +8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac? + New patch 2004 Jun 16 +7 Add the MzScheme interface? + NO: it changes too much of the code, while hardly anybody will use it. + Patch on http://iamphet.nm.ru/scheme/ (Sergey Khorev) + Alt URL: http://cyber.miem.edu.ru/~iamphet/scheme/mzvim-0.560.tar.gz Vi incompatibility: 8 With undo/redo only marks in the changed lines should be changed. Other @@ -393,6 +383,10 @@ 9 Can't paste a Visual selection from It starts working after GTK gvim loses the selection and gains it again. 7 DND doesn't work with KDE (also with GTK 1). +KDE GUI known bugs: +- The default font is ugly. bold text isn't displayed correctly. +- Error messages when starting up. The "tip of the day" box is empty. +- Encoding of menu items needs to be converted. (Yasuhiro Matsumoto) Win32 GUI known bugs: 8 On Windows 98 the unicows library is needed to support functions with UCS2 diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2004 Jun 30 +*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -76,9 +76,16 @@ Various new items *new-items-7* Normal mode commands: ~ +a", a' and a` New text objects to select quoted strings. |a'| +i", i' and i' (Taro Muraoka) Options: ~ +'completefunc' The name of a function used for user-specified Insert + mode completion. CTRL-X CTRL-U can be used in Insert + mode to do any kind of completion. (Taro Muraoka) +'quoteescape' Characters used to escape quotes inside a string. + Used for the a", a' and a` text objects. |a'| Ex commands: ~ @@ -94,8 +101,13 @@ InsertEnter starting Insert or Replace InsertChange going from Insert to Replace mode or back InsertLeave leaving Insert or Replace mode +ColorScheme after loading a color scheme -New Syntax files: ~ + +New Syntax/Indent/FTplugin files: ~ + +MuPAD source syntax, indent and ftplugin. (Dave Silvia) + Others: ~ @@ -118,6 +130,9 @@ breakpoint at the cursor. The tutor was updated to make it simpler to use and added text to explain a few more important commands. Used ideas from Gabriel Zachmann. +Unix: When libcall() fails obtain an error message with dlerror() and display +it. (Johannes Zellner) + ============================================================================== COMPILE TIME CHANGES *compile-changes-7* diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2004 Jun 27 +" Last Change: 2004 Jul 01 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -865,6 +865,9 @@ au BufNewFile,BufRead *.mysql setf mys " M$ Resource files au BufNewFile,BufRead *.rc setf rc +" MuPAD source +au BufRead,BufNewFile *.mu setf mupad + " Mush au BufNewFile,BufRead *.mush setf mush diff --git a/runtime/ftplugin/AppendMatchGroup.vim b/runtime/ftplugin/AppendMatchGroup.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/AppendMatchGroup.vim @@ -0,0 +1,125 @@ +" Vim filetype plugin file utility +" Language: * (various) +" Maintainer: Dave Silvia +" Date: 6/30/2004 + +" The start of match (b:SOM) default is: +" '\<' +" The end of match (b:EOM) default is: +" '\>' +" +" If you want to use some other start/end of match, just assign the +" value to the b:SOM|EOM variable in your filetype script. +" +" SEE: :h pattern.txt +" :h pattern-searches +" :h regular-expression +" :h matchit + +let s:myName=expand(":t") + +" matchit.vim not loaded -- don't do anyting +if !exists("loaded_matchit") + echomsg s:myName.": matchit.vim not loaded -- finishing without loading" + finish +endif + +" already been here -- don't redefine +if exists("*AppendMatchGroup") + finish +endif + +" Function To Build b:match_words +" The following function, 'AppendMatchGroup', helps to increase +" readability of your filetype script if you choose to use matchit. +" It also precludes many construction errors, reducing the +" construction to simply invoking the function with the match words. +" As an example, let's take the ubiquitous if/then/else/endif type +" of construct. This is how the entry in your filetype script would look. +" +" " source the AppendMatchGroup function file +" runtime ftplugin/AppendMatchGroup.vim +" +" " fill b:match_words +" call AppendMatchGroup('if,then,else,endif') +" +" And the b:match_words constructed would look like: +" +" \:\:\:\ +" +" Use of AppendMatchGroup makes your filetype script is a little +" less busy and a lot more readable. Additionally, it +" checks three critical things: +" +" 1) Do you have at least 2 entries in your match group. +" +" 2) Does the buffer variable 'b:match_words' exist? if not, create it. +" +" 3) If the buffer variable 'b:match_words' does exist, is the last +" character a ','? If not, add it before appending. +" +" You should now be able to match 'if/then/else/endif' in succession +" in your source file, in just about any construction you may have +" chosen for them. +" +" To add another group, simply call 'AppendMatchGroup again. E.G.: +" +" call AppendMatchGroup('while,do,endwhile') + +function AppendMatchGroup(mwordList) + let List=a:mwordList + let Comma=match(List,',') + if Comma == -1 || Comma == strlen(List)-1 + echoerr "Must supply a comma separated list of at least 2 entries." + echoerr "Supplied list: <".List.">" + return + endif + let listEntryBegin=0 + let listEntryEnd=Comma + let listEntry=strpart(List,listEntryBegin,listEntryEnd-listEntryBegin) + let List=strpart(List,Comma+1) + let Comma=match(List,',') + " if listEntry is all spaces || List is empty || List is all spaces + if (match(listEntry,'\s\+') == 0 && match(listEntry,'\S\+') == -1) + \ || List == '' || (match(List,'\s\+') == 0 && match(List,'\S\+') == -1) + echoerr "Can't use all spaces for an entry <".listEntry.">" + echoerr "Remaining supplied list: <".List.">" + return + endif + + if !exists("b:SOM") + let b:SOM='\<' + endif + if !exists("b:EOM") + let b:EOM='\>' + endif + if !exists("b:match_words") + let b:match_words='' + endif + if b:match_words != '' && match(b:match_words,',$') == -1 + let b:match_words=b:match_words.',' + endif + " okay, all set add first entry in this list + let b:match_words=b:match_words.b:SOM.listEntry.b:EOM.':' + while Comma != -1 + let listEntryEnd=Comma + let listEntry=strpart(List,listEntryBegin,listEntryEnd-listEntryBegin) + let List=strpart(List,Comma+1) + let Comma=match(List,',') + " if listEntry is all spaces + if match(listEntry,'\s\+') == 0 && match(listEntry,'\S\+') == -1 + echoerr "Can't use all spaces for an entry <".listEntry."> - skipping" + echoerr "Remaining supplied list: <".List.">" + continue + endif + let b:match_words=b:match_words.b:SOM.listEntry.b:EOM.':' + endwhile + let listEntry=List + let b:match_words=b:match_words.b:SOM.listEntry.b:EOM +endfunction + +" TODO: Write a wrapper to handle multiple groups in one function call. +" Don't see a lot of utility in this as it would undoubtedly warrant +" continuation lines in the filetype script and it would be a toss +" up as to which is more readable: individual calls one to a line or +" a single call with continuation lines. I vote for the former. diff --git a/runtime/ftplugin/mupad.vim b/runtime/ftplugin/mupad.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/mupad.vim @@ -0,0 +1,30 @@ +" Vim filetype plugin file +" Language: MuPAD source files +" Maintainer: Dave Silvia +" Filenames: *.mu +" Date: 6/30/2004 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Change the :browse e filter to primarily show MuPAD source files. +if has("gui_win32") + let b:browsefilter= + \ "MuPAD source (*.mu)\t*.mu\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" matchit.vim not loaded -- don't do anyting below +if !exists("loaded_matchit") + " echomsg "matchit.vim not loaded -- finishing" + finish +endif + +" source the AppendMatchGroup function file +runtime ftplugin/AppendMatchGroup.vim + +" fill b:match_words for MuPAD +call AppendMatchGroup('domain,end_domain') +call AppendMatchGroup('proc,begin,end_proc') +call AppendMatchGroup('if,then,elif,else,end_if') +call AppendMatchGroup('\%(for\|while\|repeat\|case\),of,do,break,next,until,\%(end_for\|end_while\|end_repeat\|end_case\)') diff --git a/runtime/indent/GenericIndent.vim b/runtime/indent/GenericIndent.vim new file mode 100644 --- /dev/null +++ b/runtime/indent/GenericIndent.vim @@ -0,0 +1,322 @@ +" Vim indent file generic utility functions +" Language: * (various) +" Maintainer: Dave Silvia +" Date: 6/30/2004 + +" SUMMARY: To use GenericIndent, indent/.vim would have the +" following general format: +" +" if exists("b:did_indent") | finish | endif +" let b:did_indent = 1 +" runtime indent/GenericIndent.vim +" let b:indentStmts='' +" let b:dedentStmts='' +" let b:allStmts='' +" setlocal indentexpr=GenericIndent() +" setlocal indentkeys= +" call GenericIndentStmts() +" call GenericDedentStmts() +" call GenericAllStmts() +" +" END SUMMARY: + +" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized +" to '' before callin the functions because 'indent.vim' explicitly +" 'unlet's b:did_indent. This means that the lists will compound if +" you change back and forth between buffers. This is true as of +" version 6.3, 6/23/2004. +" +" NOTE: By default, GenericIndent is case sensitive. +" let b:case_insensitive=1 if you want to ignore case, e.g. DOS batch files + +" The function 'GenericIndent' is data driven and handles most all cases of +" indent checking if you first set up the data. To use this function follow +" the example below (taken from the file indent/MuPAD_source.vim) +" +" Before you start, source this file in indent/.vim to have it +" define functions for your use. +" +"runtime indent/GenericIndent.vim +" +" The data is in 5 sets: +" +" First, set the data set 'indentexpr' to GenericIndent(). +" +"setlocal indentexpr=GenericIndent() +" +" Second, set the data set 'indentkeys' to the keywords/expressions that need +" to be checked for 'indenting' _as_ they typed. +" +"setlocal indentkeys==end_proc,=else,=then,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O +" +" NOTE: 'o,O' at the end of the previous line says you wish to be called +" whenever a newline is placed in the buffer. This allows the previous line +" to be checked for indentation parameters. +" +" Third, set the data set 'b:indentStmts' to the keywords/expressions that, when +" they are on a line _when_ you _press_ the __ key, +" you wish to have the next line indented. +" +"call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') +" +" Fourth, set the data set 'b:dedentStmts' to the keywords/expressions that, when +" they are on a line you are currently typing, you wish to have that line +" 'dedented' (having already been indented because of the previous line's +" indentation). +" +"call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') +" +" Fifth, set the data set 'b:allStmts' to the concatenation of the third and +" fourth data sets, used for checking when more than one keyword/expression +" is on a line. +" +"call GenericAllStmts() +" +" NOTE: GenericIndentStmts uses two variables: 'b:indentStmtOpen' and +" 'b:indentStmtClose' which default to '\<' and '\>' respectively. You can +" set (let) these to any value you wish before calling GenericIndentStmts with +" your list. Similarly, GenericDedentStmts uses 'b:dedentStmtOpen' and +" 'b:dedentStmtClose'. +" +" NOTE: Patterns may be used in the lists passed to Generic[In|De]dentStmts +" since each element in the list is copied verbatim. +" +" Optionally, you can set the DEBUGGING flag within your script to have the +" debugging messages output. See below for description. This can also be set +" (let) from the command line within your editing buffer. +" +"let b:DEBUGGING=1 +" +" See: +" :h runtime +" :set runtimepath ? +" to familiarize yourself with how this works and where you should have this +" file and your file(s) installed. +" +" For help with setting 'indentkeys' see: +" :h indentkeys +" Also, for some good examples see 'indent/sh.vim' and 'indent/vim.vim' as +" well as files for other languages you may be familiar with. +" +" +" Alternatively, if you'd rather specify yourself, you can enter +" 'b:indentStmts', 'b:dedentStmts', and 'b:allStmts' 'literally': +" +"let b:indentStmts='\\|\\|\\|\\|\\|\\|\\|\\|\\|\' +"let b:dedentStmts='\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\' +"let b:allStmts=b:indentStmts.'\|'.b:dedentStmts +" +" This is only useful if you have particularly different parameters for +" matching each statement. + +" RECAP: From indent/MuPAD_source.vim +" +"if exists("b:did_indent") | finish | endif +" +"let b:did_indent = 1 +" +"runtime indent/GenericIndent.vim +" +"setlocal indentexpr=GenericIndent() +"setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O +"call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') +"call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') +"call GenericAllStmts() +" +" END RECAP: + +let s:hit=0 +let s:lastVlnum=0 +let s:myScriptName=expand(":t") + +if exists("*GenericIndent") + finish +endif + +function GenericAllStmts() + let b:allStmts=b:indentStmts.'\|'.b:dedentStmts + call DebugGenericIndent(expand("").": "."b:indentStmts: ".b:indentStmts.", b:dedentStmts: ".b:dedentStmts.", b:allStmts: ".b:allStmts) +endfunction + +function GenericIndentStmts(stmts) + let Stmts=a:stmts + let Comma=match(Stmts,',') + if Comma == -1 || Comma == strlen(Stmts)-1 + echoerr "Must supply a comma separated list of at least 2 entries." + echoerr "Supplied list: <".Stmts.">" + return + endif + + if !exists("b:indentStmtOpen") + let b:indentStmtOpen='\<' + endif + if !exists("b:indentStmtClose") + let b:indentStmtClose='\>' + endif + if !exists("b:indentStmts") + let b:indentStmts='' + endif + if b:indentStmts != '' + let b:indentStmts=b:indentStmts.'\|' + endif + call DebugGenericIndent(expand("").": "."b:indentStmtOpen: ".b:indentStmtOpen.", b:indentStmtClose: ".b:indentStmtClose.", b:indentStmts: ".b:indentStmts.", Stmts: ".Stmts) + let stmtEntryBegin=0 + let stmtEntryEnd=Comma + let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) + let Stmts=strpart(Stmts,Comma+1) + let Comma=match(Stmts,',') + let b:indentStmts=b:indentStmts.b:indentStmtOpen.stmtEntry.b:indentStmtClose + while Comma != -1 + let stmtEntryEnd=Comma + let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) + let Stmts=strpart(Stmts,Comma+1) + let Comma=match(Stmts,',') + let b:indentStmts=b:indentStmts.'\|'.b:indentStmtOpen.stmtEntry.b:indentStmtClose + endwhile + let stmtEntry=Stmts + let b:indentStmts=b:indentStmts.'\|'.b:indentStmtOpen.stmtEntry.b:indentStmtClose +endfunction + +function GenericDedentStmts(stmts) + let Stmts=a:stmts + let Comma=match(Stmts,',') + if Comma == -1 || Comma == strlen(Stmts)-1 + echoerr "Must supply a comma separated list of at least 2 entries." + echoerr "Supplied list: <".Stmts.">" + return + endif + + if !exists("b:dedentStmtOpen") + let b:dedentStmtOpen='\<' + endif + if !exists("b:dedentStmtClose") + let b:dedentStmtClose='\>' + endif + if !exists("b:dedentStmts") + let b:dedentStmts='' + endif + if b:dedentStmts != '' + let b:dedentStmts=b:dedentStmts.'\|' + endif + call DebugGenericIndent(expand("").": "."b:dedentStmtOpen: ".b:dedentStmtOpen.", b:dedentStmtClose: ".b:dedentStmtClose.", b:dedentStmts: ".b:dedentStmts.", Stmts: ".Stmts) + let stmtEntryBegin=0 + let stmtEntryEnd=Comma + let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) + let Stmts=strpart(Stmts,Comma+1) + let Comma=match(Stmts,',') + let b:dedentStmts=b:dedentStmts.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose + while Comma != -1 + let stmtEntryEnd=Comma + let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) + let Stmts=strpart(Stmts,Comma+1) + let Comma=match(Stmts,',') + let b:dedentStmts=b:dedentStmts.'\|'.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose + endwhile + let stmtEntry=Stmts + let b:dedentStmts=b:dedentStmts.'\|'.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose +endfunction + +" Debugging function. Displays messages in the command area which can be +" reviewed using ':messages'. To turn it on use ':let b:DEBUGGING=1'. Once +" on, turn off by using ':let b:DEBUGGING=0. If you don't want it at all and +" feel it's slowing down your editing (you must have an _awfully_ slow +" machine!;-> ), you can just comment out the calls to it from 'GenericIndent' +" below. No need to remove the function or the calls, tho', as you never can +" tell when they might come in handy!;-) +function DebugGenericIndent(msg) + if exists("b:DEBUGGING") && b:DEBUGGING + echomsg '['.s:hit.']'.s:myScriptName."::".a:msg + endif +endfunction + +function GenericIndent() + " save ignore case option. Have to set noignorecase for the match + " functions to do their job the way we want them to! + " NOTE: if you add a return to this function be sure you do + " if IgnoreCase | set ignorecase | endif + " before returning. You can just cut and paste from here. + let IgnoreCase=&ignorecase + " let b:case_insensitive=1 if you want to ignore case, e.g. DOS batch files + if !exists("b:case_insensitive") + set noignorecase + endif + " this is used to let DebugGenericIndent display which invocation of the + " function goes with which messages. + let s:hit=s:hit+1 + let lnum=v:lnum + let cline=getline(lnum) + let lnum=prevnonblank(lnum) + if lnum==0 | if IgnoreCase | set ignorecase | endif | return 0 | endif + let pline=getline(lnum) + let ndnt=indent(lnum) + if !exists("b:allStmts") + call GenericAllStmts() + endif + + call DebugGenericIndent(expand("").": "."cline=<".cline.">, pline=<".pline.">, lnum=".lnum.", v:lnum=".v:lnum.", ndnt=".ndnt) + if lnum==v:lnum + " current line, only check dedent + " + " just dedented this line, don't need to do it again. + " another dedentStmts was added or an end%[_*] was completed. + if s:lastVlnum==v:lnum + if IgnoreCase | set ignorecase | endif + return ndnt + endif + let s:lastVlnum=v:lnum + call DebugGenericIndent(expand("").": "."Checking dedent") + let srcStr=cline + let dedentKeyBegin=match(srcStr,b:dedentStmts) + if dedentKeyBegin != -1 + let dedentKeyEnd=matchend(srcStr,b:dedentStmts) + let dedentKeyStr=strpart(srcStr,dedentKeyBegin,dedentKeyEnd-dedentKeyBegin) + "only dedent if it's the beginning of the line + if match(srcStr,'^\s*\<'.dedentKeyStr.'\>') != -1 + call DebugGenericIndent(expand("").": "."It's the beginning of the line, dedent") + let ndnt=ndnt-&shiftwidth + endif + endif + call DebugGenericIndent(expand("").": "."dedent - returning ndnt=".ndnt) + else + " previous line, only check indent + call DebugGenericIndent(expand("").": "."Checking indent") + let srcStr=pline + let indentKeyBegin=match(srcStr,b:indentStmts) + if indentKeyBegin != -1 + " only indent if it's the last indentStmts in the line + let allKeyBegin=match(srcStr,b:allStmts) + let allKeyEnd=matchend(srcStr,b:allStmts) + let allKeyStr=strpart(srcStr,allKeyBegin,allKeyEnd-allKeyBegin) + let srcStr=strpart(srcStr,allKeyEnd) + let allKeyBegin=match(srcStr,b:allStmts) + if allKeyBegin != -1 + " not the end of the line, check what is and only indent if + " it's an indentStmts + call DebugGenericIndent(expand("").": "."Multiple words in line, checking if last is indent") + while allKeyBegin != -1 + let allKeyEnd=matchend(srcStr,b:allStmts) + let allKeyStr=strpart(srcStr,allKeyBegin,allKeyEnd-allKeyBegin) + let srcStr=strpart(srcStr,allKeyEnd) + let allKeyBegin=match(srcStr,b:allStmts) + endwhile + if match(b:indentStmts,allKeyStr) != -1 + call DebugGenericIndent(expand("").": "."Last word in line is indent") + let ndnt=ndnt+&shiftwidth + endif + else + " it's the last indentStmts in the line, go ahead and indent + let ndnt=ndnt+&shiftwidth + endif + endif + call DebugGenericIndent(expand("").": "."indent - returning ndnt=".ndnt) + endif + if IgnoreCase | set ignorecase | endif + return ndnt +endfunction + + +" TODO: I'm open! +" +" BUGS: You tell me! Probably. I just haven't found one yet or haven't been +" told about one. +" diff --git a/runtime/indent/mupad.vim b/runtime/indent/mupad.vim new file mode 100644 --- /dev/null +++ b/runtime/indent/mupad.vim @@ -0,0 +1,35 @@ +" Vim indent file +" Language: MuPAD source files +" Maintainer: Dave Silvia +" Filenames: *.mu +" Date: 6/30/2004 + +if exists("b:did_indent") + finish +endif + +let b:did_indent = 1 + +runtime indent/GenericIndent.vim + +let b:indentStmts='' +let b:dedentStmts='' +let b:allStmts='' +" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized +" to '' before callin the functions because 'indent.vim' explicitly +" 'unlet's b:did_indent. This means that the lists will compound if +" you change back and forth between buffers. This is true as of +" version 6.3, 6/23/2004. +setlocal indentexpr=GenericIndent() +setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O + +call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') +call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') +call GenericAllStmts() + + +" TODO: More comprehensive indentstmt, dedentstmt, and indentkeys values. +" +" BUGS: You tell me! Probably. I just haven't found one yet or haven't been +" told about one. +" diff --git a/runtime/optwin.vim b/runtime/optwin.vim --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2004 May 04 +" Last Change: 2004 Jul 02 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -656,6 +656,9 @@ if has("insert_expand") call append("$", "complete\tspecifies how Insert mode completion works") call append("$", "\t(local to buffer)") call OptionL("cpt") + call append("$", "completefunc\tuser defined function for Insert mode completion") + call append("$", "\t(local to buffer)") + call OptionL("cfu") call append("$", "dictionary\tlist of dictionary files for keyword completion") call append("$", "\t(global or local to buffer)") call OptionG("dict", &dict) @@ -1006,6 +1009,11 @@ call append("$", "\t(local to buffer)") call OptionL("isk") call append("$", "isprint\tspecifies printable characters") call OptionG("isp", &isp) +if has("textobjects") + call append("$", "quoteescape\tspecifies escape characters in a string") + call append("$", "\t(local to buffer)") + call OptionL("qe") +endif if has("rightleft") call append("$", "rightleft\tdisplay the buffer right-to-left") call append("$", "\t(local to window)") diff --git a/runtime/plugin/NetrwFileHandlers.vim b/runtime/plugin/NetrwFileHandlers.vim --- a/runtime/plugin/NetrwFileHandlers.vim +++ b/runtime/plugin/NetrwFileHandlers.vim @@ -1,11 +1,12 @@ " NetrwFileHandlers: contains various extension-based file handlers for " netrw's browser " Author: Charles E. Campbell, Jr. -" Date: Jun 25, 2004 -" Version: 1 +" Date: Jul 02, 2004 +" Version: 2 " --------------------------------------------------------------------- -" NetrwFileHandler_html: handles html +" NetrwFileHandler_html: handles html when the user hits "x" when the +" cursor is atop a *.html file fun! NetrwFileHandler_html(webpage) " call Dfunc("NetrwFileHandler_html(".a:webpage.")") @@ -17,8 +18,14 @@ fun! NetrwFileHandler_html(webpage) else let page= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/','http://\1/','e') endif + + if executable("mozilla") " call Decho("executing !mozilla ".page) - exe "!mozilla ".page + exe "!mozilla ".page + elseif executable("netscape") +" call Decho("executing !netscape ".page) + exe "!netscape ".page + endif " call Dret("NetrwFileHandler_html") endfun diff --git a/runtime/plugin/netrw.vim b/runtime/plugin/netrw.vim --- a/runtime/plugin/netrw.vim +++ b/runtime/plugin/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across a network -" Last Change: Jun 24, 2004 +" Last Change: Jun 30, 2004 " Maintainer: Charles E. Campbell, Jr. PhD -" Version: 47f NOT RELEASED +" Version: 47g ASTRO-ONLY " License: Vim License (see vim's :help license) " " But be doers of the word, and not only hearers, deluding your own selves @@ -12,7 +12,7 @@ if exists("loaded_netrw") || &cp finish endif -let loaded_netrw = "v47f NOT RELEASED" +let loaded_netrw = "v47g ASTRO-ONLY" let s:save_cpo = &cpo set cpo&vim @@ -36,7 +36,7 @@ if !exists("g:netrw_list_cmd") " provide a default listing command let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" else - call Decho("ssh is not executable, can't do remote directory exploring") +" call Decho("ssh is not executable, can't do remote directory exploring") let g:netrw_list_cmd= "" endif endif @@ -63,6 +63,17 @@ endif if !exists("g:netrw_list_hide") let g:netrw_list_hide= "" endif +if !exists("g:netrw_sort_by") + " alternatives: date size + let g:netrw_sort_by= "name" +endif +if !exists("g:netrw_sort_sequence") + let g:netrw_sort_sequence= '/$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$' +endif +if !exists("g:netrw_sort_direction") + " alternative: reverse (z y x ...) + let g:netrw_sort_direction= "normal" +endif " --------------------------------------------------------------------- " Default values for global protocol variables {{{1 @@ -142,7 +153,7 @@ com! -nargs=* NetUserPass call NetUserP " ------------------------------------------------------------------------ " NetSavePosn: saves position of cursor on screen {{{1 fun! s:NetSavePosn() - call Dfunc("NetSavePosn()") +" call Dfunc("NetSavePosn()") " Save current line and column let s:netrw_winnr= winnr() let s:netrw_line = line(".") @@ -153,13 +164,13 @@ fun! s:NetSavePosn() let s:netrw_hline= line(".") call s:NetRestorePosn() - call Dret("NetSavePosn : winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline) +" call Dret("NetSavePosn : winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline) endfun " ------------------------------------------------------------------------ " NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1 fun! NetRestorePosn() - call Dfunc("NetRestorePosn() winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline) +" call Dfunc("NetRestorePosn() winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline) exe "silent! ".s:netrw_winnr."wincmd w" if v:shell_error == 0 @@ -172,13 +183,13 @@ fun! NetRestorePosn() " restore position exe "norm! ".s:netrw_line."G0".s:netrw_col."\" - call Dret("NetRestorePosn") +" call Dret("NetRestorePosn") endfun " ------------------------------------------------------------------------ " NetRead: responsible for reading a file over the net {{{1 fun! s:NetRead(...) - call Dfunc("NetRead(a:1<".a:1.">)") +" call Dfunc("NetRead(a:1<".a:1.">)") " save options call s:NetOptionSave() @@ -200,18 +211,18 @@ fun! s:NetRead(...) " get name of a temporary file let tmpfile= tempname() - call Decho("ichoice=".ichoice." readcmd<".readcmd.">") +" call Decho("ichoice=".ichoice." readcmd<".readcmd.">") while ichoice <= a:0 " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 - call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") let choice = b:netrw_lastfile let ichoice= ichoice + 1 else exe "let choice= a:" . ichoice - call Decho("no lastfile: choice<" . choice . ">") +" call Decho("no lastfile: choice<" . choice . ">") " Reconstruct Choice if choice starts with '"' if match(choice,"?") == 0 @@ -229,7 +240,7 @@ fun! s:NetRead(...) echo ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' break elseif match(choice,"^\"") != -1 - call Decho("reconstructing choice") +" call Decho("reconstructing choice") if match(choice,"\"$") != -1 " case "..." let choice=strpart(choice,1,strlen(choice)-2) @@ -243,7 +254,7 @@ fun! s:NetRead(...) let ichoice = ichoice + 1 if ichoice > a:0 echoerr "Unbalanced string in filename '". wholechoice ."'" - call Dret("NetRead") +" call Dret("NetRead") return endif let choice= a:{ichoice} @@ -253,13 +264,13 @@ fun! s:NetRead(...) endif endif - call Decho("choice<" . choice . ">") +" call Decho("choice<" . choice . ">") let ichoice= ichoice + 1 " fix up windows urls if has("win32") let choice = substitute(choice,'\\','/','ge') - call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile) +" call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile) exe 'lcd ' . fnamemodify(tmpfile,':h') let tmpfile = fnamemodify(tmpfile,':t') @@ -269,11 +280,11 @@ fun! s:NetRead(...) call s:NetMethod(choice) " Check if NetBrowse() should be handling this request - call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">") +" call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">") if choice =~ "^.*/$" if strlen(g:netrw_list_cmd) > 0 keepjumps call s:NetBrowse(choice) - call Dret("NetRead") +" call Dret("NetRead") else echoerr "sorry, can't do a remote listing; ssh isn't executable" endif @@ -287,7 +298,7 @@ fun! s:NetRead(...) "......................................... " rcp: NetRead Method #1 if b:netrw_method == 1 " read with rcp - call Decho("read via rcp (method #1)") +" call Decho("read via rcp (method #1)") " ER: noting done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile " ER: if machine contains '.' adding .user is required (use $USERNAME) @@ -306,7 +317,7 @@ fun! s:NetRead(...) let uid_machine = g:netrw_machine endif endif - call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -314,17 +325,17 @@ fun! s:NetRead(...) "......................................... " ftp + <.netrc>: NetRead Method #2 elseif b:netrw_method == 2 " read with ftp + <.netrc> - call Decho("read via ftp+.netrc (method #2)") +" call Decho("read via ftp+.netrc (method #2)") let netrw_fname= b:netrw_fname new set ff=unix exe "put ='".g:netrw_ftpmode."'" exe "put ='get ".netrw_fname." ".tmpfile."'" if exists("g:netrw_port") && g:netrw_port != "" - call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port else - call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) @@ -339,7 +350,7 @@ fun! s:NetRead(...) " ftp + machine,id,passwd,filename: NetRead Method #3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter - call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)") let netrw_fname= b:netrw_fname new set ff=unix @@ -365,9 +376,9 @@ fun! s:NetRead(...) " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - call Decho('performing ftp -i -n') +" call Decho('performing ftp -i -n') norm 1Gdd - call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" @@ -380,7 +391,7 @@ fun! s:NetRead(...) "......................................... " scp: NetRead Method #4 elseif b:netrw_method == 4 " read with scp - call Decho("read via scp (method #4)") +" call Decho("read via scp (method #4)") if exists("g:netrw_port") && g:netrw_port != "" let useport= " -P ".g:netrw_port else @@ -388,10 +399,10 @@ fun! s:NetRead(...) endif if g:netrw_cygwin == 1 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile else - call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile endif let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) @@ -399,7 +410,7 @@ fun! s:NetRead(...) "......................................... elseif b:netrw_method == 5 " read with http (wget) - call Decho("read via http (method #5)") +" call Decho("read via http (method #5)") if g:netrw_http_cmd == "" echoerr "neither wget nor fetch command is available" exit @@ -407,7 +418,7 @@ fun! s:NetRead(...) if match(b:netrw_fname,"#") == -1 " simple wget - call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&') let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) @@ -415,12 +426,12 @@ fun! s:NetRead(...) " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) let netrw_html= substitute(b:netrw_fname,"#.*$","","") let netrw_tag = substitute(b:netrw_fname,"^.*#","","") - call Decho("netrw_html<".netrw_html.">") - call Decho("netrw_tag <".netrw_tag.">") - call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) +" call Decho("netrw_html<".netrw_html.">") +" call Decho("netrw_tag <".netrw_tag.">") +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" endif let b:netrw_lastfile = choice @@ -428,7 +439,7 @@ fun! s:NetRead(...) "......................................... " cadaver: NetRead Method #6 elseif b:netrw_method == 6 " read with cadaver - call Decho("read via cadaver (method #6)") +" call Decho("read via cadaver (method #6)") " Construct execution string (four lines) which will be passed through filter let netrw_fname= b:netrw_fname @@ -450,22 +461,22 @@ fun! s:NetRead(...) " perform cadaver operation: norm 1Gdd - call Decho("executing: %!".g:netrw_dav_cmd) +" call Decho("executing: %!".g:netrw_dav_cmd) exe g:netrw_silentxfer."%!".g:netrw_dav_cmd bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " rsync: NetRead Method #7 elseif b:netrw_method == 7 " read with rsync - call Decho("read via rsync (method #7)") +" call Decho("read via rsync (method #7)") if g:netrw_cygwin == 1 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) +" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile else - call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) +" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile endif let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) @@ -484,13 +495,13 @@ fun! s:NetRead(...) else let netrw_option= "ftp" endif - call Decho("read via fetch for ".netrw_option) +" call Decho("read via fetch for ".netrw_option) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != "" - call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&') else - call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&') endif @@ -500,14 +511,14 @@ fun! s:NetRead(...) "......................................... " sftp: NetRead Method #9 elseif b:netrw_method == 9 " read with sftp - call Decho("read via sftp (method #4)") +" call Decho("read via sftp (method #4)") if g:netrw_cygwin == 1 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) - call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) +" call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) +" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile else - call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) +" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile endif let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) @@ -520,7 +531,7 @@ fun! s:NetRead(...) endwhile " cleanup - call Decho("cleanup") +" call Decho("cleanup") if exists("b:netrw_method") unlet b:netrw_method unlet g:netrw_machine @@ -528,14 +539,14 @@ fun! s:NetRead(...) endif call s:NetOptionRestore() - call Dret("NetRead") +" call Dret("NetRead") endfun " end of NetRead " ------------------------------------------------------------------------ " NetGetFile: Function to read file "fname" with command "readcmd". {{{1 fun! s:NetGetFile(readcmd, fname, method) - call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)") +" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)") if exists("*NetReadFixup") " for the use of NetReadFixup (not otherwise used internally) @@ -546,14 +557,14 @@ fun! s:NetGetFile(readcmd, fname, method if &term == "win32" if &shell == "bash" let fname=a:fname - call Decho("(win32 && bash) fname<".fname.">") +" call Decho("(win32 && bash) fname<".fname.">") else let fname=substitute(a:fname,'/','\\\\','ge') - call Decho("(win32 && !bash) fname<".fname.">") +" call Decho("(win32 && !bash) fname<".fname.">") endif else let fname= a:fname - call Decho("(copied) fname<".fname.">") +" call Decho("(copied) fname<".fname.">") endif " get the file, but disable undo when reading a new buffer @@ -612,10 +623,10 @@ fun! s:NetGetFile(readcmd, fname, method let &ul= oldul endif elseif filereadable(fname) - call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname.">") +" call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname.">") exe a:readcmd." ".v:cmdarg." ".fname else - call Dret("NetGetFile") +" call Dret("NetGetFile") return endif @@ -627,22 +638,22 @@ fun! s:NetGetFile(readcmd, fname, method else let line2= line("$") - line2 endif - call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") call NetReadFixup(a:method, line1, line2) endif - call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> fname<".a:fname."> readable=".filereadable(a:fname)) +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> fname<".a:fname."> readable=".filereadable(a:fname)) " insure that we have the right filetype and that its being displayed filetype detect redraw! - call Dret("NetGetFile") +" call Dret("NetGetFile") endfun " ------------------------------------------------------------------------ " NetWrite: responsible for writing a file over the net {{{1 fun! s:NetWrite(...) range - call Dfunc("NetWrite(a:0=".a:0.")") +" call Dfunc("NetWrite(a:0=".a:0.")") " option handling let mod= 0 @@ -664,7 +675,7 @@ fun! s:NetWrite(...) range " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 - call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") let choice = b:netrw_lastfile let ichoice= ichoice + 1 else @@ -699,7 +710,7 @@ fun! s:NetWrite(...) range let ichoice = ichoice + 1 if choice > a:0 echoerr "Unbalanced string in filename '". wholechoice ."'" - call Dret("NetWrite") +" call Dret("NetWrite") return endif let choice= a:{ichoice} @@ -708,7 +719,7 @@ fun! s:NetWrite(...) range endif endif endif - call Decho("choice<" . choice . ">") +" call Decho("choice<" . choice . ">") let ichoice= ichoice + 1 " fix up windows urls @@ -729,7 +740,7 @@ fun! s:NetWrite(...) range "......................................... " rcp: NetWrite Method #1 if b:netrw_method == 1 " write with rcp - Decho "write via rcp (method #1)" +" Decho "write via rcp (method #1)" if s:netrw_has_nt_rcp == 1 if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_machine .'.'. g:netrw_uid @@ -743,7 +754,7 @@ fun! s:NetWrite(...) range let uid_machine = g:netrw_machine endif endif - call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&') let b:netrw_lastfile = choice @@ -754,14 +765,14 @@ fun! s:NetWrite(...) range new set ff=unix exe "put ='".g:netrw_ftpmode."'" - call Decho(" NetWrite: put ='".g:netrw_ftpmode."'") +" call Decho(" NetWrite: put ='".g:netrw_ftpmode."'") exe "put ='put ".tmpfile." ".netrw_fname."'" - call Decho("put ='put ".tmpfile." ".netrw_fname."'") +" call Decho("put ='put ".tmpfile." ".netrw_fname."'") if exists("g:netrw_port") && g:netrw_port != "" - call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port else - call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) @@ -797,9 +808,9 @@ fun! s:NetWrite(...) range " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - call Decho('performing ftp -i -n') +" call Decho('performing ftp -i -n') norm 1Gdd - call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" @@ -818,10 +829,10 @@ fun! s:NetWrite(...) range endif if g:netrw_cygwin == 1 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') else - call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') endif let b:netrw_lastfile = choice @@ -834,7 +845,7 @@ fun! s:NetWrite(...) range "......................................... " dav: NetWrite Method #6 elseif b:netrw_method == 6 " write with cadaver - call Decho("write via cadaver (method #6)") +" call Decho("write via cadaver (method #6)") " Construct execution string (four lines) which will be passed through filter let netrw_fname= b:netrw_fname @@ -856,7 +867,7 @@ fun! s:NetWrite(...) range " perform cadaver operation: norm 1Gdd - call Decho("executing: %!".g:netrw_dav_cmd) +" call Decho("executing: %!".g:netrw_dav_cmd) exe g:netrw_silentxfer."%!".g:netrw_dav_cmd bd! let b:netrw_lastfile = choice @@ -866,10 +877,10 @@ fun! s:NetWrite(...) range elseif b:netrw_method == 7 " write with rsync if g:netrw_cygwin == 1 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') else - call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) +" call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') endif let b:netrw_lastfile = choice @@ -887,7 +898,7 @@ fun! s:NetWrite(...) range set ff=unix put ='put '.tmpfile.' '.netrw_fname norm 1Gdd - call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine) +" call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine) exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine bd! let b:netrw_lastfile= choice @@ -899,7 +910,7 @@ fun! s:NetWrite(...) range endwhile " cleanup - call Decho("cleanup") +" call Decho("cleanup") let result=delete(tmpfile) call s:NetOptionRestore() @@ -907,23 +918,23 @@ fun! s:NetWrite(...) range let &mod= mod " usually equivalent to set nomod endif - call Dret("NetWrite") +" call Dret("NetWrite") endfun " end of NetWrite " ------------------------------------------------------------------------ -" Remote Directory Browsing Support: {{{1 +" Browsing Support For Remote Directories And Files: {{{1 " NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2 " of the contents of a remote directory. It is assumed that the " g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted " with the requested remote hostname first. fun! NetBrowse(dirname) - call Dfunc("NetBrowse(dirname<".a:dirname.">)") +" call Dfunc("NetBrowse(dirname<".a:dirname.">)") " sanity check if !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' echoerr "***netrw*** this system doesn't support remote directory listing" - call Dret("NetBrowse 0") +" call Dret("NetBrowse 0") return 0 endif @@ -934,7 +945,7 @@ fun! NetBrowse(dirname) let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' if a:dirname !~ dirpat echoerr "NetBrowse: I don't understand your dirname<".a:dirname.">" - call Dret("NetBrowse 0 : badly formatted dirname") +" call Dret("NetBrowse 0 : badly formatted dirname") return 0 endif let method = substitute(a:dirname,dirpat,'\1','') @@ -942,31 +953,43 @@ fun! NetBrowse(dirname) let machine = substitute(a:dirname,dirpat,'\3','') let path = substitute(a:dirname,dirpat,'\4','') let fname = substitute(a:dirname,'^.*/\ze.','','') - call Decho("set up method <".method .">") - call Decho("set up user <".user .">") - call Decho("set up machine<".machine.">") - call Decho("set up path <".path .">") - call Decho("set up fname <".fname .">") +" call Decho("set up method <".method .">") +" call Decho("set up user <".user .">") +" call Decho("set up machine<".machine.">") +" call Decho("set up path <".path .">") +" call Decho("set up fname <".fname .">") + + let listcmd = substitute(g:netrw_list_cmd,'\',user.machine,'') - let listcmd = substitute(g:netrw_list_cmd,'\',user.machine,'') - call Decho("set up listcmd<".listcmd.">") + " optionally sort by time (-t) or by size (-S) + if g:netrw_sort_by =~ "^t" + let listcmd= listcmd."t" + elseif g:netrw_sort_by =~ "^s" + let listcmd= listcmd."S" + endif + " optionally sort in reverse + if g:netrw_sort_direction =~ "^r" + let listcmd= listcmd."r" + endif + +" call Decho("set up listcmd<".listcmd.">") if fname =~ '@$' && fname !~ '^"' - call Decho("attempt transfer of symlink as file") +" call Decho("attempt transfer of symlink as file") call s:NetBrowse(substitute(a:dirname,'@$','','e')) redraw! - call Dret("NetBrowse 0 : symlink") +" call Dret("NetBrowse 0 : symlink") return 0 elseif fname !~ '/$' && fname !~ '^"' " looks like a regular file, attempt transfer - call Decho("attempt transfer as regular file<".a:dirname.">") +" call Decho("attempt transfer as regular file<".a:dirname.">") " remove any filetype indicator from end of dirname, except for the " "this is a directory" indicator (/). There shouldn't be one of those, " anyway. let path= substitute(path,'[*=@|]$','','e') - call Decho("new path<".path.">") +" call Decho("new path<".path.">") " remote-read the requested file into current buffer enew! @@ -977,22 +1000,22 @@ fun! NetBrowse(dirname) 1d set nomod - call Dret("NetBrowse 0 : file<".fname.">") +" call Dret("NetBrowse 0 : file<".fname.">") return 0 endif " --------------------------------------------------------------------- " Perform Directory Listing: - call Decho("Perform directory listing...") +" call Decho("Perform directory listing...") " set up new buffer and map let bufname = method.'://'.user.machine.'/'.path let bufnamenr = bufnr(bufname) - call Decho("bufname<".bufname."> bufnamenr=".bufnamenr) +" call Decho("bufname<".bufname."> bufnamenr=".bufnamenr) if bufnamenr != -1 " buffer already exists, switch to it! exe "b ".bufnamenr if line("$") >= 5 - call Dret("NetBrowse 1") +" call Dret("NetBrowse 1") return 1 endif else @@ -1001,13 +1024,17 @@ fun! NetBrowse(dirname) setlocal bt=nofile bh=wipe nobl exe 'file '.bufname set bt=nowrite bh=hide nobl - nnoremap :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) + nnoremap :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) nnoremap :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) nnoremap - :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'../')) nnoremap a :let g:netrw_list_showall=1exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) + nnoremap h :call NetHideEdit() nnoremap o :exe g:netrw_winsize."wincmd s"exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) + nnoremap s :let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) nnoremap v :exe g:netrw_winsize."wincmd v"exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) nnoremap x :exe "norm! 0"call NetBrowseX(NetBrowseChgDir(expand("%"),expand(""))) + nnoremap <2-leftmouse> :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),expand(""))) exe 'nnoremap :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' exe 'vnoremap :call NetBrowseRm("'.user.machine.'","'.path.'")' exe 'nnoremap D :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' @@ -1016,18 +1043,32 @@ fun! NetBrowse(dirname) nnoremap ? :he netrw-dir setlocal ma - call Decho("executing: r! ".listcmd." '".path."'") + " Set up the banner +" call Decho("executing: r! ".listcmd." '".path."'") keepjumps put ='\" ==============================' keepjumps put ='\" Netrw Remote Directory Listing' keepjumps put ='\" '.bufname - let g:netrw_bannercnt= 5 + let g:netrw_bannercnt= 6 + if g:netrw_sort_by =~ "^n" + " sorted by name + let g:netrw_bannercnt= g:netrw_bannercnt + 1 + keepjumps put ='\" Sorted by '.g:netrw_sort_by + keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence + else + " sorted by size or date + keepjumps put ='\" Sorted by '.g:netrw_sort_by + endif if g:netrw_list_hide != "" && !exists("g:netrw_list_showall") keepjumps put ='\" Hiding: '.g:netrw_list_hide let g:netrw_bannercnt= g:netrw_bannercnt + 1 endif keepjumps put ='\" ==============================' + + " remote read the requested directory exe "silent r! ".listcmd." '".path."'" keepjumps 1d + + " manipulate the directory listing (hide, sort) set ft=netrwlist if line("$") >= g:netrw_bannercnt if !exists("g:netrw_list_showall") @@ -1037,10 +1078,11 @@ fun! NetBrowse(dirname) else unlet g:netrw_list_showall endif - exe 'keepjumps silent '.g:netrw_bannercnt.',$s/^\(.*\)\([/@]\)$/ \2\1/e' - exe 'keepjumps silent '.g:netrw_bannercnt.',$call s:NetSort()' - exe 'keepjumps silent '.g:netrw_bannercnt.',$s/^ \(.\)\(.*\)$/\2\1/e' - exe 'keepjumps '.g:netrw_bannercnt + if g:netrw_sort_by =~ "^n" + call s:SetSort() + exe 'keepjumps silent '.g:netrw_bannercnt.',$call s:NetSort()' + exe 'keepjumps silent '.g:netrw_bannercnt.',$s/^\d\{3}\///e' + endif endif let prvbuf= bufnr(bufname) if prvbuf != -1 @@ -1049,14 +1091,14 @@ fun! NetBrowse(dirname) setlocal noma nomod - call Dret("NetBrowse 1") +" call Dret("NetBrowse 1") return 1 endfun " --------------------------------------------------------------------- " NetBrowseChgDir: {{{2 fun! NetBrowseChgDir(dirname,newdir) - call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)") +" call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)") let dirname= a:dirname let newdir = a:newdir @@ -1064,11 +1106,11 @@ fun! NetBrowseChgDir(dirname,newdir if newdir !~ '/$' " handling a file let dirname= dirname.newdir - call Decho("handling a file: dirname<".dirname.">") +" call Decho("handling a file: dirname<".dirname.">") elseif newdir == './' " refresh the directory list - call Decho("refresh directory listing") +" call Decho("refresh directory listing") set ma %d @@ -1084,23 +1126,23 @@ fun! NetBrowseChgDir(dirname,newdir " strip off a directory name from dirname let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','') endif - call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">") +" call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">") else " go down one directory let dirname= dirname.newdir - call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") endif - call Dret("NetBrowseChgDir <".dirname.">") +" call Dret("NetBrowseChgDir <".dirname.">") return dirname endfun " --------------------------------------------------------------------- " NetBrowseRm: remove a remote file or directory {{{2 fun! NetBrowseRm(usrhost,path) range - call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)") - call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)") +" call Decho("firstline=".a:firstline." lastline=".a:lastline) " preparation for removing multiple files/directories let ctr= a:firstline @@ -1111,37 +1153,37 @@ fun! NetBrowseRm(usrhost,path) rang norm! 0 let rmfile= a:path.expand("") - call Decho("rmfile<".rmfile.">") +" call Decho("rmfile<".rmfile.">") if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '/$') " attempt to remove file let netrw_rm_cmd= substitute(g:netrw_rm_cmd,'HOSTNAME',a:usrhost,'').' '.rmfile - call Decho("attempt to remove file: system(".netrw_rm_cmd.")") +" call Decho("attempt to remove file: system(".netrw_rm_cmd.")") call inputsave() let ok= input("Confirm deletion of file<".rmfile."> ","y") call inputrestore() if ok == "y" let ret= system(netrw_rm_cmd) - call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error) endif else " attempt to remove directory let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '.rmfile - call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") call inputsave() let ok= input("Confirm deletion of directory<".rmfile."> ","y") call inputrestore() if ok == "y" let ret= system(netrw_rmdir_cmd) - call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 let netrw_rmf_cmd= substitute(g:netrw_rmf_cmd,'HOSTNAME',a:usrhost,'').' '.substitute(rmfile,'/$','','e') - call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") let ret= system(netrw_rmf_cmd) - call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 echoerr "unable to remove directory<".rmfile."> -- is it empty?" @@ -1155,17 +1197,17 @@ fun! NetBrowseRm(usrhost,path) rang " refresh the directory let curline= line(".")-1 - call Decho("refresh the directory") +" call Decho("refresh the directory") call NetBrowse(NetBrowseChgDir(expand("%"),'./')) exe curline - call Dret("NetBrowseRm") +" call Dret("NetBrowseRm") endfun " --------------------------------------------------------------------- " NetBrowseRename: rename a remote file or directory {{{2 fun! NetBrowseRename(usrhost,path) - call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)") +" call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)") " preparation for removing multiple files/directories let ctr = a:firstline @@ -1177,14 +1219,14 @@ fun! NetBrowseRename(usrhost,path) norm! 0 let oldname= a:path.expand("") - call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">") call inputsave() let newname= input("Moving ".a:usrhost."'s ".oldname." to : ",oldname) call inputrestore() let ret= system(rename_cmd." ".oldname." ".newname) - call Decho("executing system(".rename_cmd." ".oldname." ".newname) +" call Decho("executing system(".rename_cmd." ".oldname." ".newname) let ctr= ctr + 1 endwhile @@ -1193,28 +1235,28 @@ fun! NetBrowseRename(usrhost,path) let curline= line(".") call NetBrowse(NetBrowseChgDir(expand("%"),'./')) exe curline - call Dret("NetBrowseRename") +" call Dret("NetBrowseRename") endfun " --------------------------------------------------------------------- " NetBrowseX: allows users to write custom functions to operate on {{{2 " files given their extension fun! NetBrowseX(fname) - call Dfunc("NetBrowseX(".a:fname.")") +" call Dfunc("NetBrowseX(".a:fname.")") let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') - call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten)) +" call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten)) if exten != "" && exists("*NetrwFileHandler_".exten) exe "call NetrwFileHandler_".exten.'("'.a:fname.'")' endif - call Dret("NetBrowseX") +" call Dret("NetBrowseX") endfun " --------------------------------------------------------------------- " NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 " separated patterns given in g:netrw_list_hide fun! NetrwListHide() - call Dfunc("NetrwListHide() listhide<".g:netrw_list_hide.">") +" call Dfunc("NetrwListHide() listhide<".g:netrw_list_hide.">") let listhide= g:netrw_list_hide while listhide != "" @@ -1225,11 +1267,27 @@ fun! NetrwListHide() let hide = listhide let listhide= "" endif - call Decho("pruning <".hide."> listhide<".listhide.">") +" call Decho("pruning <".hide."> listhide<".listhide.">") exe 'keepjumps silent '.g:netrw_bannercnt.',$g~'.hide.'~d' endwhile - call Dret("NetrwListHide") +" call Dret("NetrwListHide") +endfun + +" --------------------------------------------------------------------- +" NetHideEdit: allows user to edit the file/directory hiding list +fun! NetHideEdit() +" call Dfunc("NetHideEdit()") + + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + + " refresh the listing + let g:netrw_list_hide= newhide + silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) + +" call Dret("NetHideEdit") endfun " ------------------------------------------------------------------------ @@ -1244,7 +1302,7 @@ endfun " 8: fetch " 9: sftp fun! s:NetMethod(choice) " globals: method machine id passwd fname - call Dfunc("NetMethod(a:choice<".a:choice.">)") +" call Dfunc("NetMethod(a:choice<".a:choice.">)") " initialization let b:netrw_method = 0 @@ -1253,14 +1311,14 @@ fun! s:NetMethod(choice) " globals: met let g:netrw_port = "" " Patterns: - " mipf : a:machine a:id password filename Use ftp - " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd + " mipf : a:machine a:id password filename Use ftp + " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd - " rcpurm : rcp://[user@]host/filename Use rcp - " rcphf : [user@]host:filename Use rcp + " rcpurm : rcp://[user@]host/filename Use rcp + " rcphf : [user@]host:filename Use rcp " scpurm : scp://[user@]host[[#:]port]/filename Use scp - " httpurm : http://[user@]host/filename Use wget - " davurm : dav://host[:port]/path Use cadaver + " httpurm : http://[user@]host/filename Use wget + " davurm : [s]dav://host[:port]/path Use cadaver " rsyncurm : rsync://host[:port]/path Use rsync " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) " sftpurm : sftp://[user@]host/filename Use scp @@ -1271,16 +1329,16 @@ fun! s:NetMethod(choice) " globals: met let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$' let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' - let davurm = '^dav://\([^/]\{-}\)/\(.*\)\=$' + let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' - call Decho("determine method:") +" call Decho("determine method:") " Determine Method " rcp://user@hostname/...path-to-file if match(a:choice,rcpurm) == 0 - call Decho("rcp://...") +" call Decho("rcp://...") let b:netrw_method = 1 let userid = substitute(a:choice,rcpurm,'\2',"") let g:netrw_machine= substitute(a:choice,rcpurm,'\3',"") @@ -1291,7 +1349,7 @@ fun! s:NetMethod(choice) " globals: met " scp://user@hostname/...path-to-file elseif match(a:choice,scpurm) == 0 - call Decho("scp://...") +" call Decho("scp://...") let b:netrw_method = 4 let g:netrw_machine= substitute(a:choice,scpurm,'\1',"") let b:netrw_port = substitute(a:choice,scpurm,'\2',"") @@ -1299,28 +1357,32 @@ fun! s:NetMethod(choice) " globals: met " http://user@hostname/...path-to-file elseif match(a:choice,httpurm) == 0 - call Decho("http://...") +" call Decho("http://...") let b:netrw_method = 5 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") " dav://hostname[:port]/..path-to-file.. elseif match(a:choice,davurm) == 0 - call Decho("dav://...") +" call Decho("dav://...") let b:netrw_method= 6 - let g:netrw_machine= substitute(a:choice,davurm,'\1',"") - let b:netrw_fname = substitute(a:choice,davurm,'\2',"") + if a:choice =~ '^s' + let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") + else + let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") + endif + let b:netrw_fname = substitute(a:choice,davurm,'\3',"") " rsync://user@hostname/...path-to-file elseif match(a:choice,rsyncurm) == 0 - call Decho("rsync://...") +" call Decho("rsync://...") let b:netrw_method = 7 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") " ftp://[user@]hostname[[:#]port]/...path-to-file elseif match(a:choice,ftpurm) == 0 - call Decho("ftp://...") +" call Decho("ftp://...") let userid = substitute(a:choice,ftpurm,'\2',"") let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") @@ -1348,7 +1410,7 @@ fun! s:NetMethod(choice) " globals: met endif elseif match(a:choice,fetchurm) == 0 - call Decho("fetch://...") +" call Decho("fetch://...") let b:netrw_method = 8 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") @@ -1357,7 +1419,7 @@ fun! s:NetMethod(choice) " globals: met " Issue an ftp : "machine id password [path/]filename" elseif match(a:choice,mipf) == 0 - call Decho("(ftp) host id pass file") +" call Decho("(ftp) host id pass file") let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mipf,'\1',"") let g:netrw_uid = substitute(a:choice,mipf,'\2',"") @@ -1366,7 +1428,7 @@ fun! s:NetMethod(choice) " globals: met " Issue an ftp: "hostname [path/]filename" elseif match(a:choice,mf) == 0 - call Decho("(ftp) host file") +" call Decho("(ftp) host file") if exists("g:netrw_uid") && exists("g:netrw_passwd") let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mf,'\1',"") @@ -1380,22 +1442,22 @@ fun! s:NetMethod(choice) " globals: met " sftp://user@hostname/...path-to-file elseif match(a:choice,sftpurm) == 0 - call Decho("sftp://...") +" call Decho("sftp://...") let b:netrw_method = 9 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") " Issue an rcp: hostname:filename" (this one should be last) elseif match(a:choice,rcphf) == 0 - call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") let b:netrw_method = 1 let userid = substitute(a:choice,rcphf,'\2',"") let g:netrw_machine= substitute(a:choice,rcphf,'\3',"") let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") - call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") - call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") - call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") - call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") if userid != "" let g:netrw_uid= userid endif @@ -1409,18 +1471,18 @@ fun! s:NetMethod(choice) " globals: met let b:netrw_method = -1 endif - call Decho("a:choice <".a:choice.">") - call Decho("b:netrw_method <".b:netrw_method.">") - call Decho("g:netrw_machine<".g:netrw_machine.">") - call Decho("g:netrw_port <".g:netrw_port.">") - if exists("g:netrw_uid") "Decho - call Decho("g:netrw_uid <".g:netrw_uid.">") - endif "Decho - if exists("g:netrw_passwd") "Decho - call Decho("g:netrw_passwd <".g:netrw_passwd.">") - endif "Decho - call Decho("b:netrw_fname <".b:netrw_fname.">") - call Dret("NetMethod") +" call Decho("a:choice <".a:choice.">") +" call Decho("b:netrw_method <".b:netrw_method.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_port <".g:netrw_port.">") +" if exists("g:netrw_uid") "Decho +" call Decho("g:netrw_uid <".g:netrw_uid.">") +" endif "Decho +" if exists("g:netrw_passwd") "Decho +" call Decho("g:netrw_passwd <".g:netrw_passwd.">") +" endif "Decho +" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Dret("NetMethod") endfun " end of NetMethod @@ -1433,32 +1495,32 @@ fun! NetUserPass(...) " get/set userid if a:0 == 0 - call Dfunc("NetUserPass(a:0<".a:0.">)") +" call Dfunc("NetUserPass(a:0<".a:0.">)") if !exists("g:netrw_uid") || g:netrw_uid == "" " via prompt let g:netrw_uid= input('Enter username: ') endif else " from command line - call Dfunc("NetUserPass(a:1<".a:1.">) {") +" call Dfunc("NetUserPass(a:1<".a:1.">) {") let g:netrw_uid= a:1 endif " get password if a:0 <= 1 " via prompt - call Decho("a:0=".a:0." case <=1:") +" call Decho("a:0=".a:0." case <=1:") let g:netrw_passwd= inputsecret("Enter Password: ") else " from command line - call Decho("a:0=".a:0." case >1: a:2<".a:2.">") +" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") let g:netrw_passwd=a:2 endif - call Dret("NetUserPass") +" call Dret("NetUserPass") endfun " end NetUserPass " ------------------------------------------------------------------------ " NetOptionSave: save options and set to "standard" form {{{1 fun!s:NetOptionSave() - call Dfunc("NetOptionSave()") +" call Dfunc("NetOptionSave()") " Get Temporary Filename let s:aikeep = &ai @@ -1477,16 +1539,16 @@ fun!s:NetOptionSave() if has("win32") && !has("win95") let s:swfkeep= &swf set noswf - call Decho("setting s:swfkeep to <".&swf.">") +" call Decho("setting s:swfkeep to <".&swf.">") endif - call Dret("NetOptionSave") +" call Dret("NetOptionSave") endfun " ------------------------------------------------------------------------ " NetOptionRestore: restore options {{{1 fun! s:NetOptionRestore() - call Dfunc("NetOptionRestore()") +" call Dfunc("NetOptionRestore()") let &ai = s:aikeep let &cin = s:cinkeep @@ -1509,7 +1571,7 @@ fun! s:NetOptionRestore() unlet s:twkeep unlet s:dirkeep - call Dret("NetOptionRestore") +" call Dret("NetOptionRestore") endfun " ------------------------------------------------------------------------ @@ -1521,17 +1583,17 @@ endfun " at the end of the transfer. if has("win95") && g:netrw_win95ftp fun! NetReadFixup(method, line1, line2) - call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") if method == 3 " ftp (no <.netrc>) let fourblanklines= line2 - 3 silent fourblanklines.",".line2."g/^\s*/d" endif - call Dret("NetReadFixup") +" call Dret("NetReadFixup") endfun endif " --------------------------------------------------------------------- -" NetSort: Piet Delport's BISort2() function, modified to take a range +" NetSort: Piet Delport's BISort2() function, modified to take a range {{{1 fun! NetSort() range let i = a:firstline + 1 while i <= a:lastline @@ -1542,11 +1604,22 @@ fun! NetSort() range while lo < hi let mid = (lo + hi) / 2 let mid_val = getline(mid) - if i_val < mid_val - let hi = mid + if g:netrw_sort_direction =~ '^n' + " normal sorting order + if i_val < mid_val + let hi = mid + else + let lo = mid + 1 + if i_val == mid_val | break | endif + endif else - let lo = mid + 1 - if i_val == mid_val | break | endif + " reverse sorting order + if i_val > mid_val + let hi = mid + else + let lo = mid + 1 + if i_val == mid_val | break | endif + endif endif endwhile " do insert @@ -1558,6 +1631,43 @@ fun! NetSort() range endwhile endfun +" --------------------------------------------------------------------- +" SetSort: sets up the sort based on the g:netrw_sort_sequence +fun! SetSort() +" call Dfunc("SetSort() bannercnt=".g:netrw_bannercnt) + let seqlist = g:netrw_sort_sequence + let priority = 1 + while seqlist != "" + if seqlist =~ ',' + let seq = substitute(seqlist,',.*$','','e') + let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e') + else + let seq = seqlist + let seqlist = "" + endif + let eseq= escape(seq,'/') + if priority < 10 + let spriority= "00".priority.'\/' + elseif priority < 100 + let spriority= "0".priority.'\/' + else + let spriority= priority.'\/' + endif +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") + + if seq == '*' + exe 'keepjumps silent '.g:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/' + else + exe 'keepjumps silent '.g:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/' + endif + let priority = priority + 1 + endwhile + + exe 'keepjumps silent '.g:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e' + +" call Dret("SetSort") +endfun + " ------------------------------------------------------------------------ " Restore {{{1 let &cpo= s:save_cpo diff --git a/runtime/syntax/mupad.vim b/runtime/syntax/mupad.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/mupad.vim @@ -0,0 +1,295 @@ +" Vim syntax file +" Language: MuPAD source +" Maintainer: Dave Silvia +" Filenames: *.mu +" Date: 6/30/2004 + + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Set default highlighting to Win2k +if !exists("mupad_cmdextversion") + let mupad_cmdextversion = 2 +endif + +syn case match + +syn match mupadComment "//\p*$" +syn region mupadComment start="/\*" end="\*/" + +syn region mupadString start="\"" skip=/\\"/ end="\"" + +syn match mupadOperator "(\|)\|:=\|::\|:\|;" +" boolean +syn keyword mupadOperator and or not xor +syn match mupadOperator "==>\|\<=\>" + +" Informational +syn keyword mupadSpecial FILEPATH NOTEBOOKFILE NOTEBOOKPATH +" Set-able, e.g., DIGITS:=10 +syn keyword mupadSpecial DIGITS HISTORY LEVEL +syn keyword mupadSpecial MAXLEVEL MAXDEPTH ORDER +syn keyword mupadSpecial TEXTWIDTH +" Set-able, e.g., PRETTYPRINT:=TRUE +syn keyword mupadSpecial PRETTYPRINT +" Set-able, e.g., LIBPATH:="C:\\MuPAD Pro\\mylibdir" or LIBPATH:="/usr/MuPAD Pro/mylibdir" +syn keyword mupadSpecial LIBPATH PACKAGEPATH +syn keyword mupadSpecial READPATH TESTPATH WRITEPATH +" Symbols and Constants +syn keyword mupadDefine FAIL NIL +syn keyword mupadDefine TRUE FALSE UNKNOWN +syn keyword mupadDefine complexInfinity infinity +syn keyword mupadDefine C_ CATALAN E EULER I PI Q_ R_ +syn keyword mupadDefine RD_INF RD_NINF undefined unit universe Z_ +" print() directives +syn keyword mupadDefine Unquoted NoNL KeepOrder Typeset +" domain specifics +syn keyword mupadStatement domain begin end_domain end +syn keyword mupadIdentifier inherits category axiom info doc interface +" basic programming statements +syn keyword mupadStatement proc begin end_proc +syn keyword mupadUnderlined name local option save +syn keyword mupadConditional if then elif else end_if +syn keyword mupadConditional case of do break end_case +syn keyword mupadRepeat for do next break end_for +syn keyword mupadRepeat while do next break end_while +syn keyword mupadRepeat repeat next break until end_repeat +" domain packages/libraries +syn keyword mupadType detools import linalg numeric numlib plot polylib +syn match mupadType '\' + +"syn keyword mupadFunction contains +" Functions dealing with prime numbers +syn keyword mupadFunction phi invphi mersenne nextprime numprimedivisors +syn keyword mupadFunction pollard prevprime primedivisors +" Functions operating on Lists, Matrices, Sets, ... +syn keyword mupadFunction array _index +" Evaluation +syn keyword mupadFunction float contains +" stdlib +syn keyword mupadFunction _exprseq _invert _lazy_and _lazy_or _negate +syn keyword mupadFunction _stmtseq _invert intersect minus union +syn keyword mupadFunction Ci D Ei O Re Im RootOf Si +syn keyword mupadFunction Simplify +syn keyword mupadFunction abs airyAi airyBi alias unalias anames append +syn keyword mupadFunction arcsin arccos arctan arccsc arcsec arccot +syn keyword mupadFunction arcsinh arccosh arctanh arccsch arcsech arccoth +syn keyword mupadFunction arg args array assert assign assignElements +syn keyword mupadFunction assume assuming asympt bernoulli +syn keyword mupadFunction besselI besselJ besselK besselY beta binomial bool +syn keyword mupadFunction bytes card +syn keyword mupadFunction ceil floor round trunc +syn keyword mupadFunction coeff coerce collect combine copyClosure +syn keyword mupadFunction conjugate content context contfrac +syn keyword mupadFunction debug degree degreevec delete _delete denom +syn keyword mupadFunction densematrix diff dilog dirac discont div _div +syn keyword mupadFunction divide domtype doprint erf erfc error eval evalassign +syn keyword mupadFunction evalp exp expand export unexport expose expr +syn keyword mupadFunction expr2text external extnops extop extsubsop +syn keyword mupadFunction fact fact2 factor fclose finput fname fopen fprint +syn keyword mupadFunction fread ftextinput readbitmap readdata pathname +syn keyword mupadFunction protocol read readbytes write writebytes +syn keyword mupadFunction float frac frame _frame frandom freeze unfreeze +syn keyword mupadFunction funcenv gamma gcd gcdex genident genpoly +syn keyword mupadFunction getpid getprop ground has hastype heaviside help +syn keyword mupadFunction history hold hull hypergeom icontent id +syn keyword mupadFunction ifactor igamma igcd igcdex ilcm in _in +syn keyword mupadFunction indets indexval info input int int2text +syn keyword mupadFunction interpolate interval irreducible is +syn keyword mupadFunction isprime isqrt iszero ithprime kummerU lambertW +syn keyword mupadFunction last lasterror lcm lcoeff ldegree length +syn keyword mupadFunction level lhs rhs limit linsolve lllint +syn keyword mupadFunction lmonomial ln loadmod loadproc log lterm +syn keyword mupadFunction match map mapcoeffs maprat matrix max min +syn keyword mupadFunction mod modp mods monomials multcoeffs new +syn keyword mupadFunction newDomain _next nextprime nops +syn keyword mupadFunction norm normal nterms nthcoeff nthmonomial nthterm +syn keyword mupadFunction null numer ode op operator package +syn keyword mupadFunction pade partfrac patchlevel pdivide +syn keyword mupadFunction piecewise plot plotfunc2d plotfunc3d +syn keyword mupadFunction poly poly2list polylog powermod print +syn keyword mupadFunction product protect psi quit _quit radsimp random rationalize +syn keyword mupadFunction rec rectform register reset return revert +syn keyword mupadFunction rewrite select series setuserinfo share sign signIm +syn keyword mupadFunction simplify +syn keyword mupadFunction sin cos tan csc sec cot +syn keyword mupadFunction sinh cosh tanh csch sech coth +syn keyword mupadFunction slot solve +syn keyword mupadFunction pdesolve matlinsolve matlinsolveLU toeplitzSolve +syn keyword mupadFunction vandermondeSolve fsolve odesolve odesolve2 +syn keyword mupadFunction polyroots polysysroots odesolveGeometric +syn keyword mupadFunction realroot realroots mroots lincongruence +syn keyword mupadFunction msqrts +syn keyword mupadFunction sort split sqrt strmatch strprint +syn keyword mupadFunction subs subset subsex subsop substring sum +syn keyword mupadFunction surd sysname sysorder system table taylor tbl2text +syn keyword mupadFunction tcoeff testargs testeq testtype text2expr +syn keyword mupadFunction text2int text2list text2tbl rtime time +syn keyword mupadFunction traperror type unassume unit universe +syn keyword mupadFunction unloadmod unprotect userinfo val version +syn keyword mupadFunction warning whittakerM whittakerW zeta zip + +" graphics plot:: +syn keyword mupadFunction getDefault setDefault copy modify Arc2d Arrow2d +syn keyword mupadFunction Arrow3d Bars2d Bars3d Box Boxplot Circle2d Circle3d +syn keyword mupadFunction Cone Conformal Curve2d Curve3d Cylinder Cylindrical +syn keyword mupadFunction Density Ellipse2d Function2d Function3d Hatch +syn keyword mupadFunction Histogram2d HOrbital Implicit2d Implicit3d +syn keyword mupadFunction Inequality Iteration Line2d Line3d Lsys Matrixplot +syn keyword mupadFunction MuPADCube Ode2d Ode3d Parallelogram2d Parallelogram3d +syn keyword mupadFunction Piechart2d Piechart3d Point2d Point3d Polar +syn keyword mupadFunction Polygon2d Polygon3d Raster Rectangle Sphere +syn keyword mupadFunction Ellipsoid Spherical Sum Surface SurfaceSet +syn keyword mupadFunction SurfaceSTL Tetrahedron Hexahedron Octahedron +syn keyword mupadFunction Dodecahedron Icosahedron Text2d Text3d Tube Turtle +syn keyword mupadFunction VectorField2d XRotate ZRotate Canvas CoordinateSystem2d +syn keyword mupadFunction CoordinateSystem3d Group2d Group3d Scene2d Scene3d ClippingBox +syn keyword mupadFunction Rotate2d Rotate3d Scale2d Scale3d Transform2d +syn keyword mupadFunction Transform3d Translate2d Translate3d AmbientLight +syn keyword mupadFunction Camera DistantLight PointLight SpotLight + +" graphics Attributes +" graphics Output Attributes +syn keyword mupadIdentifier OutputFile OutputOptions +" graphics Defining Attributes +syn keyword mupadIdentifier Angle AngleRange AngleBegin AngleEnd +syn keyword mupadIdentifier Area Axis AxisX AxisY AxisZ Base Top +syn keyword mupadIdentifier BaseX TopX BaseY TopY BaseZ TopZ +syn keyword mupadIdentifier BaseRadius TopRadius Cells +syn keyword mupadIdentifier Center CenterX CenterY CenterZ +syn keyword mupadIdentifier Closed ColorData CommandList Contours CoordinateType +syn keyword mupadIdentifier Data DensityData DensityFunction From To +syn keyword mupadIdentifier FromX ToX FromY ToY FromZ ToZ +syn keyword mupadIdentifier Function FunctionX FunctionY FunctionZ +syn keyword mupadIdentifier Function1 Function2 Baseline +syn keyword mupadIdentifier Generations RotationAngle IterationRules StartRule StepLength +syn keyword mupadIdentifier TurtleRules Ground Heights Moves Inequalities +syn keyword mupadIdentifier InputFile Iterations StartingPoint +syn keyword mupadIdentifier LineColorFunction FillColorFunction +syn keyword mupadIdentifier Matrix2d Matrix3d +syn keyword mupadIdentifier MeshList MeshListType MeshListNormals +syn keyword mupadIdentifier MagneticQuantumNumber MomentumQuantumNumber PrincipalQuantumNumber +syn keyword mupadIdentifier Name Normal NormalX NormalY NormalZ +syn keyword mupadIdentifier ParameterName ParameterBegin ParameterEnd ParameterRange +syn keyword mupadIdentifier Points2d Points3d Radius RadiusFunction +syn keyword mupadIdentifier Position PositionX PositionY PositionZ +syn keyword mupadIdentifier Scale ScaleX ScaleY ScaleZ Shift ShiftX ShiftY ShiftZ +syn keyword mupadIdentifier SemiAxes SemiAxisX SemiAxisY SemiAxisZ +syn keyword mupadIdentifier Tangent1 Tangent1X Tangent1Y Tangent1Z +syn keyword mupadIdentifier Tangent2 Tangent2X Tangent2Y Tangent2Z +syn keyword mupadIdentifier Text TextOrientation TextRotation +syn keyword mupadIdentifier UName URange UMin UMax VName VRange VMin VMax +syn keyword mupadIdentifier XName XRange XMin XMax YName YRange YMin YMax +syn keyword mupadIdentifier ZName ZRange ZMin ZMax ViewingBox +syn keyword mupadIdentifier ViewingBoxXMin ViewingBoxXMax ViewingBoxXRange +syn keyword mupadIdentifier ViewingBoxYMin ViewingBoxYMax ViewingBoxYRange +syn keyword mupadIdentifier ViewingBoxZMin ViewingBoxZMax ViewingBoxZRange +syn keyword mupadIdentifier Visible +" graphics Axis Attributes +syn keyword mupadIdentifier Axes AxesInFront AxesLineColor AxesLineWidth +syn keyword mupadIdentifier AxesOrigin AxesOriginX AxesOriginY AxesOriginZ +syn keyword mupadIdentifier AxesTips AxesTitleAlignment +syn keyword mupadIdentifier AxesTitleAlignmentX AxesTitleAlignmentY AxesTitleAlignmentZ +syn keyword mupadIdentifier AxesTitles XAxisTitle YAxisTitle ZAxisTitle +syn keyword mupadIdentifier AxesVisible XAxisVisible YAxisVisible ZAxisVisible +syn keyword mupadIdentifier YAxisTitleOrientation +" graphics Tick Marks Attributes +syn keyword mupadIdentifier TicksAnchor XTicksAnchor YTicksAnchor ZTicksAnchor +syn keyword mupadIdentifier TicksAt XTicksAt YTicksAt ZTicksAt +syn keyword mupadIdentifier TicksBetween XTicksBetween YTicksBetween ZTicksBetween +syn keyword mupadIdentifier TicksDistance XTicksDistance YTicksDistance ZTicksDistance +syn keyword mupadIdentifier TicksNumber XTicksNumber YTicksNumber ZTicksNumber +syn keyword mupadIdentifier TicksVisible XTicksVisible YTicksVisible ZTicksVisible +syn keyword mupadIdentifier TicksLength TicksLabelStyle +syn keyword mupadIdentifier XTicksLabelStyle YTicksLabelStyle ZTicksLabelStyle +syn keyword mupadIdentifier TicksLabelsVisible +syn keyword mupadIdentifier XTicksLabelsVisible YTicksLabelsVisible ZTicksLabelsVisible +" graphics Grid Lines Attributes +syn keyword mupadIdentifier GridInFront GridLineColor SubgridLineColor +syn keyword mupadIdentifier GridLineStyle SubgridLineStyle GridLineWidth SubgridLineWidth +syn keyword mupadIdentifier GridVisible XGridVisible YGridVisible ZGridVisible +syn keyword mupadIdentifier SubgridVisible XSubgridVisible YSubgridVisible ZSubgridVisible +" graphics Animation Attributes +syn keyword mupadIdentifier Frames TimeRange TimeBegin TimeEnd +syn keyword mupadIdentifier VisibleAfter VisibleBefore VisibleFromTo +syn keyword mupadIdentifier VisibleAfterEnd VisibleBeforeBegin +" graphics Annotation Attributes +syn keyword mupadIdentifier Footer Header FooterAlignment HeaderAlignment +syn keyword mupadIdentifier HorizontalAlignment TitleAlignment VerticalAlignment +syn keyword mupadIdentifier Legend LegendEntry LegendText +syn keyword mupadIdentifier LegendAlignment LegendPlacement LegendVisible +syn keyword mupadIdentifier Title Titles +syn keyword mupadIdentifier TitlePosition TitlePositionX TitlePositionY TitlePositionZ +" graphics Layout Attributes +syn keyword mupadIdentifier Bottom Left Height Width Layout Rows Columns +syn keyword mupadIdentifier Margin BottomMargin TopMargin LeftMargin RightMargin +syn keyword mupadIdentifier OutputUnits Spacing +" graphics Calculation Attributes +syn keyword mupadIdentifier AdaptiveMesh DiscontinuitySearch Mesh SubMesh +syn keyword mupadIdentifier UMesh USubMesh VMesh VSubMesh +syn keyword mupadIdentifier XMesh XSubMesh YMesh YSubMesh Zmesh +" graphics Camera and Lights Attributes +syn keyword mupadIdentifier CameraCoordinates CameraDirection +syn keyword mupadIdentifier CameraDirectionX CameraDirectionY CameraDirectionZ +syn keyword mupadIdentifier FocalPoint FocalPointX FocalPointY FocalPointZ +syn keyword mupadIdentifier LightColor Lighting LightIntensity OrthogonalProjection +syn keyword mupadIdentifier SpotAngle ViewingAngle +syn keyword mupadIdentifier Target TargetX TargetY TargetZ +" graphics Presentation Style and Fonts Attributes +syn keyword mupadIdentifier ArrowLength +syn keyword mupadIdentifier AxesTitleFont FooterFont HeaderFont LegendFont +syn keyword mupadIdentifier TextFont TicksLabelFont TitleFont +syn keyword mupadIdentifier BackgroundColor BackgroundColor2 BackgroundStyle +syn keyword mupadIdentifier BackgroundTransparent Billboarding BorderColor BorderWidth +syn keyword mupadIdentifier BoxCenters BoxWidths DrawMode Gap XGap YGap +syn keyword mupadIdentifier Notched NotchWidth Scaling YXRatio ZXRatio +syn keyword mupadIdentifier VerticalAsymptotesVisible VerticalAsymptotesStyle +syn keyword mupadIdentifier VerticalAsymptotesColor VerticalAsymptotesWidth +" graphics Line Style Attributes +syn keyword mupadIdentifier LineColor LineColor2 LineColorType LineStyle +syn keyword mupadIdentifier LinesVisible ULinesVisible VLinesVisible XLinesVisible +syn keyword mupadIdentifier YLinesVisible LineWidth MeshVisible +" graphics Point Style Attributes +syn keyword mupadIdentifier PointColor PointSize PointStyle PointsVisible +" graphics Surface Style Attributes +syn keyword mupadIdentifier BarStyle Shadows Color Colors FillColor FillColor2 +syn keyword mupadIdentifier FillColorTrue FillColorFalse FillColorUnknown FillColorType +syn keyword mupadIdentifier Filled FillPattern FillPatterns FillStyle +syn keyword mupadIdentifier InterpolationStyle Shading UseNormals +" graphics Arrow Style Attributes +syn keyword mupadIdentifier TipAngle TipLength TipStyle TubeDiameter +syn keyword mupadIdentifier Tubular +" graphics meta-documentation Attributes +syn keyword mupadIdentifier objectGroupsListed + +if version >= 508 || !exists("did_mupad_syntax_inits") + if version < 508 + let did_mupad_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink mupadComment Comment + HiLink mupadString String + HiLink mupadOperator Operator + HiLink mupadSpecial Special + HiLink mupadStatement Statement + HiLink mupadUnderlined Underlined + HiLink mupadConditional Conditional + HiLink mupadRepeat Repeat + HiLink mupadFunction Function + HiLink mupadType Type + HiLink mupadDefine Define + HiLink mupadIdentifier Identifier + + delcommand HiLink +endif + +" TODO More comprehensive listing. diff --git a/runtime/syntax/netrwlist.vim b/runtime/syntax/netrwlist.vim --- a/runtime/syntax/netrwlist.vim +++ b/runtime/syntax/netrwlist.vim @@ -11,24 +11,31 @@ elseif exists("b:current_syntax") endif " Directory List Syntax Highlighting: {{{1 -syn match netrwDir "^.*/$" contains=netrwClassify -syn match netrwClassify "[*=|@/]$" +syn match netrwDir "^.*/$" contains=netrwClassify +syn match netrwClassify "[*=|@/]$" syn match netrwSlash contained "/" -syn match netrwSymLink "^.*@$" contains=netrwClassify -syn match netrwComment '".*$' contains=netrwHide -syn match netrwHide '^"\s*Hiding:' skipwhite nextgroup=netrwHidePat -syn match netrwHidePat contained "[^,]\+" skipwhite nextgroup=netrwHideSep -syn match netrwHideSep contained transparent "," skipwhite nextgroup=netrwHidePat +syn match netrwSymLink "^.*@$" contains=netrwClassify +syn match netrwComment '".*$' contains=netrwHide,netrwSortBy,netrwSortSeq +syn match netrwHide '^"\s*Hiding:' skipwhite nextgroup=netrwHidePat +syn match netrwHidePat contained "[^,]\+" skipwhite nextgroup=netrwHideSep +syn match netrwHideSep contained transparent "," skipwhite nextgroup=netrwHidePat +syn match netrwSortBy contained transparent "Sorted by" skipwhite nextgroup=netrwList +syn match netrwSortSeq contained transparent "Sort sequence:" skipwhite nextgroup=netrwList +syn match netrwList contained ".*$" contains=netrwComma +syn match netrwComma contained "," " Highlighting Links: {{{1 if !exists("did_drchip_dbg_syntax") let did_drchip_netrwlist_syntax= 1 hi link netrwClassify Function hi link netrwComment Comment - hi link netrwHide netrwComment + hi link netrwDir Directory hi link netrwHidePat String - hi link netrwDir Directory + hi link netrwList String hi link netrwSymLink Special + + hi link netrwComma netrwComment + hi link netrwHide netrwComment endif " Current Syntax: {{{1 diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: Jun 01, 2004 -" Version: 24 +" Last Change: Jun 15, 2004 +" Version: 25 " URL: http://www.erols.com/astronaut/vim/index.html#vimlinks_syntax " " Notes: {{{1 @@ -91,6 +91,7 @@ if !exists("g:tex_no_error") endif syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption +syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter if !exists("tex_no_math") syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ syn cluster texMatchGroup add=@texMathZones @@ -348,13 +349,13 @@ else endif " Tex Reference Zones: {{{1 -syn region texZone start="@samp{" end="}\|%stopzone\>" -syn region texRefZone matchgroup=texStatement start="\\nocite{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter -syn region texRefZone matchgroup=texStatement start="\\bibliography{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter -syn region texRefZone matchgroup=texStatement start="\\cite\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter -syn region texRefZone matchgroup=texStatement start="\\label{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter -syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter -syn region texRefZone matchgroup=texStatement start="\\v\=ref{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\cite\([tp]\*\=\)\={" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup +syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup " Handle newcommand, newenvironment : {{{1 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Vim 6.3 script " Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: May 25, 2004 -" Version: 6.3-04 +" Last Change: Jul 01, 2004 +" Version: 6.3-05 " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -57,53 +57,60 @@ syn case match syn keyword vimFuncName contained append argc argidx argv browse bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line char2nr cindent col confirm cscope_connection cursor delete did_filetype escape eventhandler executable exists expand filereadable filewritable fnamemodify foldclosed foldclosedend foldlevel foldtext foreground function getbufvar getchar getcharmod getcmdline getcmdpos getcwd getfsize getftime getline getreg getregtype getwinposx getwinposy getwinvar glob globpath has hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent input inputdialog inputrestore inputsave inputsecret isdirectory libcall libcallnr line line2byte lispindent localtime maparg mapcheck match matchend matchstr mode nextnonblank nr2char prevnonblank remote_expr remote_foreground remote_peek remote_read remote_send rename resolve search searchpair server2client serverlist setbufvar setcmdpos setline setreg setwinvar simplify strftime stridx strlen strpart strridx strtrans submatch substitute synID synIDattr synIDtrans system tempname tolower toupper type virtcol visualmode winbufnr wincol winheight winline winnr winrestcmd winwidth "--- syntax above generated by mkvimvim --- +" Special Vim Highlighting (not automatic) {{{1 -" Special Vim Highlighting {{{1 - -" Numbers {{{1 +" Numbers {{{2 " ======= syn match vimNumber "\<\d\+\([lL]\|\.\d\+\)\=" syn match vimNumber "-\d\+\([lL]\|\.\d\+\)\=" syn match vimNumber "\<0[xX]\x\+" syn match vimNumber "#\x\{6}" -" All vimCommands are contained by vimIsCommands. {{{1 +" All vimCommands are contained by vimIsCommands. {{{2 syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd syn match vimIsCommand "\<\a\+\>" contains=vimCommand syn match vimVar "\<[bwglsav]:\K\k*\>" syn match vimVar contained "\<\K\k*\>" -" Insertions And Appends: insert append {{{1 +" Insertions And Appends: insert append {{{2 " ======================= syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$"" syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$"" syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$"" -" Behave! {{{1 +" Behave! {{{2 " ======= syn match vimBehave "\" skipwhite nextgroup=vimBehaveModel,vimBehaveError syn keyword vimBehaveModel contained mswin xterm -syn match vimBehaveError contained "[^ ]\+" +if !exists("g:vimsyntax_noerror") + syn match vimBehaveError contained "[^ ]\+" +endif -" Filetypes {{{1 +" Filetypes {{{2 " ========= syn match vimFiletype "\\s\+[eE][nN][dD]\>" +if !exists("g:vimsyntax_noerror") + syn match vimAugroupError "\\s\+[eE][nN][dD]\>" +endif syn keyword vimAugroupKey contained aug[roup] -" Functions : Tag is provided for those who wish to highlight tagged functions {{{1 +" Functions : Tag is provided for those who wish to highlight tagged functions {{{2 " ========= syn cluster vimFuncList contains=vimFuncKey,Tag,vimFuncSID syn cluster vimFuncBodyList contains=vimIsCommand,vimFunction,vimFunctionError,vimFuncBody,vimLineComment,vimSpecFile,vimOper,vimNumber,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue -syn match vimFunctionError "\\|[Ss]:\|\u\)\i*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody syn region vimFuncBody contained start=")" end="\=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile -syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile -syn region vimOperParen matchgroup=vimOper start="(" end=")" contains=@vimOperGroup -syn match vimOperError ")" +syn cluster vimOperGroup contains=vimOper,vimOperParen,vimNumber,vimString,vimOperOk +syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile +syn region vimOperParen oneline matchgroup=vimOper start="(" end=")" contains=@vimOperGroup +syn match vimOperOk "\<[aiAIrR][()]" +if !exists("g:vimsyntax_noerror") + syn match vimOperError ")" +endif -" Special Filenames, Modifiers, Extension Removal: {{{1 +" Special Filenames, Modifiers, Extension Removal: {{{2 " =============================================== syn match vimSpecFile "" nextgroup=vimSpecFileMod,vimSubst syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst @@ -131,7 +141,7 @@ syn match vimSpecFile "\s%<"ms=s+1,me=e- syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst syn match vimSpecFileMod "\(:[phtre]\)\+" contained -" User-Specified Commands: {{{1 +" User-Specified Commands: {{{2 " ======================= syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vimCtrlChar,vimEscapeBrace,vimFilter,vimFunc,vimFunction,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine syn keyword vimUserCommand contained com[mand] @@ -143,30 +153,34 @@ syn match vimUserAttrb contained "-cou syn match vimUserAttrb contained "-bang\=\>" contains=vimOper,vimUserAttrbKey syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey syn match vimUserAttrb contained "-re\%[gister]\>" contains=vimOper,vimUserAttrbKey -syn match vimUserCmdError contained "\S\+\>" +if !exists("g:vimsyntax_noerror") + syn match vimUserCmdError contained "\S\+\>" +endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] syn keyword vimUserAttrbCmplt contained augroup buffer command dir environment event expression file function help highlight mapping menu option tag tag_listfiles var syn case match syn match vimUserAttrbCmplt contained "custom,\u\w*" -" Errors: {{{1 +" Errors: {{{2 " ====== -syn match vimElseIfErr "\" +if !exists("g:vimsyntax_noerror") + syn match vimElseIfErr "\" +endif -" Lower Priority Comments: after some vim commands... {{{1 +" Lower Priority Comments: after some vim commands... {{{2 " ======================= syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString syn match vimComment +\!\\]'+lc=1 end=+'+ contains=@vimStringGroup syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup -syn region vimString oneline start="[^\\]+\s*[^a-zA-Z0-9. \t]"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ -" Substitutions: {{{1 +" Substitutions: {{{2 " ============= syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation @@ -205,10 +218,10 @@ syn match vimSubstTwoBS contained "\ syn match vimSubstFlagErr contained "[^< \t\r]\+" contains=vimSubstFlags syn match vimSubstFlags contained "[&cegiIpr]\+" -" 'String': {{{1 +" 'String': {{{2 syn match vimString "[^(,]'[^']\{-}'"lc=1 contains=@vimStringGroup -" Marks, Registers, Addresses, Filters: {{{1 +" Marks, Registers, Addresses, Filters: {{{2 syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst syn match vimMark ",\zs'[<>]\ze" nextgroup=vimOper,vimMarkNumber,vimSubst @@ -220,6 +233,7 @@ syn match vimPlainMark contained "'[a-z syn match vimRegister '[^(,;.]"[a-zA-Z0-9.%#:_\-/][^a-zA-Z_"]'lc=1,me=e-1 syn match vimRegister '\\)\=<\([scam]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cr\|lf\|linefeed\|return\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|space\|k\=\(page\)\=\(\|down\|up\)\)>" contains=vimBracket @@ -294,18 +308,21 @@ syn match vimNotation "\(\\\|\)\=<\( syn match vimBracket contained "[\\<>]" syn case match -" User Function Highlighting (following Gautam Iyer's suggestion) +" User Function Highlighting (following Gautam Iyer's suggestion) {{{2 " ========================== -syn match vimFunc "\%([sS]:\|<[sS][iI][dD]>\)\=\I\i*\ze\s*(" contains=vimUserFunc,vimFuncName -syn match vimUserFunc "\%([sS]:\|<[sS][iI][dD]>\)\i\+\|\<\u\i*\>\|\" contained contains=vimNotation,vimCommand +syn match vimFunc "\%([sS]:\|<[sS][iI][dD]>\)\=\I\i*\ze\s*(" contains=vimUserFunc,vimFuncName,vimCommand,vimNotFunc +syn match vimUserFunc contained "\%([sS]:\|<[sS][iI][dD]>\)\i\+\|\<\u\i*\>\|\" contains=vimNotation,vimCommand +syn match vimNotFunc contained "\<[aiAIrR](" -" Syntax {{{1 +" Syntax {{{2 "======= syn match vimGroupList contained "@\=[^ \t,]*" contains=vimGroupSpecial,vimPatSep syn match vimGroupList contained "@\=[^ \t,]*," nextgroup=vimGroupList contains=vimGroupSpecial,vimPatSep syn keyword vimGroupSpecial contained ALL ALLBUT -syn match vimSynError contained "\i\+" -syn match vimSynError contained "\i\+=" nextgroup=vimGroupList +if !exists("g:vimsyntax_noerror") + syn match vimSynError contained "\i\+" + syn match vimSynError contained "\i\+=" nextgroup=vimGroupList +endif syn match vimSynContains contained "\" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment syn match vimAuSyntax contained "\s+sy\%[ntax]" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment -" Syntax: case {{{1 +" Syntax: case {{{2 syn keyword vimSynType contained case skipwhite nextgroup=vimSynCase,vimSynCaseError -syn match vimSynCaseError contained "\i\+" +if !exists("g:vimsyntax_noerror") + syn match vimSynCaseError contained "\i\+" +endif syn keyword vimSynCase contained ignore match -" Syntax: clear {{{1 +" Syntax: clear {{{2 syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList -" Syntax: cluster {{{1 +" Syntax: cluster {{{2 syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName syn region vimClusterName contained matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError syn match vimGroupAdd contained "add=" nextgroup=vimGroupList syn match vimGroupRem contained "remove=" nextgroup=vimGroupList -" Syntax: include {{{1 +" Syntax: include {{{2 syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList -" Syntax: keyword {{{1 +" Syntax: keyword {{{2 syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup syn match vimSynKeyOpt contained "\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" -" Syntax: match {{{1 +" Syntax: match {{{2 syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\k\+" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup @@ -346,10 +365,10 @@ if has("conceal") syn match vimSynMtchCchar contained "." endif -" Syntax: off and on {{{1 +" Syntax: off and on {{{2 syn keyword vimSynType contained enable list manual off on reset -" Syntax: region {{{1 +" Syntax: region {{{2 syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation syn cluster vimSynRegGroup contains=vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion @@ -366,10 +385,12 @@ syn region vimSynPatRange contained sta syn match vimSynNotPatRange contained "\\\\\|\\\[" syn match vimMtchComment contained '"[^"]\+$' -" Syntax: sync {{{1 +" Syntax: sync {{{2 " ============ syn keyword vimSynType contained sync skipwhite nextgroup=vimSyncC,vimSyncLines,vimSyncMatch,vimSyncError,vimSyncLinecont,vimSyncRegion -syn match vimSyncError contained "\i\+" +if !exists("g:vimsyntax_noerror") + syn match vimSyncError contained "\i\+" +endif syn keyword vimSyncC contained ccomment clear fromstart syn keyword vimSyncMatch contained match skipwhite nextgroup=vimSyncGroupName syn keyword vimSyncRegion contained region skipwhite nextgroup=vimSynReg @@ -380,11 +401,11 @@ syn match vimSyncKey contained "\\s*\a\+" transparent contains=vimCommand,vimNotation -" Highlighting {{{1 +" Highlighting {{{2 " ============ syn cluster vimHighlightCluster contains=vimHiLink,vimHiClear,vimHiKeyList,vimComment syn match vimHighlight "\" skipwhite nextgroup=vimHiBang,@vimHighlightCluster @@ -404,12 +425,16 @@ syn case match syn match vimHiFontname contained "[a-zA-Z\-*]\+" syn match vimHiGuiFontname contained "'[a-zA-Z\-* ]\+'" syn match vimHiGuiRgb contained "#\x\{6}" -syn match vimHiCtermError contained "[^0-9]\i*" +if !exists("g:vimsyntax_noerror") + syn match vimHiCtermError contained "[^0-9]\i*" +endif -" Highlighting: hi group key=arg ... {{{1 +" Highlighting: hi group key=arg ... {{{2 syn cluster vimHiCluster contains=vimHiGroup,vimHiTerm,vimHiCTerm,vimHiStartStop,vimHiCtermFgBg,vimHiGui,vimHiGuiFont,vimHiGuiFgBg,vimHiKeyError,vimNotation syn region vimHiKeyList contained oneline start="\i\+" skip="\\\\\|\\|" end="$\||" contains=@vimHiCluster -syn match vimHiKeyError contained "\i\+="he=e-1 +if !exists("g:vimsyntax_noerror") + syn match vimHiKeyError contained "\i\+="he=e-1 +endif syn match vimHiTerm contained "\cterm="he=e-1 nextgroup=vimHiAttribList syn match vimHiStartStop contained "\c\(start\|stop\)="he=e-1 nextgroup=vimHiTermcap,vimOption syn match vimHiCTerm contained "\ccterm="he=e-1 nextgroup=vimHiAttribList @@ -419,17 +444,17 @@ syn match vimHiGuiFont contained "\cfon syn match vimHiGuiFgBg contained "\cgui[fb]g="he=e-1 nextgroup=vimHiGroup,vimHiGuiFontname,vimHiGuiRgb,vimFgBgAttrib syn match vimHiTermcap contained "\S\+" contains=vimNotation -" Highlight: clear {{{1 +" Highlight: clear {{{2 syn keyword vimHiClear contained clear nextgroup=vimHiGroup -" Highlight: link {{{1 +" Highlight: link {{{2 syn region vimHiLink contained oneline matchgroup=vimCommand start="\<\(def\s\+\)\=link\>\|\" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation -" Control Characters {{{1 +" Control Characters {{{2 " ================== syn match vimCtrlChar "[- -]" -" Beginners - Patterns that involve ^ {{{1 +" Beginners - Patterns that involve ^ {{{2 " ========= syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle syn match vimCommentTitle '"\s*\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup @@ -437,7 +462,7 @@ syn match vimContinue "^\s*\\" syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained -" Scripts : perl,ruby : Benoit Cerrina {{{1 +" Scripts : perl,ruby : Benoit Cerrina {{{2 " ======= python,tcl: Johannes Zellner " allow users to prevent embedded script syntax highlighting @@ -447,7 +472,7 @@ if !exists("g:vimembedscript") let g:vimembedscript= 1 endif -" [-- perl --] {{{2 +" [-- perl --] {{{3 if (has("perl") || g:vimembedscript) && filereadable(expand(":p:h")."/perl.vim") unlet! b:current_syntax syn include @vimPerlScript :p:h/perl.vim @@ -455,7 +480,7 @@ if (has("perl") || g:vimembedscript) && syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript endif -" [-- ruby --] {{{2 +" [-- ruby --] {{{3 if (has("ruby") || g:vimembedscript) && filereadable(expand(":p:h")."/ruby.vim") unlet! b:current_syntax syn include @vimRubyScript :p:h/ruby.vim @@ -463,7 +488,7 @@ if (has("ruby") || g:vimembedscript) && syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript endif -" [-- python --] {{{2 +" [-- python --] {{{3 if (has("python") || g:vimembedscript) && filereadable(expand(":p:h")."/python.vim") unlet! b:current_syntax syn include @vimPythonScript :p:h/python.vim @@ -471,7 +496,7 @@ if (has("python") || g:vimembedscript) & syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript endif -" [-- tcl --] {{{2 +" [-- tcl --] {{{3 if (has("tcl") || g:vimembedscript) && filereadable(expand(":p:h")."/tcl.vim") unlet! b:current_syntax syn include @vimTclScript :p:h/tcl.vim @@ -479,7 +504,7 @@ if (has("tcl") || g:vimembedscript) && f syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript endif -" Synchronize (speed) {{{1 +" Synchronize (speed) {{{2 "============ if exists("g:vim_minlines") exe "syn sync minlines=".g:vim_minlines @@ -492,39 +517,47 @@ endif syn sync linecont "^\s\+\\" syn sync match vimAugroupSyncA groupthere NONE "\\s\+[eE][nN][dD]" -" Highlighting Settings {{{1 +" Highlighting Settings {{{2 " ==================== hi def link vimAuHighlight vimHighlight hi def link vimSubst1 vimSubst hi def link vimBehaveModel vimBehave +if !exists("g:vimsyntax_noerror") +" hi def link vimAugroupError vimError + hi def link vimBehaveError vimError + hi def link vimCollClassErr vimError + hi def link vimErrSetting vimError + hi def link vimFTError vimError + hi def link vimFunctionError vimError + hi def link VimFunc vimError + hi def link vimHiAttribList vimError + hi def link vimHiCtermError vimError + hi def link vimHiKeyError vimError + hi def link vimKeyCodeError vimError + hi def link vimMapModErr vimError + hi def link vimSubstFlagErr vimError + hi def link vimSynCaseError vimError +endif + hi def link vimAddress vimMark -" hi def link vimAugroupError vimError hi def link vimAugroupKey vimCommand hi def link vimAutoCmdOpt vimOption hi def link vimAutoCmd vimCommand hi def link vimAutoSet vimCommand -hi def link vimBehaveError vimError hi def link vimBehave vimCommand -hi def link vimCollClassErr vimError hi def link vimCommentString vimString hi def link vimCondHL vimCommand hi def link vimEchoHLNone vimGroup hi def link vimEchoHL vimCommand hi def link vimElseif vimCondHL -hi def link vimErrSetting vimError hi def link vimFgBgAttrib vimHiAttrib hi def link vimFTCmd vimCommand -hi def link vimFTError vimError hi def link vimFTOption vimSynType -hi def link VimFunc vimError hi def link vimFuncKey vimCommand -hi def link vimFunctionError vimError hi def link vimGroupAdd vimSynOption hi def link vimGroupRem vimSynOption -hi def link vimHiAttribList vimError -hi def link vimHiCtermError vimError hi def link vimHiCtermFgBg vimHiTerm hi def link vimHiCTerm vimHiTerm hi def link vimHighlight vimCommand @@ -533,16 +566,13 @@ hi def link vimHiGuiFgBg vimHiTerm hi def link vimHiGuiFont vimHiTerm hi def link vimHiGuiRgb vimNumber hi def link vimHiGui vimHiTerm -hi def link vimHiKeyError vimError hi def link vimHiStartStop vimHiTerm hi def link vimHLGroup vimGroup hi def link vimInsert vimString -hi def link vimKeyCodeError vimError hi def link vimKeyCode vimSpecFile hi def link vimLet vimCommand hi def link vimLineComment vimComment hi def link vimMapBang vimCommand -hi def link vimMapModErr vimError hi def link vimMapModKey vimFuncSID hi def link vimMapMod vimBracket hi def link vimMap vimCommand @@ -560,10 +590,8 @@ hi def link vimSetMod vimOption hi def link vimSetString vimString hi def link vimSpecFileMod vimSpecFile hi def link vimStringCont vimString -hi def link vimSubstFlagErr vimError hi def link vimSubstTwoBS vimString hi def link vimSubst vimCommand -hi def link vimSynCaseError vimError hi def link vimSyncGroupName vimGroupName hi def link vimSyncGroup vimGroupName hi def link vimSynContains vimSynOption @@ -637,6 +665,6 @@ hi def link vimSyncNone Type hi def link vimTodo Todo hi def link vimUserCmdError Error -" Current Syntax Variable: {{{1 +" Current Syntax Variable: {{{2 let b:current_syntax = "vim" " vim:ts=18 fdm=marker diff --git a/src/GvimExt/Make_ming.mak b/src/GvimExt/Make_ming.mak --- a/src/GvimExt/Make_ming.mak +++ b/src/GvimExt/Make_ming.mak @@ -28,8 +28,8 @@ CXXFLAGS := -O2 -mno-cygwin WINDRES = i386-mingw32msvc-windres endif else -CXX := g++.exe -WINDRES := windres.exe +CXX := g++ +WINDRES := windres CXXFLAGS := -O2 -mno-cygwin endif LIBS := -luuid diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -76,6 +76,7 @@ # CSCOPE no or yes: include support for Cscope interface (yes) # NETBEANS no or yes: include support for Netbeans interface (yes if GUI # is yes) +# NBDEBUG no or yes: include support for debugging Netbeans interface (no) # XPM define to path to XPM dir to get support for loading XPM images. ### BOR: root of the BC installation @@ -397,19 +398,6 @@ MBDEFINES = $(MBDEFINES) -DDYNAMIC_GETTE DEFINES = $(DEFINES) -DFEAT_CSCOPE !endif -!if ("$(NETBEANS)"=="yes") -DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG -!if ("$(DEBUG)"=="yes") -DEFINES = $(DEFINES) -DNBDEBUG -NBDEBUG_DEP = nbdebug.h nbdebug.c -!endif -!endif - -!ifdef XPM -DEFINES = $(DEFINES) -DFEAT_XPM_W32 -INCLUDE = $(XPM)\include;$(INCLUDE) -!endif - !if ("$(GUI)"=="yes") DEFINES = $(DEFINES) -DFEAT_GUI_W32 -DFEAT_CLIPBOARD !if ("$(DEBUG)"=="yes") @@ -427,11 +415,13 @@ STARTUPOBJ = c0w32.obj LINK2 = -aa RESFILE = vim.res !else +!undef NETBEANS +!undef XPM +!undef VIMDLL !if ("$(DEBUG)"=="yes") TARGET = vimd.exe !else # for now, anyway: VIMDLL is only for the GUI version -!undef VIMDLL TARGET = vim.exe !endif !if ($(OSTYPE)==DOS16) @@ -447,6 +437,21 @@ LINK2 = -ap -OS -o -P RESFILE = vim.res !endif +!if ("$(NETBEANS)"=="yes") +DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG +!if ("$(NBDEBUG)"=="yes") +DEFINES = $(DEFINES) -DNBDEBUG +NBDEBUG_DEP = nbdebug.h nbdebug.c +!endif +!endif + +!ifdef XPM +!if ("$(GUI)"=="yes") +DEFINES = $(DEFINES) -DFEAT_XPM_W32 +INCLUDE = $(XPM)\include;$(INCLUDE) +!endif +!endif + !if ("$(USEDLL)"=="yes") DEFINES = $(DEFINES) -D_RTLDLL !endif diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,6 +1,6 @@ # # Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2004 Apr 23 +# Last updated by Dan Sharp. Last Change: 2004 Jul 01 # # This compiles Vim as a Windows application. If you want Vim to run as a # Cygwin application use the Makefile (just like on Unix). @@ -36,6 +36,7 @@ # OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED) # NETBEANS no or yes: to include netbeans interface support (yes when GUI # is yes) +# NBDEBUG no or yes: to include netbeans interface debugging support (no) # XPM define to path to XPM dir to get XPM image support (not defined) #>>>>> choose options: ifndef GUI @@ -62,12 +63,14 @@ ifndef IME IME = yes endif -ifndef CPUNR -CPUNR = i386 +ifndef ARCH +ARCH = i386 endif -ifndef ARCH -ARCH = i386 +ifndef CPUNR +# Setting -march implicitly sets -mcpu to the same value, +# so reflect that in the defaults here. +CPUNR = $(ARCH) endif ifndef WINVER @@ -293,12 +296,16 @@ EXTRA_OBJS += $(OUTDIR)/if_cscope.o endif ############################## +ifeq ($(GUI),yes) + +############################## ifeq (yes, $(NETBEANS)) +# Only allow NETBEANS for a GUI build. DEFINES += -DFEAT_NETBEANS_INTG EXTRA_OBJS += $(OUTDIR)/netbeans.o $(OUTDIR)/gui_beval.o EXTRA_LIBS += -lwsock32 -ifeq (yes, $(DEBUG)) +ifeq (yes, $(NBDEBUG)) DEFINES += -DNBDEBUG NBDEBUG_DEP = nbdebug.h nbdebug.c endif @@ -307,6 +314,7 @@ endif ############################## ifdef XPM +# Only allow XPM for a GUI build. DEFINES += -DFEAT_XPM_W32 INCLUDES += -I$(XPM)/include EXTRA_OBJS += $(OUTDIR)/xpm_w32.o @@ -314,14 +322,6 @@ EXTRA_LIBS += -L$(XPM)/lib -lXpm endif ############################## -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -EXTRA_OBJS += $(OUTDIR)/if_ole.o -EXTRA_LIBS += -loleaut32 -lstdc++ -endif - -############################## -ifeq ($(GUI),yes) EXE = gvim$(DEBUG_SUFFIX).exe OUTDIR = gobj$(DEBUG_SUFFIX) DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD @@ -334,6 +334,13 @@ LIBS += -luser32 -lgdi32 -lcomdlg32 endif ############################## +ifeq (yes, $(OLE)) +DEFINES += -DFEAT_OLE +EXTRA_OBJS += $(OUTDIR)/if_ole.o +EXTRA_LIBS += -loleaut32 -lstdc++ +endif + +############################## ifneq (sh.exe, $(SHELL)) DEL = rm DIRSLASH = / diff --git a/src/Make_ming.mak b/src/Make_ming.mak --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -287,17 +287,24 @@ DEFINES += -DFEAT_CSCOPE endif ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) DEFINES += -DFEAT_NETBEANS_INTG -ifeq ($(DEBUG), yes) + +ifeq ($(NBDEBUG), yes) DEFINES += -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c endif endif +endif ifdef XPM +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include endif +endif ifeq ($(DEBUG),yes) CFLAGS += -g -fstack-check @@ -378,14 +385,20 @@ ifeq ($(CSCOPE),yes) OBJ += $(OUTDIR)/if_cscope.o endif ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/netbeans.o $(OUTDIR)/gui_beval.o LIB += -lwsock32 endif +endif ifdef XPM +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/xpm_w32.o # You'll need libXpm.a from http://gnuwin32.sf.net LIB += -L $(XPM)/lib -lXpm endif +endif ifeq ($(GUI),yes) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -57,6 +57,7 @@ # Processor Version: CPUNR=[i386, i486, i586, i686] (default is i386) # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes) +# Netbeans Debugging Support: NBDEBUG=[yes or no] (default is no) # XPM Image Support: XPM=[path to XPM directory] # # You can combine any of these interfaces @@ -189,12 +190,15 @@ CSCOPE_DEFS = -DFEAT_CSCOPE NETBEANS = $(GUI) !endif +# Only allow NETBEANS and XPM for a GUI build. +!if "$(GUI)" == "yes" !if "$(NETBEANS)" == "yes" # NETBEANS - Include support for Netbeans integration NETBEANS_PRO = proto/netbeans.pro NETBEANS_OBJ = $(OBJDIR)/netbeans.obj $(OBJDIR)/gui_beval.obj NETBEANS_DEFS = -DFEAT_NETBEANS_INTG -!if "$(DEBUG)" == "yes" + +!if "$(NBDEBUG)" == "yes" NBDEBUG_DEFS = -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c @@ -210,6 +214,7 @@ XPM_DEFS = -DFEAT_XPM_W32 XPM_LIB = $(XPM)\lib\libXpm.lib XPM_INC = -I $(XPM)\include !endif +!endif !if defined(USE_MSVCRT) CVARS = $(cvarsdll) diff --git a/src/Makefile b/src/Makefile --- a/src/Makefile +++ b/src/Makefile @@ -336,7 +336,6 @@ CClink = $(CC) # use it (e.g., want a GTK-only version), then use --enable-gui=gtk. # # If the selected GUI isn't found, the GUI is disabled automatically -#CONF_OPT_GUI = --enable-gui=kde #CONF_OPT_GUI = --enable-gui=gtk #CONF_OPT_GUI = --enable-gui=gtk --disable-gtktest #CONF_OPT_GUI = --enable-gui=gtk2 @@ -344,6 +343,7 @@ CClink = $(CC) #CONF_OPT_GUI = --enable-gui=gnome #CONF_OPT_GUI = --enable-gui=gnome2 #CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest +#CONF_OPT_GUI = --enable-gui=kde #CONF_OPT_GUI = --enable-gui=motif #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared" #CONF_OPT_GUI = --enable-gui=athena diff --git a/src/buffer.c b/src/buffer.c --- a/src/buffer.c +++ b/src/buffer.c @@ -1668,6 +1668,9 @@ free_buf_options(buf, free_p_ff) #ifdef FEAT_INS_EXPAND clear_string_option(&buf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + clear_string_option(&buf->b_p_cfu); +#endif #ifdef FEAT_QUICKFIX clear_string_option(&buf->b_p_gp); clear_string_option(&buf->b_p_mp); @@ -1680,6 +1683,9 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_dict); clear_string_option(&buf->b_p_tsr); #endif +#ifdef FEAT_TEXTOBJ + clear_string_option(&buf->b_p_qe); +#endif buf->b_p_ar = -1; } diff --git a/src/configure.in b/src/configure.in --- a/src/configure.in +++ b/src/configure.in @@ -1251,7 +1251,10 @@ AC_DEFUN(AM_PATH_KDE, KDE_LIBS="$KDE_PREFIX/lib" fi if test "x$KDE_INCLUDES" = "x"; then - KDE_INCLUDES="$KDE_PREFIX/include" + KDE_INCLUDES="$KDE_PREFIX/include" + if test -d "$KDE_INCLUDES/kde"; then + KDE_INCLUDES="$KDE_INCLUDES/kde" + fi fi kde_major_version=`$KDE_CONFIG --version | grep KDE | \ sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'` diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -30,6 +30,7 @@ #define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) #define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) #define CTRL_X_CMDLINE 11 +#define CTRL_X_FUNCTION 12 #define CHECK_KEYS_TIME 30 @@ -38,7 +39,7 @@ static char *ctrl_x_msgs[] = { N_(" Keyword completion (^N^P)"), /* ctrl_x_mode == 0, ^P/^N compl. */ - N_(" ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)"), + N_(" ^X mode (^E^Y^L^]^F^I^K^D^U^V^N^P)"), /* Scroll has it's own msgs, in it's place there is the msg for local * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo */ N_(" Keyword Local completion (^N^P)"), @@ -50,7 +51,8 @@ static char *ctrl_x_msgs[] = NULL, N_(" Dictionary completion (^K^N^P)"), N_(" Thesaurus completion (^T^N^P)"), - N_(" Command-line completion (^V^N^P)") + N_(" Command-line completion (^V^N^P)"), + N_(" User defined completion (^U^N^P)"), }; static char_u e_hitend[] = N_("Hit end of paragraph"); @@ -762,7 +764,7 @@ edit(cmdchar, startln, count) #ifdef FEAT_INS_EXPAND /* Enter CTRL-X mode */ case Ctrl_X: - /* CTRL-X after CTRL-V CTRL-X doesn't do anything, so that CTRL-X + /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X * CTRL-V works like CTRL-N */ if (ctrl_x_mode != CTRL_X_CMDLINE) { @@ -1030,6 +1032,12 @@ doESCkey: /* delete all inserted text in current line */ case Ctrl_U: +# ifdef FEAT_COMPL_FUNC + /* CTRL-X CTRL-U completes with 'completefunc'. */ + if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET + || ctrl_x_mode == CTRL_X_FUNCTION) + goto docomplete; +# endif did_backspace = ins_bs(c, BACKSPACE_LINE, &inserted_space); auto_format(FALSE, TRUE); inserted_space = FALSE; @@ -1914,6 +1922,10 @@ vim_is_ctrl_x_key(c) case CTRL_X_CMDLINE: return (c == Ctrl_V || c == Ctrl_Q || c == Ctrl_P || c == Ctrl_N || c == Ctrl_X); +#ifdef FEAT_COMPL_FUNC + case CTRL_X_FUNCTION: + return (c == Ctrl_U || c == Ctrl_P || c == Ctrl_N || c == Ctrl_X); +#endif } EMSG(_(e_internal)); return FALSE; @@ -2416,6 +2428,11 @@ ins_compl_prep(c) case Ctrl_T: ctrl_x_mode = CTRL_X_THESAURUS; break; +#ifdef FEAT_COMPL_FUNC + case Ctrl_U: + ctrl_x_mode = CTRL_X_FUNCTION; + break; +#endif case Ctrl_RSB: ctrl_x_mode = CTRL_X_TAGS; break; @@ -2622,6 +2639,88 @@ ins_compl_next_buf(buf, flag) return buf; } +#ifdef FEAT_COMPL_FUNC +static char_u *call_completefunc __ARGS((char_u *line, char_u *base, int col, int preproc)); +static int expand_by_function __ARGS((int lnum, int col, char_u *base, char_u ***matches)); + +/* + * Execute user defined complete function 'completefunc'. + * Return NULL if some error occurs. + */ + static char_u * +call_completefunc(line, base, col, preproc) + char_u *line; + char_u *base; + int col; + int preproc; +{ + char_u colbuf[30]; + char_u *args[4]; + + /* Return NULL when 'completefunc' isn't set. */ + if (*curbuf->b_p_cfu == NUL) + return NULL; + + sprintf((char *)colbuf, "%d", col + (base ? (int)STRLEN(base) : 0)); + args[0] = line; + args[1] = base; + args[2] = colbuf; + args[3] = preproc ? "1" : "0"; + return call_vim_function(curbuf->b_p_cfu, 4, args, FALSE); +} + +/* + * Execute user defined complete function 'completefunc', and get candidates + * are separeted with "\n". Return value is number of candidates and array + * of candidates as "matches". + */ + static int +expand_by_function(lnum, col, base, matches) + int lnum; + int col; + char_u *base; + char_u ***matches; +{ + char_u *matchstr = NULL; + + /* Execute 'completefunc' and get the result */ + matchstr = call_completefunc(ml_get_buf(curbuf, lnum, FALSE), base, col, 0); + + /* Parse returned string */ + if (matchstr != NULL) + { + garray_T ga; + char_u *p, *pnext; + + ga_init2(&ga, (int)sizeof(char*), 8); + for (p = matchstr; *p != NUL; p = pnext) + { + int len; + + pnext = vim_strchr(p, '\n'); + if (pnext == NULL) + pnext = p + STRLEN(p); + len = pnext - p; + if (len > 0) + { + if (ga_grow(&ga, 1) == FAIL) + break; + ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(p, len); + ++ga.ga_len; + --ga.ga_room; + } + if (*pnext != NUL) + ++pnext; + } + vim_free(matchstr); + if (ga.ga_len > 0) + *matches = (char_u**)ga.ga_data; + return ga.ga_len; + } + return 0; +} +#endif /* FEAT_COMPL_FUNC */ + /* * Get the next expansion(s) for the text starting at the initial curbuf * position "ini" and in the direction dir. @@ -2660,7 +2759,8 @@ ins_compl_get_exp(ini, dir) ins_buf->b_scanned = 0; found_all = FALSE; ins_buf = curbuf; - e_cpt = continue_status & CONT_LOCAL ? (char_u *)"." : curbuf->b_p_cpt; + e_cpt = (continue_status & CONT_LOCAL) + ? (char_u *)"." : curbuf->b_p_cpt; last_match_pos = first_match_pos = *ini; } @@ -2828,6 +2928,15 @@ ins_compl_get_exp(ini, dir) ins_compl_add_matches(num_matches, matches, dir); break; +#ifdef FEAT_COMPL_FUNC + case CTRL_X_FUNCTION: + num_matches = expand_by_function(first_match_pos.lnum, + first_match_pos.col, complete_pat, &matches); + if (num_matches > 0) + ins_compl_add_matches(num_matches, matches, dir); + break; +#endif + default: /* normal ^P/^N and ^X^L */ /* * If 'infercase' is set, don't use 'smartcase' here @@ -3404,6 +3513,36 @@ ins_complete(c) tmp_ptr = line + temp; temp = complete_col - temp; } +#ifdef FEAT_COMPL_FUNC + else if (ctrl_x_mode == CTRL_X_FUNCTION) + { + /* + * Call user defined function 'completefunc' with line content, + * cursor column number and preproc is 1. Obtain length of text + * to use for completion. + */ + char_u *lenstr; + int keeplen = 0; + + /* Call 'completefunc' and get pattern length as a string */ + lenstr = call_completefunc(line, NULL, complete_col, 1); + if (lenstr == NULL) + return FAIL; + keeplen = atoi(lenstr); + vim_free(lenstr); + if (keeplen < 0) + return FAIL; + if ((colnr_T)keeplen > complete_col) + keeplen = complete_col; + + /* Setup variables for completion */ + tmp_ptr = line + keeplen; + temp = complete_col - keeplen; + complete_pat = vim_strnsave(tmp_ptr, temp); + if (complete_pat == NULL) + return FAIL; + } +#endif complete_col = (colnr_T) (tmp_ptr - line); if (continue_status & CONT_ADDING) diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -741,6 +741,14 @@ call_vim_function(func, argc, argv, safe for (i = 0; i < argc; i++) { + /* Pass a NULL or empty argument as an empty string */ + if (argv[i] == NULL || *argv[i] == NUL) + { + argvars[i].var_type = VAR_STRING; + argvars[i].var_val.var_string = ""; + continue; + } + /* Recognize a number argument, the others must be strings. */ vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL); if (len != 0 && len == (int)STRLEN(argv[i])) diff --git a/src/feature.h b/src/feature.h --- a/src/feature.h +++ b/src/feature.h @@ -379,6 +379,13 @@ #endif /* + * Insert mode completion with 'completefunc'. + */ +#if defined(FEAT_INS_EXPAND) && defined(FEAT_EVAL) +# define FEAT_COMPL_FUNC +#endif + +/* * +user_commands Allow the user to define his own commands. */ #ifdef FEAT_NORMAL diff --git a/src/fileio.c b/src/fileio.c --- a/src/fileio.c +++ b/src/fileio.c @@ -6628,6 +6628,7 @@ static struct event_name {"BufWriteCmd", EVENT_BUFWRITECMD}, {"CmdwinEnter", EVENT_CMDWINENTER}, {"CmdwinLeave", EVENT_CMDWINLEAVE}, + {"ColorScheme", EVENT_COLORSCHEME}, {"EncodingChanged", EVENT_ENCODINGCHANGED}, {"FileEncoding", EVENT_ENCODINGCHANGED}, {"CursorHold", EVENT_CURSORHOLD}, diff --git a/src/globals.h b/src/globals.h --- a/src/globals.h +++ b/src/globals.h @@ -1004,6 +1004,7 @@ EXTERN char_u *globaldir INIT(= NULL); EXTERN int lcs_eol INIT(= '$'); EXTERN int lcs_ext INIT(= NUL); EXTERN int lcs_prec INIT(= NUL); +EXTERN int lcs_nbsp INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); diff --git a/src/if_cscope.c b/src/if_cscope.c --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -434,14 +434,14 @@ cs_add_common(arg1, arg2, flags) char *flags; { struct stat statbuf; - int ret; - char *fname = NULL; - char *fname2 = NULL; - char *ppath = NULL; - int i; + int ret; + char *fname = NULL; + char *fname2 = NULL; + char *ppath = NULL; + int i; /* get the filename (arg1), expand it, and try to stat it */ - if ((fname = (char *)alloc(MAXPATHL+1)) == NULL) + if ((fname = (char *)alloc(MAXPATHL + 1)) == NULL) goto add_err; expand_env((char_u *)arg1, (char_u *)fname, MAXPATHL); @@ -459,7 +459,7 @@ staterr: { struct stat statbuf2; - if ((ppath = (char *)alloc(MAXPATHL+1)) == NULL) + if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL) goto add_err; expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL); diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -8257,6 +8257,12 @@ nv_object(cap) case 's': /* "as" = a sentence */ flag = current_sent(cap->oap, cap->count1, include); break; + case '"': /* "a"" = a double quoted string */ + case '\'': /* "a'" = a single quoted string */ + case '`': /* "a`" = a backtick quoted string */ + flag = current_quote(cap->oap, cap->count1, include, + cap->nchar); + break; #if 0 /* TODO */ case 'S': /* "aS" = a section */ case 'f': /* "af" = a filename */ diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -62,6 +62,7 @@ typedef enum , PV_CMS , PV_COM , PV_CPT + , PV_CFU , PV_DEF , PV_DICT , PV_DIFF @@ -109,6 +110,7 @@ typedef enum , PV_PATH , PV_PI , PV_PVW + , PV_QE , PV_RL , PV_RLC , PV_RO @@ -169,6 +171,9 @@ static char_u *p_cms; #ifdef FEAT_INS_EXPAND static char_u *p_cpt; #endif +#ifdef FEAT_COMPL_FUNC +static char_u *p_cfu; +#endif static int p_eol; static int p_et; #ifdef FEAT_MBYTE @@ -205,6 +210,9 @@ static char_u *p_nf; static char_u *p_oft; #endif static int p_pi; +#ifdef FEAT_TEXTOBJ +static char_u *p_qe; +#endif static int p_ro; #ifdef FEAT_SMARTINDENT static int p_si; @@ -624,6 +632,15 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif }, + {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, +#ifdef FEAT_COMPL_FUNC + (char_u *)&p_cfu, PV_CFU, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + }, {"confirm", "cf", P_BOOL|P_VI_DEF, #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) (char_u *)&p_confirm, PV_NONE, @@ -1658,6 +1675,15 @@ static struct vimoption {"prompt", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L}}, + {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, +#ifdef FEAT_TEXTOBJ + (char_u *)&p_qe, PV_QE, + {(char_u *)"\\", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + }, {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, (char_u *)&p_ro, PV_RO, {(char_u *)FALSE, (char_u *)0L}}, @@ -4375,6 +4401,9 @@ check_buf_options(buf) check_string_option(&buf->b_p_cms); #endif check_string_option(&buf->b_p_nf); +#ifdef FEAT_TEXTOBJ + check_string_option(&buf->b_p_qe); +#endif #ifdef FEAT_SYN_HL check_string_option(&buf->b_p_syn); #endif @@ -4397,6 +4426,9 @@ check_buf_options(buf) #ifdef FEAT_INS_EXPAND check_string_option(&buf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + check_string_option(&buf->b_p_cfu); +#endif #ifdef FEAT_KEYMAP check_string_option(&buf->b_p_keymap); #endif @@ -5793,6 +5825,7 @@ set_chars_option(varp) { {&lcs_eol, "eol"}, {&lcs_ext, "extends"}, + {&lcs_nbsp, "nbsp"}, {&lcs_prec, "precedes"}, {&lcs_tab2, "tab"}, {&lcs_trail, "trail"}, @@ -7871,6 +7904,9 @@ get_varp(p) #ifdef FEAT_INS_EXPAND case PV_CPT: return (char_u *)&(curbuf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + case PV_CFU: return (char_u *)&(curbuf->b_p_cfu); +#endif case PV_EOL: return (char_u *)&(curbuf->b_p_eol); case PV_ET: return (char_u *)&(curbuf->b_p_et); #ifdef FEAT_MBYTE @@ -7909,6 +7945,9 @@ get_varp(p) case PV_OFT: return (char_u *)&(curbuf->b_p_oft); #endif case PV_PI: return (char_u *)&(curbuf->b_p_pi); +#ifdef FEAT_TEXTOBJ + case PV_QE: return (char_u *)&(curbuf->b_p_qe); +#endif case PV_RO: return (char_u *)&(curbuf->b_p_ro); #ifdef FEAT_SMARTINDENT case PV_SI: return (char_u *)&(curbuf->b_p_si); @@ -8173,6 +8212,9 @@ buf_copy_options(buf, flags) #ifdef FEAT_INS_EXPAND buf->b_p_cpt = vim_strsave(p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + buf->b_p_cfu = vim_strsave(p_cfu); +#endif buf->b_p_sts = p_sts; buf->b_p_sts_nopaste = p_sts_nopaste; #ifndef SHORT_FNAME @@ -8256,6 +8298,9 @@ buf_copy_options(buf, flags) buf->b_p_dict = empty_option; buf->b_p_tsr = empty_option; #endif +#ifdef FEAT_TEXTOBJ + buf->b_p_qe = vim_strsave(p_qe); +#endif /* * Don't copy the options set by ex_help(), use the saved values, diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5391,6 +5391,7 @@ mch_libcall(libname, funcname, argstring { # if defined(USE_DLOPEN) void *hinstLib; + char *dlerr = NULL; # else shl_t hinstLib; # endif @@ -5407,6 +5408,13 @@ mch_libcall(libname, funcname, argstring | RTLD_LOCAL # endif ); + if (hinstLib == NULL) + { + /* "dlerr" must be used before dlclose() */ + dlerr = (char *)dlerror(); + if (dlerr != NULL) + EMSG2(_("dlerror = \"%s\""), dlerr); + } # else hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L); # endif @@ -5423,6 +5431,7 @@ mch_libcall(libname, funcname, argstring if (SETJMP(lc_jump_env) != 0) { success = FALSE; + dlerr = NULL; mch_didjmp(); } else @@ -5435,12 +5444,17 @@ mch_libcall(libname, funcname, argstring { # if defined(USE_DLOPEN) ProcAdd = (STRPROCSTR)dlsym(hinstLib, (const char *)funcname); + dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, TYPE_PROCEDURE, (void *)&ProcAdd) < 0) ProcAdd = NULL; # endif - if ((success = (ProcAdd != NULL))) + if ((success = (ProcAdd != NULL +# if defined(USE_DLOPEN) + && dlerr == NULL +# endif + ))) { if (string_result == NULL) retval_int = ((STRPROCINT)ProcAdd)(argstring); @@ -5452,12 +5466,17 @@ mch_libcall(libname, funcname, argstring { # if defined(USE_DLOPEN) ProcAddI = (INTPROCSTR)dlsym(hinstLib, (const char *)funcname); + dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, TYPE_PROCEDURE, (void *)&ProcAddI) < 0) ProcAddI = NULL; # endif - if ((success = (ProcAddI != NULL))) + if ((success = (ProcAddI != NULL +# if defined(USE_DLOPEN) + && dlerr == NULL +# endif + ))) { if (string_result == NULL) retval_int = ((INTPROCINT)ProcAddI)(argint); @@ -5492,8 +5511,12 @@ mch_libcall(libname, funcname, argstring # endif # endif +# if defined(USE_DLOPEN) + /* "dlerr" must be used before dlclose() */ + if (dlerr != NULL) + EMSG2(_("dlerror = \"%s\""), dlerr); + /* Free the DLL module. */ -# if defined(USE_DLOPEN) (void)dlclose(hinstLib); # else (void)shl_unload(hinstLib); diff --git a/src/proto/search.pro b/src/proto/search.pro --- a/src/proto/search.pro +++ b/src/proto/search.pro @@ -26,6 +26,7 @@ int current_word __ARGS((oparg_T *oap, l int current_sent __ARGS((oparg_T *oap, long count, int include)); int current_block __ARGS((oparg_T *oap, long count, int include, int what, int other)); int current_par __ARGS((oparg_T *oap, long count, int include, int type)); +int current_quote __ARGS((oparg_T *oap, long count, int include, int quotechar)); int linewhite __ARGS((linenr_T lnum)); void find_pattern_in_path __ARGS((char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum)); int read_viminfo_search_pattern __ARGS((vir_T *virp, int force)); diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -3549,6 +3549,28 @@ win_line(wp, lnum, startrow, endrow) #endif ++ptr; + /* 'list' : change char 160 to lcs_nbsp. */ + if (wp->w_p_list && c == 160 && lcs_nbsp) + { + c = lcs_nbsp; + if (area_attr == 0 && search_attr == 0) + { + n_attr = 1; + extra_attr = hl_attr(HLF_8); + saved_attr2 = char_attr; /* save current attr */ + } +#ifdef FEAT_MBYTE + mb_c = c; + if (enc_utf8 && (*mb_char2len)(c) > 1) + { + mb_utf8 = TRUE; + u8c_c1 = u8c_c2 = 0; + } + else + mb_utf8 = FALSE; +#endif + } + if (extra_check) { #ifdef FEAT_SYN_HL diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -3603,7 +3603,269 @@ extend: return OK; } + +static int find_next_quote __ARGS((char_u *top_ptr, int col, int quotechar, char_u *escape)); +static int find_prev_quote __ARGS((char_u *line, int col_start, int quotechar, char_u *escape)); + +/* + * Search quote char from string line[col]. + * Quote character escaped by one of the characters in "escape" is not counted + * as a quote. + * Returns column number of "quotechar" or -1 when not found. + */ + static int +find_next_quote(line, col, quotechar, escape) + char_u *line; + int col; + int quotechar; + char_u *escape; /* escape characters, can be NULL */ +{ + int c; + + while (1) + { + c = line[col]; + if (c == NUL) + return -1; + else if (escape != NULL && vim_strchr(escape, c)) + ++col; + else if (c == quotechar) + break; +#ifdef FEAT_MBYTE + if (has_mbyte) + col += (*mb_ptr2len_check)(line + col); + else #endif + ++col; + } + return col; +} + +/* + * Search backwards in "line" from column "col_start" to find "quotechar". + * Quote character escaped by one of the characters in "escape" is not counted + * as a quote. + * Return the found column or zero. + */ + static int +find_prev_quote(line, col_start, quotechar, escape) + char_u *line; + int col_start; + int quotechar; + char_u *escape; /* escape characters, can be NULL */ +{ + int n; + + while (col_start > 0) + { + --col_start; +#ifdef FEAT_MBYTE + col_start -= (*mb_head_off)(line, line + col_start); +#endif + n = 0; + if (escape != NULL) + while (col_start - n > 0 && vim_strchr(escape, + line[col_start - n - 1]) != NULL) + ++n; + if (n & 1) + col_start -= n; /* uneven number of escape chars, skip it */ + else if (line[col_start] == quotechar) + break; + } + return col_start; +} + +/* + * Find quote under the cursor, cursor at end. + * Returns TRUE if found, else FALSE. + */ + int +current_quote(oap, count, include, quotechar) + oparg_T *oap; + long count; + int include; /* TRUE == include quote char */ + int quotechar; /* Quote character */ +{ + char_u *line = ml_get_curline(); + int col_end; + int col_start = curwin->w_cursor.col; + int inclusive = FALSE; +#ifdef FEAT_VISUAL + int vis_empty = TRUE; /* Visual selection <= 1 char */ + int vis_bef_curs = FALSE; /* Visual starts before cursor */ + + /* Correct cursor when 'selection' is exclusive */ + if (VIsual_active) + { + if (*p_sel == 'e' && vis_bef_curs) + dec_cursor(); + vis_empty = equalpos(VIsual, curwin->w_cursor); + vis_bef_curs = lt(VIsual, curwin->w_cursor); + } + if (!vis_empty && line[col_start] == quotechar) + { + /* Already selecting something and on a quote character. Find the + * next quoted string. */ + if (vis_bef_curs) + { + /* Assume we are on a closing quote: move to after the next + * opening quote. */ + col_start = find_next_quote(line, col_start + 1, quotechar, NULL); + if (col_start < 0) + return FALSE; + col_end = find_next_quote(line, col_start + 1, quotechar, + curbuf->b_p_qe); + if (col_end < 0) + { + /* We were on a starting quote perhaps? */ + col_end = col_start; + col_start = curwin->w_cursor.col; + } + } + else + { + col_end = find_prev_quote(line, col_start, quotechar, NULL); + if (line[col_end] != quotechar) + return FALSE; + col_start = find_prev_quote(line, col_end, quotechar, + curbuf->b_p_qe); + if (line[col_start] != quotechar) + { + /* We were on an ending quote perhaps? */ + col_start = col_end; + col_end = curwin->w_cursor.col; + } + } + } + else +#endif + + if (line[col_start] == quotechar +#ifdef FEAT_VISUAL + || !vis_empty +#endif + ) + { + int first_col = col_start; + +#ifdef FEAT_VISUAL + if (!vis_empty) + { + if (vis_bef_curs) + first_col = find_next_quote(line, col_start, quotechar, NULL); + else + first_col = find_prev_quote(line, col_start, quotechar, NULL); + } +#endif + /* The cursor is on a quote, we don't know if it's the opening or + * closing quote. Search from the start of the line to find out. + * Also do this when there is a Visual area, a' may leave the cursor + * in between two strings. */ + col_start = 0; + while (1) + { + /* Find open quote character. */ + col_start = find_next_quote(line, col_start, quotechar, NULL); + if (col_start < 0 || col_start > first_col) + return FALSE; + /* Find close quote character. */ + col_end = find_next_quote(line, col_start + 1, quotechar, + curbuf->b_p_qe); + if (col_end < 0) + return FALSE; + /* If is cursor between start and end quote character, it is + * target text object. */ + if (col_start <= first_col && first_col <= col_end) + break; + col_start = col_end + 1; + } + } + else + { + /* Search backward for a starting quote. */ + col_start = find_prev_quote(line, col_start, quotechar, curbuf->b_p_qe); + if (line[col_start] != quotechar) + { + /* No quote before the cursor, look after the cursor. */ + col_start = find_next_quote(line, col_start, quotechar, NULL); + if (col_start < 0) + return FALSE; + } + + /* Find close quote character. */ + col_end = find_next_quote(line, col_start + 1, quotechar, + curbuf->b_p_qe); + if (col_end < 0) + return FALSE; + } + + /* When "include" is TRUE, include spaces after closing quote or before + * the starting quote. */ + if (include) + { + if (vim_iswhite(line[col_end + 1])) + while (vim_iswhite(line[col_end + 1])) + ++col_end; + else + while (col_start > 0 && vim_iswhite(line[col_start - 1])) + --col_start; + } + + /* Set start position */ + if (!include) + ++col_start; + curwin->w_cursor.col = col_start; +#ifdef FEAT_VISUAL + if (VIsual_active) + { + if (vis_empty) + { + VIsual = curwin->w_cursor; + redraw_curbuf_later(INVERTED); + } + } + else +#endif + { + oap->start = curwin->w_cursor; + oap->motion_type = MCHAR; + } + + /* Set end position. */ + curwin->w_cursor.col = col_end; + if (include && inc_cursor() == 2) + inclusive = TRUE; +#ifdef FEAT_VISUAL + if (VIsual_active) + { + if (vis_empty || vis_bef_curs) + { + /* decrement cursor when 'selection' is not exclusive */ + if (*p_sel != 'e') + dec_cursor(); + } + else + { + /* Cursor is at start of Visual area. */ + curwin->w_cursor.col = col_start; + } + if (VIsual_mode == 'V') + { + VIsual_mode = 'v'; + redraw_cmdline = TRUE; /* show mode later */ + } + } + else +#endif + { + /* Set inclusive and other oap's flags. */ + oap->inclusive = inclusive; + } + + return OK; +} + +#endif /* FEAT_TEXTOBJ */ #if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(FEAT_TEXTOBJ) \ || defined(PROTO) diff --git a/src/structs.h b/src/structs.h --- a/src/structs.h +++ b/src/structs.h @@ -1089,6 +1089,9 @@ struct file_buffer #ifdef FEAT_INS_EXPAND char_u *b_p_cpt; /* 'complete' */ #endif +#ifdef FEAT_COMPL_FUNC + char_u *b_p_cfu; /* 'completefunc' */ +#endif int b_p_eol; /* 'endofline' */ int b_p_et; /* 'expandtab' */ int b_p_et_nobin; /* b_p_et saved for binary mode */ @@ -1129,6 +1132,9 @@ struct file_buffer char_u *b_p_oft; /* 'osfiletype' */ #endif int b_p_pi; /* 'preserveindent' */ +#ifdef FEAT_TEXTOBJ + char_u *b_p_qe; /* 'quoteescape' */ +#endif int b_p_ro; /* 'readonly' */ long b_p_sw; /* 'shiftwidth' */ #ifndef SHORT_FNAME diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -6021,12 +6021,12 @@ init_highlight(both, reset) } /* - * Load color file "p". + * Load color file "name". * Return OK for success, FAIL for failure. */ int -load_colors(p) - char_u *p; +load_colors(name) + char_u *name; { char_u *buf; int retval = FAIL; @@ -6039,12 +6039,15 @@ load_colors(p) return OK; recursive = TRUE; - buf = alloc((unsigned)(STRLEN(p) + 12)); + buf = alloc((unsigned)(STRLEN(name) + 12)); if (buf != NULL) { - sprintf((char *)buf, "colors/%s.vim", p); + sprintf((char *)buf, "colors/%s.vim", name); retval = cmd_runtime(buf, FALSE); vim_free(buf); +#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_COLORSCHEME, NULL, NULL, FALSE, curbuf); +#endif } recursive = FALSE; diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -23,7 +23,7 @@ SCRIPTS = test1.out test3.out test4.out test33.out test34.out test35.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out + test48.out test51.out test53.out .SUFFIXES: .in .out @@ -95,3 +95,4 @@ test46.out: test46.in test47.out: test47.in test48.out: test48.in test51.out: test51.in +test53.out: test53.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -17,7 +17,7 @@ SCRIPTS16 = test1.out test19.out test20. test23.out test24.out test28.out test29.out \ test35.out test36.out test43.out \ test44.out test45.out test46.out test47.out \ - test48.out test51.out + test48.out test51.out test53.out SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test8.out test9.out test11.out test13.out test14.out \ diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -23,7 +23,7 @@ SCRIPTS = test1.out test3.out test4.out test33.out test34.out test35.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out + test48.out test51.out test53.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2004 May 03 +# Last change: 2004 Jul 02 # # This has been tested on VMS 6.2 to 7.2 on DEC Alpha and VAX. # Edit the lines in the Configuration section below to select. @@ -57,7 +57,7 @@ SCRIPT = test1.out test2.out test3.out test33.out test34.out test35.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out test46.out \ - test48.out test51.out + test48.out test51.out test53.out .IFDEF WANT_GUI SCRIPT_GUI = test16.out diff --git a/src/testdir/Makefile b/src/testdir/Makefile --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -13,7 +13,7 @@ SCRIPTS = test1.out test2.out test3.out test33.out test34.out test35.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out test46.out test47.out \ - test48.out test49.out test51.out test52.out + test48.out test49.out test51.out test52.out test53.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test53.in b/src/testdir/test53.in new file mode 100644 --- /dev/null +++ b/src/testdir/test53.in @@ -0,0 +1,24 @@ +Tests for string text objects. vim: set ft=vim : + +STARTTEST +:so small.vim +/^start:/ +da" +0va'a'rx +02f`da` +0fXdi" +03f'vi'ry +:set quoteescape=+*- +di` +$F"va"oha"i"rz +:/^start:/,/^end:/wq! test.out +ENDTEST + +start: "wo\"rd\\" foo +'foo' 'bar' 'piep' +bla bla `quote` blah +out " in "noXno" +"'" 'blah' rep 'buh' +bla `s*`d-`+++`l**` b`la +voo "nah" sdf " asdf" sdf " sdf" sd +end: diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok new file mode 100644 --- /dev/null +++ b/src/testdir/test53.ok @@ -0,0 +1,8 @@ +start: foo +xxxxxxxxxxxx'piep' +bla bla blah +out " in "" +"'" 'blah'yyyyy'buh' +bla `` b`la +voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd +end: diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -1012,6 +1012,7 @@ enum auto_event EVENT_BUFWRITECMD, /* write buffer using command */ EVENT_CMDWINENTER, /* after entering the cmdline window */ EVENT_CMDWINLEAVE, /* before leaving the cmdline window */ + EVENT_COLORSCHEME, /* after loading a colorscheme */ EVENT_FILEAPPENDPOST, /* after appending to a file */ EVENT_FILEAPPENDPRE, /* before appending to a file */ EVENT_FILEAPPENDCMD, /* appende to a file using command */