diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-07-26 12:53:41 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-07-26 12:53:41 +0000 |
commit | 5eb86f91992f5291b8b472d3e1be1888508777e6 (patch) | |
tree | 15dcd4c748c38e99951e79d02eb1b93f3a6d3db9 | |
parent | 89cb5e0f646970371359c70927bf3a0cdaf47f27 (diff) | |
download | vim-git-5eb86f91992f5291b8b472d3e1be1888508777e6.tar.gz |
updated for version 7.0012v7.0012
42 files changed, 1373 insertions, 659 deletions
@@ -148,8 +148,8 @@ SRC_UNIX = \ src/gui_gtk_f.h \ src/gui_gtk_x11.c \ src/gui_kde.cc \ - src/gui_kde_widget.cc \ - src/gui_kde_widget.h \ + src/gui_kde_wid.cc \ + src/gui_kde_wid.h \ src/gui_kde_x11.cc \ src/kvim_iface.h \ src/gui_motif.c \ @@ -365,7 +365,7 @@ SRC_MAC = \ src/os_mac.sit.hqx \ src/os_mac_conv.c \ src/os_macosx.c \ - src/os_mac.pbproj/project.pbxproj + src/os_mac.pbproj/project.pbxproj \ src/proto/gui_mac.pro \ src/proto/os_mac.pro \ diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 69b92d84c..8a6b8d411 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 7.0aa. Last change: 2004 Jul 11 +*diff.txt* For Vim version 7.0aa. Last change: 2004 Jul 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -344,6 +344,10 @@ get an error message. Possible causes: If it's not clear what the problem is set the 'verbose' option to see more messages. +The self-installing Vim includes a diff program. If you don't have it you +might want to download a diff.exe. For example from +http://jlb.twu.net/code/unixkit.php. + USING PATCHES *diff-patchexpr* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0e68dfa7e..c277ddea8 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 19 +*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -846,8 +846,10 @@ getbufvar( {expr}, {varname}) variable {varname} in buffer {expr} getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line getcwd() String the current working directory -getfsize( {fname}) Number size in bytes of file +getfperm( {fname}) String file permissions of file {fname} +getfsize( {fname}) Number size in bytes of file {fname} getftime( {fname}) Number last modification time of file +getftype( {fname}) String description of type of file {fname} getline( {lnum}) String line {lnum} from current buffer getreg( [{regname}]) String contents of register getregtype( [{regname}]) String type of register @@ -1580,6 +1582,20 @@ getfsize({fname}) *getfsize()* If {fname} is a directory, 0 is returned. If the file {fname} can't be found, -1 is returned. +getfperm({fname}) *getfperm()* + The result is a String, which is the read, write, and execute + permissions of the given file {fname}. + If {fname} does not exist or its directory cannot be read, an + empty string is returned. + The result is of the form "rwxrwxrwx", where each group of + "rwx" flags represent, in turn, the permissions of the owner + of the file, the group the file belongs to, and other users. + If a user does not have a given permission the flag for this + is replaced with the string "-". Example: > + :echo getfperm("/etc/passwd") +< This will hopefully (from a security point of view) display + the string "rw-r--r--" or even "rw-------". + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -1587,6 +1603,26 @@ getftime({fname}) *getftime()* |localtime()| and |strftime()|. If the file {fname} can't be found -1 is returned. +getftype({fname}) *getftype()* + The result is a String, which is a description of the kind of + file of the given file {fname}. + If {fname} does not exist an empty string is returned. + Here is a table over different kinds of files and their + results: + Normal file "file" + Directory "dir" + Symbolic link "link" + Block device "bdev" + Character device "cdev" + Socket "socket" + FIFO "fifo" + All other "other" + Example: > + getftype("/home") +< Note that a type such as "link" will only be returned on + systems that support it. On some systems only "dir" and + "file" are returned. + *getline()* getline({lnum}) The result is a String, which is line {lnum} from the current buffer. Example: > @@ -2246,14 +2282,16 @@ search({pattern} [, {flags}]) *search()* cursor position. {flags} is a String, which can contain these character flags: 'b' search backward instead of forward + 'n' do Not move the cursor 'w' wrap around the end of the file 'W' don't wrap around the end of the file If neither 'w' or 'W' is given, the 'wrapscan' option applies. - When a match has been found its line number is returned, and - the cursor will be positioned at the match. If there is no - match a 0 is returned and the cursor doesn't move. No error - message is given. + When a match has been found its line number is returned. + The cursor will be positioned at the match, unless the 'n' + flag is used). + If there is no match a 0 is returned and the cursor doesn't + move. No error message is given. Example (goes over all files in the argument list): > :let n = 1 @@ -2747,9 +2785,15 @@ winline() The result is a Number, which is the screen line of the cursor the window. The first line is one. *winnr()* -winnr() The result is a Number, which is the number of the current - window. The top window has number 1. The number can be used - with |CTRL-W_w| and ":wincmd w" |:wincmd|. +winnr([{arg}]) The result is a Number, which is the number of the current + window. The top window has number 1. + When the optional argument is "$", the number of the + last window is returnd (the window count). + When the optional argument is "#", the number of the last + accessed window is returned (where |CTRL-W_p| goes to). + If there is no previous window 0 is returned. + The number can be used with |CTRL-W_w| and ":wincmd w" + |:wincmd|. *winrestcmd()* winrestcmd() Returns a sequence of |:resize| commands that should restore diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 44ff66c1d..7754f209d 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -1,4 +1,4 @@ -*if_cscop.txt* For Vim version 7.0aa. Last change: 2004 Jan 17 +*if_cscop.txt* For Vim version 7.0aa. Last change: 2004 Jul 23 VIM REFERENCE MANUAL by Andy Kahn @@ -335,6 +335,9 @@ cscope version for Win32 see: http://iamphet.nm.ru/cscope/index.html +The DJGPP-built version from http://cscope.sourceforge.net is known to not +work with Vim. + There are a couple of hard-coded limitations: 1. The maximum number of cscope connections allowed is 8. Do you diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index df75fcf56..d26461c85 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 7.0aa. Last change: 2004 Feb 28 +*if_pyth.txt* For Vim version 7.0aa. Last change: 2004 Jul 25 VIM REFERENCE MANUAL by Paul Moore @@ -91,23 +91,23 @@ module before using it: > :python import vim Overview > - print "Hello" # displays a message - vim.command(cmd) # execute an ex command - w = vim.windows[n] # gets window "n" - cw = vim.current.window # gets the current window - b = vim.buffers[n] # gets buffer "n" - cb = vim.current.buffer # gets the current buffer - w.height = lines # sets the window height - w.cursor = (row, col) # sets the window cursor position - pos = w.cursor # gets a tuple (row, col) - name = b.name # gets the buffer file name - line = b[n] # gets a line from the buffer - lines = b[n:m] # gets a list of lines - num = len(b) # gets the number of lines - b[n] = str # sets a line in the buffer - b[n:m] = [str1, str2, str3] # sets a number of lines at once - del b[n] # deletes a line - del b[n:m] # deletes a number of lines + :py print "Hello" # displays a message + :py vim.command(cmd) # execute an ex command + :py w = vim.windows[n] # gets window "n" + :py cw = vim.current.window # gets the current window + :py b = vim.buffers[n] # gets buffer "n" + :py cb = vim.current.buffer # gets the current buffer + :py w.height = lines # sets the window height + :py w.cursor = (row, col) # sets the window cursor position + :py pos = w.cursor # gets a tuple (row, col) + :py name = b.name # gets the buffer file name + :py line = b[n] # gets a line from the buffer + :py lines = b[n:m] # gets a list of lines + :py num = len(b) # gets the number of lines + :py b[n] = str # sets a line in the buffer + :py b[n:m] = [str1, str2, str3] # sets a number of lines at once + :py del b[n] # deletes a line + :py del b[n:m] # deletes a number of lines Methods of the "vim" module @@ -115,8 +115,8 @@ Methods of the "vim" module vim.command(str) *python-command* Executes the vim (ex-mode) command str. Returns None. Examples: > - vim.command("set tw=72") - vim.command("%s/aaa/bbb/g") + :py vim.command("set tw=72") + :py vim.command("%s/aaa/bbb/g") < The following definition executes Normal mode commands: > def normal(str): vim.command("normal "+str) @@ -126,15 +126,15 @@ vim.command(str) *python-command* < *E659* The ":python" command cannot be used recursively with Python 2.2 and older. This only works with Python 2.3 and later: > - :python vim.command("python print 'Hello again Python'") + :py vim.command("python print 'Hello again Python'") vim.eval(str) *python-eval* Evaluates the expression str using the vim internal expression evaluator (see |expression|). Returns the expression result as a string. Examples: > - text_width = vim.eval("&tw") - str = vim.eval("12+12") # NB result is a string! Use + :py text_width = vim.eval("&tw") + :py str = vim.eval("12+12") # NB result is a string! Use # string.atoi() to convert to # a number. @@ -158,18 +158,18 @@ Constants of the "vim" module vim.buffers *python-buffers* A sequence object providing access to the list of vim buffers. The object supports the following operations: > - b = vim.buffers[i] # Indexing (read-only) - b in vim.buffers # Membership test - n = len(vim.buffers) # Number of elements - for b in vim.buffers: # Sequential access + :py b = vim.buffers[i] # Indexing (read-only) + :py b in vim.buffers # Membership test + :py n = len(vim.buffers) # Number of elements + :py for b in vim.buffers: # Sequential access < vim.windows *python-windows* A sequence object providing access to the list of vim windows. The object supports the following operations: > - w = vim.windows[i] # Indexing (read-only) - w in vim.windows # Membership test - n = len(vim.windows) # Number of elements - for w in vim.windows: # Sequential access + :py w = vim.windows[i] # Indexing (read-only) + :py w in vim.windows # Membership test + :py n = len(vim.windows) # Number of elements + :py for w in vim.windows: # Sequential access < vim.current *python-current* An object providing access (via specific attributes) to various @@ -236,17 +236,21 @@ The buffer object methods are: represents the part of the given buffer between line numbers s and e |inclusive|. +Note that when adding a line it must not contain a line break character '\n'. +A trailing '\n' is allowed and ignored, so that you can do: > + :py b.append(f.readlines()) + Examples (assume b is the current buffer) > - print b.name # write the buffer file name - b[0] = "hello!!!" # replace the top line - b[:] = None # delete the whole buffer - del b[:] # delete the whole buffer (same as above) - b[0:0] = [ "a line" ] # add a line at the top - del b[2] # delete a line (the third) - b.append("bottom") # add a line at the bottom - n = len(b) # number of lines - (row,col) = b.mark('a') # named mark - r = b.range(1,5) # a sub-range of the buffer + :py print b.name # write the buffer file name + :py b[0] = "hello!!!" # replace the top line + :py b[:] = None # delete the whole buffer + :py del b[:] # delete the whole buffer + :py b[0:0] = [ "a line" ] # add a line at the top + :py del b[2] # delete a line (the third) + :py b.append("bottom") # add a line at the bottom + :py n = len(b) # number of lines + :py (row,col) = b.mark('a') # named mark + :py r = b.range(1,5) # a sub-range of the buffer ============================================================================== 4. Range objects *python-range* diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index b5973b031..62044e5cd 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 7.0aa. Last change: 2004 Jan 17 +*message.txt* For Vim version 7.0aa. Last change: 2004 Jul 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -643,6 +643,7 @@ and |+X11| features. A command line started with a backslash or the range of a command contained a backslash in a wrong place. This is often caused by command-line continuation being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it. +Or use ":set nocp". *E471* > Argument required diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index a3e73b394..4df3543fd 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 7.0aa. Last change: 2004 Jul 02 +*motion.txt* For Vim version 7.0aa. Last change: 2004 Jul 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -83,6 +83,7 @@ are however, two general exceptions: end of the motion is moved to the end of the previous line and the motion becomes inclusive. Example: "}" moves to the first line after a paragraph, but "d}" will not include that line. + *exclusive-linewise* 2. If the motion is exclusive, the end of the motion is in column 1 and the start of the motion was at or before the first non-blank in the line, the motion becomes linewise. Example: If a paragraph begins with some blanks @@ -424,20 +425,24 @@ between Vi and Vim. *]]* ]] [count] sections forward or to the next '{' in the - first column. When used after an operator, then the - '}' in the first column. |linewise| + first column. When used after an operator, then also + stops below a '}' in the first column. |exclusive| + Note that |exclusive-linewise| often applies. *][* ][ [count] sections forward or to the next '}' in the - first column. |linewise| + first column. |exclusive| + Note that |exclusive-linewise| often applies. *[[* [[ [count] sections backward or to the previous '{' in - the first column. |linewise| + the first column. |exclusive| + Note that |exclusive-linewise| often applies. *[]* [] [count] sections backward or to the previous '}' in - the first column. |linewise| + the first column. |exclusive| + Note that |exclusive-linewise| often applies. These commands move over three kinds of text objects. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index be83ae181..f94b52a4a 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 15 +*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3924,7 +3924,7 @@ A jump table for the options with a short description can be found at |Q_op|. NOTE: To avoid portability problems with using patterns, always keep this option at the default "on". Only switch it off when working with old Vi scripts. In any other situation write patterns that work when - 'magic' is on. + 'magic' is on. Include "\M" when you want to |/\M|. *'makeef'* *'mef'* 'makeef' 'mef' string (default: "") diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index caa5a00d7..04eef7f7e 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.0aa. Last change: 2004 May 09 +*pattern.txt* For Vim version 7.0aa. Last change: 2004 Jul 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -382,7 +382,7 @@ More explanation and examples below, follow the links. |/\%c| \%23c \%23c in column 23 |/zero-width| |/\%v| \%23v \%23v in virtual column 23 |/zero-width| -Character classes {not in Vi}: +Character classes {not in Vi}: */character-classes* |/\i| \i \i identifier character (see 'isident' option) |/\I| \I \I like "\i", but excluding digits |/\k| \k \k keyword character (see 'iskeyword' option) diff --git a/runtime/doc/tags b/runtime/doc/tags index 528b8a932..98a40e6cb 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1337,6 +1337,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* /atom pattern.txt /*\/atom* /bar pattern.txt /*\/bar* /branch pattern.txt /*\/branch* +/character-classes pattern.txt /*\/character-classes* /collection pattern.txt /*\/collection* /concat pattern.txt /*\/concat* /dyn various.txt /*\/dyn* @@ -3570,6 +3571,7 @@ EncodingChanged autocmd.txt /*EncodingChanged* Eterm syntax.txt /*Eterm* Ex intro.txt /*Ex* Ex-mode intro.txt /*Ex-mode* +Exuberant_ctags tagsrch.txt /*Exuberant_ctags* F motion.txt /*F* FAQ intro.txt /*FAQ* Farsi farsi.txt /*Farsi* @@ -4518,6 +4520,7 @@ except-syntax-error eval.txt /*except-syntax-error* exception-handling eval.txt /*exception-handling* exception-variable eval.txt /*exception-variable* exclusive motion.txt /*exclusive* +exclusive-linewise motion.txt /*exclusive-linewise* executable() eval.txt /*executable()* execute-menus gui.txt /*execute-menus* exim starting.txt /*exim* @@ -4625,6 +4628,7 @@ filewritable() eval.txt /*filewritable()* filter change.txt /*filter* find-manpage usr_12.txt /*find-manpage* find-replace usr_10.txt /*find-replace* +finddir() eval.txt /*finddir()* findfile() eval.txt /*findfile()* fixed-5.1 version5.txt /*fixed-5.1* fixed-5.2 version5.txt /*fixed-5.2* @@ -4773,8 +4777,10 @@ getcharmod() eval.txt /*getcharmod()* getcmdline() eval.txt /*getcmdline()* getcmdpos() eval.txt /*getcmdpos()* getcwd() eval.txt /*getcwd()* +getfperm() eval.txt /*getfperm()* getfsize() eval.txt /*getfsize()* getftime() eval.txt /*getftime()* +getftype() eval.txt /*getftype()* getline() eval.txt /*getline()* getreg() eval.txt /*getreg()* getregtype() eval.txt /*getregtype()* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 7787e0e2a..e148bff2a 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 7.0aa. Last change: 2004 Apr 29 +*tagsrch.txt* For Vim version 7.0aa. Last change: 2004 Jul 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -468,6 +468,7 @@ a tag for each "#defined" macro, typedefs, enums, etc. Some programs that generate tags files: ctags As found on most Unix systems. Only supports C. Only does the basic work. + *Exuberant_ctags* exuberant ctags This a very good one. It works for C, C++, Java, Fortran, Eiffel and others. It can generate tags for many items. See http://ctags.sourceforge.net. diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 9f3b61595..602a0b8d3 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 19 +*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,27 +30,18 @@ be worked on, but only if you sponsor Vim development. See |sponsor|. *known-bugs* -------------------- Known bugs and current work ----------------------- -Add fix for zh_cn to Vim 6.3? (Liang) +Aborting at the ATTENTION prompt causes trouble: + buffer remains active, nwindows isn't closed (fixed in buffer.c) + alternate buffer gets "read error" flag. + ":sbuf" and ":ball" leave an empty window behind. +Change in handle_swap_exists() also in 6.3? For version 7.0: - Include many PATCHES: 8 Add functions: - realname() Get user name (first, last, full) - user_fullname() patch by Nikolai Weibull, Nov - 3 2002) - getfperm() file permissions, in form "rwxrwxrwx" - (patch from Nikolai Weibull 2003 Jan 13) - getftype() "file", "dir", "link", "other"? - (patch from Nikolai Weibull 2003 Jan 13) setbufline() set line in any buffer (patch from Yegappan Lakshmanan, 2003 Jan 21) - winnr("$") Get number of windows. (patch from Nikolai - Weibull 2003 Jan 13) (another patch from - Yegappan Lakshmanan, 2004 Jul 11) - search() Add optional offset argument. - Add 'n' flag. (patch from Nikolai Weibull - 2003 Jan 13) filter() Patch from Yegappan Lakshmanan, 2004 Jul 11 8 Make it possible to delete marks. Charles Campbell has a patch that does this with the markclear() function (2004 Jan 9). @@ -63,6 +54,7 @@ For version 7.0: When "filename" has no wildcards and there is no matching buffer, add the buffer (unlisted). Patch for \xnn (Ciaran McCreesh) 2004 Jul 10 + http://dev.gentoo.org/~ciaranm/patches/vim/vim-7.00a-regexp-numbered-characters-r5.patch 7 Add 'taglistfiles' option, show file name and type when listing matching tags name with CTRL-D completion. Patch from Yegappan Lakshmanan. 2004 Jul 11 @@ -72,6 +64,15 @@ For version 7.0: 8 Make 'statusline' local, so that each window can have a different value. But should it also be local to a buffer? (Yegappan Lakshmanan has a patch, 2004 Jul 11) + 8 Add buffer-local autocommands? Reduces overhead for autocommands that + trigger often (inserting a character, switching mode). + :au Event <buffer> do-something + E.g.: + :au BufEnter <buffer> menu enable ... + :au BufLeave <buffer> menu disable ... + Patch from Yakov Lerner, including test (2004 Jan 7). + VimResized - When the Vim window has been resized (SIGWINCH) + patch from Yakov Lerner, 2003 July 24. --- awaiting updated patch --- 7 Add patch from Wall for this one ( ~/Mail/oldmail/wall/in.00019 ): 'flipcase' variable: upper/lowercase pairs. @@ -84,18 +85,7 @@ For version 7.0: 8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible. Aric Blumer has a patch for this. He will update the patch for 6.3. - 8 Add buffer-local autocommands? Reduces overhead for autocommands that - trigger often (inserting a character, switching mode). - :au Event <buffer> do-something - E.g.: - :au BufEnter <buffer> menu enable ... - :au BufLeave <buffer> menu disable ... - Patch from Yakov Lerner, including test (2004 Jan 7). - He'll send updated patch. Autocommands: - VimResized - When the Vim window has been resized (SIGWINCH) - patch from Yakov Lerner, 2003 July 24. - He'll write documentation and send updated patch. 7 Completion of network shares, patch by Yasuhiro Matsumoto. Update 2004 Jun 17. How does this work? Missing comments. @@ -1458,6 +1448,14 @@ Built-in script language: 7 Add argument to winwidth() to subtract the space taken by 'foldcolumn', signs and/or 'number'. 8 Add functions: + search() Add optional offset argument. + realname() Get user name (first, last, full) + user_fullname() patch by Nikolai Weibull, Nov + 3 2002 + Only add this when also implemented for + non-Unix systems, otherwise a shell cmd could + be used. + get_user_name() gets login name. menuprop({name}, {idx}, {what}) Get menu property of menu {name} item {idx}. menuprop("", 1, "name") returns "File". @@ -3196,6 +3194,7 @@ Various improvements: column number. Can use the code of ":helpgrep". Also support using "**" in filename, so that a directory tree can be searched. + Also see the "minigrep.vim" script on www.vim.org. - Change ":fixdel" into option 'fixdel', t_del will be adjusted each time t_bs is set? (Webb) - "gc": goto character, move absolute character positions forward, also diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 006245f6b..38af1340b 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 19 +*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -127,6 +127,9 @@ byteidx(expr, nr) |byteidx()| Index of a character. (Ilya Sher) finddir(name) |finddir()| Find a directory in 'path'. findfile(name) |findfile()| Find a file in 'path'. (Johannes Zellner) +getfperm(fname) |getfperm()| Get file permission string. (Nikolai + Weibull) +getftype(fname) |getftype()| Get type of file. (Nikolai Weibull) repeat(expr, count) |repeat()| Repeat "expr" "count" times. (Christophe Poucet) tr(expr, from, to) |tr()| Translate characters. (Ron Aaron) @@ -187,6 +190,11 @@ For lisp indenting and matching parenthesis: (Sergey Khorev) Added the "count" argument to match(), matchend() and matchstr(). (Ilya Sher) +winnr() takes an optional "$" and "#" arguments. (Nikolai Weibull, Yegappan +Lakshmanan) + +Added 'n' flag to search(): don't move the cursor. (Nikolai Weibull) + ============================================================================== COMPILE TIME CHANGES *compile-changes-7* @@ -272,4 +280,13 @@ items. The default for 'helplang' was "zh" for both "zh_cn" and "zh_tw". Now use "cn" or "tw" as intended. +When 'bin' is set and 'eol' is not set then line2byte() added the line break +after the last line while it's not there. + +Using foldlevel() in a WinEnter autocommand may not work. Noticed when +resizing the GUI shell upon startup. + +Python: Using buffer.append(f.readlines()) didn't work. Allow appending a +string with a trailing newline. The newline is ignored. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/ftplugin/lprolog.vim b/runtime/ftplugin/lprolog.vim index 1e73f0c2d..cc28c6a97 100644 --- a/runtime/ftplugin/lprolog.vim +++ b/runtime/ftplugin/lprolog.vim @@ -1,10 +1,10 @@ " Vim settings file " Language: LambdaProlog (Teyjus) " Maintainer: Markus Mottl <markus@oefai.at> -" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/lprolog.vim -" Last Change: 2003 May 11 -" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) -" 2001 Sep 02 - initial release (MM) +" URL: http://www.oefai.at/~markus/vim/ftplugin/lprolog.vim +" Last Change: 2001 Oct 02 - fixed uncommenting bug (MM) +" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) +" 2001 Sep 02 - initial release (MM) " Only do these settings when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim index 96f2c0c78..c2bc20edc 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -1,12 +1,14 @@ " Vim settings file " Language: OCaml -" Maintainers: Mike Leary <leary@nwlink.com> -" Markus Mottl <markus@oefai.at> -" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/ocaml.vim -" Last Change: 2003 May 11 -" 2001 Nov 01 - added local bindings for inserting -" type holes using 'assert false' (MM) -" 2001 Oct 02 - insert spaces in line comments (MM) +" Maintainers: Mike Leary <leary@nwlink.com> +" Markus Mottl <markus@oefai.at> +" Stefano Zacchiroli <zack@bononia.it> +" URL: http://www.oefai.at/~markus/vim/ftplugin/ocaml.vim +" Last Change: 2004 Apr 12 - better .ml/.mli-switching without Python (SZ) +" 2003 Nov 21 - match_words-patterns and .ml/.mli-switching (MM) +" 2003 Oct 16 - re-entered variable 'did_ocaml_dtypes' (MM) +" 2003 Oct 15 - added Stefano Zacchirolis (SZ) Python-code for +" displaying type annotations (MM) " Only do these settings when not done yet for this buffer if exists("b:did_ftplugin") @@ -47,3 +49,253 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps") iabbrev <buffer> ASS (assert false) endif endif + +" Let % jump between structure elements (due to Issac Trotts) +let b:mw='\<let\>:\<and\>:\(\<in\>\|;;\),' +let b:mw=b:mw . '\<if\>:\<then\>:\<else\>,\<do\>:\<done\>,' +let b:mw=b:mw . '\<\(object\|sig\|struct\|begin\)\>:\<end\>' +let b:match_words=b:mw + +" switching between interfaces (.mli) and implementations (.ml) +if !exists("g:did_ocaml_switch") + let g:did_ocaml_switch = 1 + map ,s :call OCaml_switch(0)<CR> + map ,S :call OCaml_switch(1)<CR> + fun OCaml_switch(newwin) + if (match(bufname(""), "\\.mli$") >= 0) + let fname = substitute(bufname(""), "\\.mli$", ".ml", "") + if (a:newwin == 1) + exec "new " . fname + else + exec "arge " . fname + endif + elseif (match(bufname(""), "\\.ml$") >= 0) + let fname = bufname("") . "i" + if (a:newwin == 1) + exec "new " . fname + else + exec "arge " . fname + endif + endif + endfun +endif + +" Vim support for OCaml 3.07 .annot files (requires Vim with python support) +" +" Executing OCamlPrintType(<mode>) function will display in the Vim bottom +" line(s) the type of an ocaml value getting it from the corresponding .annot +" file (if any). If Vim is in visual mode, <mode> should be "visual" and the +" selected ocaml value correspond to the highlighted text, otherwise (<mode> +" can be anything else) it corresponds to the literal found at the current +" cursor position. +" +" .annot files are parsed lazily the first time OCamlPrintType is invoked; is +" also possible to force the parsing using the OCamlParseAnnot() function. +" +" Hitting the <F3> key will cause OCamlPrintType function to be invoked with +" the right argument depending on the current mode (visual or not). +" +" Copyright (C) <2003> Stefano Zacchiroli <zack@bononia.it> +" +" Created: Wed, 01 Oct 2003 18:16:22 +0200 zack +" LastModified: Mon, 06 Oct 2003 11:05:39 +0200 zack +" +" This program is free software; you can redistribute it and/or modify +" it under the terms of the GNU General Public License as published by +" the Free Software Foundation; either version 2 of the License, or +" (at your option) any later version. +" +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this program; if not, write to the Free Software +" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +" + +if !has("python") + echo "Python support not found: OCaml .annot support disabled" + finish +endif + +if !exists("g:did_ocaml_dtypes") + let g:did_ocaml_dtypes = 1 +else + finish +endif + +python << EOF + +import re +import os +import string +import time +import vim + +debug = False + +class AnnExc(Exception): + def __init__(self, reason): + self.reason = reason + +no_annotations = AnnExc("No type annotations (.annot) file found") +annotation_not_found = AnnExc("No type annotation found for the given text") +def malformed_annotations(lineno): + return AnnExc("Malformed .annot file (line = %d)" % lineno) + +class Annotations: + """ + .annot ocaml file representation + + File format (copied verbatim from caml-types.el) + + file ::= block * + block ::= position <SP> position <LF> annotation * + position ::= filename <SP> num <SP> num <SP> num + annotation ::= keyword open-paren <LF> <SP> <SP> data <LF> close-paren + + <SP> is a space character (ASCII 0x20) + <LF> is a line-feed character (ASCII 0x0A) + num is a sequence of decimal digits + filename is a string with the lexical conventions of O'Caml + open-paren is an open parenthesis (ASCII 0x28) + close-paren is a closed parenthesis (ASCII 0x29) + data is any sequence of characters where <LF> is always followed by + at least two space characters. + + - in each block, the two positions are respectively the start and the + - end of the range described by the block. + - in a position, the filename is the name of the file, the first num + is the line number, the second num is the offset of the beginning + of the line, the third num is the offset of the position itself. + - the char number within the line is the difference between the third + and second nums. + + For the moment, the only possible keyword is \"type\"." + """ + + def __init__(self): + self.__filename = None # last .annot parsed file + self.__ml_filename = None # as above but s/.annot/.ml/ + self.__timestamp = None # last parse action timestamp + self.__annot = {} + self.__re = re.compile( + '^"[^"]+"\s+(\d+)\s+(\d+)\s+(\d+)\s+"[^"]+"\s+(\d+)\s+(\d+)\s+(\d+)$') + + def __parse(self, fname): + try: + f = open(fname) + line = f.readline() # position line + lineno = 1 + while (line != ""): + m = self.__re.search(line) + if (not m): + raise malformed_annotations(lineno) + line1 = int(m.group(1)) + col1 = int(m.group(3)) - int(m.group(2)) + line2 = int(m.group(4)) + col2 = int(m.group(6)) - int(m.group(5)) + line = f.readline() # "type(" string + lineno += 1 + if (line == ""): raise malformed_annotations(lineno) + type = [] + line = f.readline() # type description + lineno += 1 + if (line == ""): raise malformed_annotations(lineno) + while line != ")\n": + type.append(string.strip(line)) + line = f.readline() + lineno += 1 + if (line == ""): raise malformed_annotations(lineno) + type = string.join(type, "\n") + self.__annot[(line1, col1), (line2, col2)] = type + line = f.readline() # position line + f.close() + self.__filename = fname + self.__ml_filename = re.sub("\.annot$", ".ml", fname) + self.__timestamp = int(time.time()) + except IOError: + raise no_annotations + + def parse(self): + annot_file = re.sub("\.ml$", ".annot", vim.current.buffer.name) + self.__parse(annot_file) + + def get_type(self, (line1, col1), (line2, col2)): + if debug: + print line1, col1, line2, col2 + if vim.current.buffer.name == None: + raise no_annotations + if vim.current.buffer.name != self.__ml_filename or \ + os.stat(self.__filename).st_mtime > self.__timestamp: + self.parse() + try: + return self.__annot[(line1, col1), (line2, col2)] + except KeyError: + raise annotation_not_found + +word_char_RE = re.compile("^[\w.]$") + + # TODO this function should recognize ocaml literals, actually it's just an + # hack that recognize continuous sequences of word_char_RE above +def findBoundaries(line, col): + """ given a cursor position (as returned by vim.current.window.cursor) + return two integers identify the beggining and end column of the word at + cursor position, if any. If no word is at the cursor position return the + column cursor position twice """ + left, right = col, col + line = line - 1 # mismatch vim/python line indexes + (begin_col, end_col) = (0, len(vim.current.buffer[line]) - 1) + try: + while word_char_RE.search(vim.current.buffer[line][left - 1]): + left = left - 1 + except IndexError: + pass + try: + while word_char_RE.search(vim.current.buffer[line][right + 1]): + right = right + 1 + except IndexError: + pass + return (left, right) + +annot = Annotations() # global annotation object + +def printOCamlType(mode): + try: + if mode == "visual": # visual mode: lookup highlighted text + (line1, col1) = vim.current.buffer.mark("<") + (line2, col2) = vim.current.buffer.mark(">") + else: # any other mode: lookup word at cursor position + (line, col) = vim.current.window.cursor + (col1, col2) = findBoundaries(line, col) + (line1, line2) = (line, line) + begin_mark = (line1, col1) + end_mark = (line2, col2 + 1) + print annot.get_type(begin_mark, end_mark) + except AnnExc, exc: + print exc.reason + +def parseOCamlAnnot(): + try: + annot.parse() + except AnnExc, exc: + print exc.reason + +EOF + +fun OCamlPrintType(current_mode) + if (a:current_mode == "visual") + python printOCamlType("visual") + else + python printOCamlType("normal") + endif +endfun + +fun OCamlParseAnnot() + python parseOCamlAnnot() +endfun + +map <F3> :call OCamlPrintType("normal")<RETURN> +vmap <F3> :call OCamlPrintType("visual")<RETURN> diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim index a26b4bc22..634d69326 100644 --- a/runtime/indent/ocaml.vim +++ b/runtime/indent/ocaml.vim @@ -1,12 +1,12 @@ " Vim indent file -" Language: OCaml -" Maintainers: Jean-Francois Yuen <jfyuen@ifrance.com> -" Mike Leary <leary@nwlink.com> -" Markus Mottl <markus@oefai.at> -" URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim -" Last Change: 2003 Apr 14 -" 2003 Mar 05 - Added '{<' and some fixes (JY) -" 2002 Nov 06 - Some fixes (JY) +" Language: OCaml +" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org> +" Mike Leary <leary@nwlink.com> +" Markus Mottl <markus@oefai.at> +" URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim +" Last Change: 2004 Apr 11 - Added indent for 'class' (JY) +" 2003 Sep 16 - Added 'private' as keyword (JY) +" 2003 Mar 29 - Fixed bug with 'if' and 'else' (JY) " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -16,7 +16,7 @@ let b:did_indent = 1 setlocal expandtab setlocal indentexpr=GetOCamlIndent() -setlocal indentkeys+=0=and,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0=;;,0=>\],0=\|\],0=\|,0=*),0=>},0},0\],0) +setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0;;,0>\],0\|\],0>},0\|,0},0\],0) setlocal nolisp setlocal nosmartindent setlocal textwidth=80 @@ -33,14 +33,13 @@ if exists("*GetOCamlIndent") endif " Define some patterns: -let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|;\|(\)\s*$' +let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|<-\|=\|;\|(\)\s*$' let s:letpat = '^\s*\(let\|type\|module\|class\|open\|exception\|val\|include\|external\)\>' let s:letlim = '\(\<\(sig\|struct\)\|;;\)\s*$' let s:lim = '^\s*\(exception\|external\|include\|let\|module\|open\|type\|val\)\>' let s:module = '\<\%(begin\|sig\|struct\|object\)\>' let s:obj = '^\s*\(constraint\|inherit\|initializer\|method\|val\)\>\|\<\(object\|object\s*(.*)\)\s*$' -let s:type = '^\s*\%(let\|type\)\>.*=' -let s:val = '^\s*\(val\|external\)\>.*:' +let s:type = '^\s*\%(class\|let\|type\)\>.*=' " Skipping pattern, for comments function s:SkipPattern(lnum, pat) @@ -75,7 +74,7 @@ endfunction " Indent 'let' function s:FindLet(pstart, pmid, pend) call search(a:pend, 'bW') - return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ "^\\s*let\\>.*=\\s*$\\|" . s:beflet')) + return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ s:beflet')) endfunction function GetOCamlIndent() @@ -97,8 +96,7 @@ function GetOCamlIndent() let line = getline(v:lnum) - " Indent if current line begins with 'end' - " for 'sig', 'struct', 'object' and 'begin': + " Indent if current line begins with 'end': if line =~ '^\s*end\>' return s:FindPair(s:module, '','\<end\>') @@ -118,27 +116,25 @@ function GetOCamlIndent() elseif line =~ '^\s*)' return s:FindPair('(', '',')') - " Indent if current line begins with 'let' - " and last line does not begin with 'let' or end with 'in' or ';;': + " Indent if current line begins with 'let': elseif line =~ '^\s*let\>' if lline !~ s:lim . '\|' . s:letlim . '\|' . s:beflet return s:FindLet(s:type, '','\<let\s*$') else return ind endif - " Indent if current line begins with 'type' - " and last line does not end with 'and' or ';;': - elseif line =~ '^\s*type\>' + " Indent if current line begins with 'class' or 'type': + elseif line =~ '^\s*\(class\|type\)\>' if lline !~ s:lim . '\|\<and\s*$\|' . s:letlim - return s:FindLet(s:type, '','\<type\s*$') + return s:FindLet(s:type, '','\<\(class\|type\)\s*$') else return ind endif " Indent for pattern matching: elseif line =~ '^\s*|' - if lline !~ '^\s*\(|\|\(match\|with\|type\)\>\)\|\<\(function\|parser\|with\)\s*$' + if lline !~ '^\s*\(|[^\]]\|\(match\|type\|with\)\>\)\|\<\(function\|parser\|private\|with\)\s*$' call search('|', 'bW') - return indent(searchpair('^\s*\(type\|match\)\>\|\<\(with\|function\|parser\)\s*$', '', '|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "\\[|\\||\\]" && getline(".") !~ "^\\s*|.*->"')) + return indent(searchpair('^\s*\(match\|type\)\>\|\<\(function\|parser\|private\|with\)\s*$', '', '^\s*|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") !~ "^\\s*|.*->"')) else return ind endif @@ -149,41 +145,35 @@ function GetOCamlIndent() else return ind endif - " Indent if current line begins with 'in' and previous - " line does not start with 'let' or 'and': + " Indent if current line begins with 'in': elseif line =~ '^\s*in\>' if lline !~ '^\s*\(let\|and\)\>' return s:FindPair('\<let\>', '', '\<in\>') else return ind endif - " Indent if current line begins with 'else' - " and previous line does not start with 'if', 'then' or 'else': + " Indent if current line begins with 'else': elseif line =~ '^\s*else\>' - if lline !~ '^\s*\(if\|else\|then\)\>' + if lline !~ '^\s*\(if\|then\)\>' return s:FindPair('\<if\>', '', '\<else\>') else return ind endif - " Indent if current line begins with 'then' - " and previous line does not start with 'if', 'then' or 'else': + " Indent if current line begins with 'then': elseif line =~ '^\s*then\>' - if lline !~ '^\s*\(if\|else\|then\)\>' + if lline !~ '^\s*\(if\|else\)\>' return s:FindPair('\<if\>', '', '\<then\>') else return ind endif - " Subtract a 'shiftwidth' if current line begins with 'and' and previous - " line does not start with 'let', 'and' or 'type' or end with 'end' - " (for classes): + " Indent if current line begins with 'and': elseif line =~ '^\s*and\>' if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$' return ind - &sw else return ind endif - " Indent if current line begins with 'with' - " and previous line does not start with 'match' or 'try': + " Indent if current line begins with 'with': elseif line =~ '^\s*with\>' if lline !~ '^\s*\(match\|try\)\>' return s:FindPair('\<\%(match\|try\)\>', '','\<with\>') @@ -193,35 +183,35 @@ function GetOCamlIndent() " Indent if current line begins with 'exception': elseif line =~ '^\s*exception\>' if lline !~ s:lim . '\|' . s:letlim - return indent(search(s:val . '\|^\s*\(external\|include\|open\|type\)\>', 'bW')) + return indent(search('^\s*\(\(external\|include\|open\|type\)\>\|val\>.*:\)', 'bW')) else return ind endif " Indent if current line begins with 'external': elseif line =~ '^\s*external\>' if lline !~ s:lim . '\|' . s:letlim - return indent(search(s:val . '\|^\s*\(exception\|include\|open\|type\)\>', 'bW')) + return indent(search('^\s*\(\(exception\|external\|include\|open\|type\)\>\|val\>.*:\)', 'bW')) else return ind endif " Indent if current line begins with 'include': elseif line =~ '^\s*include\>' if lline !~ s:lim . '\|' . s:letlim - return indent(search(s:val . '\|^\s*\(exception\|external\|open\|type\)\>', 'bW')) + return indent(search('^\s*\(\(exception\|external\|open\|type\)\>\|val\>.*:\)', 'bW')) else return ind endif " Indent if current line begins with 'open': elseif line =~ '^\s*open\>' if lline !~ s:lim . '\|' . s:letlim - return indent(search(s:val . '\|^\s*\(exception\|external\|include\|type\)\>', 'bW')) + return indent(search('^\s*\(\(exception\|external\|include\|type\)\>\|val\>.*:\)', 'bW')) else return ind endif " Indent if current line begins with 'val': elseif line =~ '^\s*val\>' if lline !~ '^\s*\(exception\|external\|include\|open\)\>\|' . s:obj . '\|' . s:letlim - return indent(search(s:val . '\|^\s*\(exception\|include\|initializer\|method\|open\|type\)\>', 'bW')) + return indent(search('^\s*\(\(exception\|include\|initializer\|method\|open\|type\|val\)\>\|external\>.*:\)', 'bW')) else return ind endif @@ -253,15 +243,10 @@ function GetOCamlIndent() else return ind endif - " Indent back to normal after comments: - elseif line =~ '^\s*\*)' - call search('\*)', 'bW') - return indent(searchpair('(\*', '', '\*)', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')) - endif " Add a 'shiftwidth' after lines ending with: - if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|struct\|sig\|functor\|initializer\|object\|try\|do\|if\|then\|else\|fun\|function\|parser\)\|\<object\s*(.*)\)\s*$' + if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$' let ind = ind + &sw " Back to normal indent after lines ending with ';;': diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 3c030f8d8..b5a0849f9 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -2,7 +2,7 @@ " Language: Python " Maintainer: Bram Moolenaar <Bram@vim.org> " Original Author: David Bustos <bustos@caltech.edu> -" Last Change: 2004 Jun 15 +" Last Change: 2004 Jul 25 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -99,15 +99,36 @@ function GetPythonIndent(lnum) " Use syntax highlighting attributes when possible. let pline = getline(plnum) let pline_len = strlen(pline) - let col = 0 - while col < pline_len - if pline[col] == '#' && (!has('syntax_items') - \ || synIDattr(synID(plnum, col + 1, 1), "name") =~ "Comment$") - let pline = strpart(pline, 0, col) - break + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$" + let min = 1 + let max = pline_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$" + let max = col + else + let min = col + 1 + endif + endwhile + echomsg min + let pline = strpart(pline, 0, min - 1) + echomsg pline + sleep 1 endif - let col = col + 1 - endwhile + else + let col = 0 + while col < pline_len + if pline[col] == '#' + let pline = strpart(pline, 0, col) + break + endif + let col = col + 1 + endwhile + endif " If the previous line ended with a colon, indent this line if pline =~ ':\s*$' diff --git a/runtime/syntax/dot.vim b/runtime/syntax/dot.vim index a2947aad9..64255000b 100644 --- a/runtime/syntax/dot.vim +++ b/runtime/syntax/dot.vim @@ -2,9 +2,9 @@ " Language: Dot " Filenames: *.dot " Maintainer: Markus Mottl <markus@oefai.at> -" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/dot.vim -" Last Change: 2003 May 11 -" 2001 May 04 - initial version +" URL: http://www.oefai.at/~markus/vim/syntax/dot.vim +" Last Change: 2004 Jul 26 +" 2001 May 04 - initial version " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded diff --git a/runtime/syntax/idl.vim b/runtime/syntax/idl.vim index cdb66ea01..855dc2172 100644 --- a/runtime/syntax/idl.vim +++ b/runtime/syntax/idl.vim @@ -1,203 +1,314 @@ " Vim syntax file -" Language: IDL (Interface Description Language) -" Maintainer: Jody Goldberg <jgoldberg@home.com> or <jody@gnome.org> -" Last Change: 2004 Jul 12 +" Language: IDL (Interface Description Language) +" Created By: Jody Goldberg <jody@gnome.org> +" Maintainer: Michael Geddes <michaelrgeddes@optushome.com.au> +" Last Change: 2004 Jul 20 " This is an experiment. IDL's structure is simple enough to permit a full " grammar based approach to rather than using a few heuristics. The result " is large and somewhat repetative but seems to work. -" 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") +" There are some Microsoft extensions to idl files that are here. Some of +" them are disabled by defining idl_no_ms_extensions. +" +" The more complex of the extensions are disabled by defining idl_no_extensions. +" + +if exists("b:current_syntax") finish endif +if exists("idlsyntax_showerror") + syn match idlError +\S+ skipwhite skipempty nextgroup=idlError +endif + +syn region idlCppQuote start='\<cpp_quote\s*(' end=')' contains=idlString + " Misc basic -syn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*" -syn match idlSemiColon contained ";" -syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDecl -syn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral -syn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlSemiColon,idlCommaArg,idlArraySize1 -syn region idlSting contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+ -syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\=" -syn match idlLiteral contained "\.\d\+" -syn keyword idlLiteral contained TRUE FALSE +syn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*" skipwhite skipempty nextgroup=idlEnumComma,idlEnumNumber +syn match idlEnumComma contained "," +syn match idlEnumNumber contained "=" skipwhite skipempty nextgroup=idlString,idlLiteral +syn match idlSemiColon contained ";" +syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDecl +syn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlError,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral +syn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlCommaArg,idlArraySize1 +syn region idlString contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+ +syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\=" +syn match idlLiteral contained "0" +syn match idlLiteral contained "\.\d\+" +syn match idlLiteral contained "0x[0-9A-Fa-f]\+" +syn match idlLiteral contained "0[0-7]\+" +syn keyword idlLiteral contained TRUE FALSE " Comments -syn keyword idlTodo contained TODO FIXME XXX -syn region idlComment start="/\*" end="\*/" contains=idlTodo -syn match idlComment "//.*" contains=idlTodo -syn match idlCommentError "\*/" +syn keyword idlTodo contained TODO FIXME XXX +syn region idlComment start="/\*" end="\*/" contains=idlTodo +syn match idlComment "//.*" contains=idlTodo +syn match idlCommentError "\*/" " C style Preprocessor -syn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+ -syn match idlIncluded contained "<[^>]*>" -syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString -syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentError -syn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral, idlString +syn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+ +syn match idlIncluded contained "<[^>]*>" +syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString +syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentError +syn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral,idlString " Constants -syn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt +syn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt " Attribute -syn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttr -syn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType +syn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttr +syn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType " Types -syn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral -syn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4 -syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDecl -syn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDecl -syn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeInt -syn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteral -syn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDecl -syn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl +syn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral +syn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4 +syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDecl +syn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDecl +syn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeInt +syn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteral +syn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDecl +syn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl " Modules -syn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule -syn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlSemiColon -syn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName +syn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule +syn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlError,idlSemiColon +syn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName " Interfaces -syn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlComment,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef -syn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom -syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent -syn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFrom -syn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlSemiColon -syn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceName +syn cluster idlCommentable contains=idlComment +syn cluster idlContentCluster contains=idlUnion,idlStruct,idlEnum,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlInterfaceSections + +syn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable +syn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom +syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent +syn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFrom +syn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlError,idlSemiColon +syn keyword idlInterface interface dispinterface skipempty skipwhite nextgroup=idlInterfaceName +syn keyword idlInterfaceSections contained properties methods skipempty skipwhite nextgroup=idlSectionColon,idlError +syn match idlSectionColon contained ":" + + +syn match idlLibraryName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlLibraryContent,idlError,idlSemiColon +syn keyword idlLibrary library skipempty skipwhite nextgroup=idlLibraryName +syn region idlLibraryContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlCommentable,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlImportlib,idlCoclass,idlTypedef,idlInterface + +syn keyword idlImportlib contained importlib skipempty skipwhite nextgroup=idlStringArg +syn region idlStringArg contained start="(" end=")" contains=idlString nextgroup=idlError,idlSemiColon,idlErrorBrace,idlErrorSquareBracket + +syn keyword idlCoclass coclass contained skipempty skipwhite nextgroup=idlCoclassName +syn match idlCoclassName "[a-zA-Z0-9_]\+" contained skipempty skipwhite nextgroup=idlCoclassDefinition,idlError,idlSemiColon + +syn region idlCoclassDefinition contained start="{" end="}" contains=idlCoclassAttributes,idlInterface,idlErrorBracket,idlErrorSquareBracket skipempty skipwhite nextgroup=idlError,idlSemiColon +syn region idlCoclassAttributes contained start=+\[+ end=+]+ skipempty skipwhite nextgroup=idlInterface contains=idlErrorBracket,idlErrorBrace,idlCoclassAttribute +syn keyword idlCoclassAttribute contained default source +"syn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceStubName + +syn match idlImportString +"\f\+"+ skipempty skipwhite nextgroup=idlError,idlSemiColon +syn keyword idlImport import skipempty skipwhite nextgroup=idlImportString + +syn region idlAttributes start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace,idlComment +syn keyword idlAttribute contained propput propget propputref id helpstring object uuid pointer_default +if !exists('idl_no_ms_extensions') +syn keyword idlAttribute contained nonextensible dual version aggregatable restricted hidden noncreatable oleautomation +endif +syn region idlAttributeParam contained start="(" end=")" contains=idlString,idlUuid,idlLiteral,idlErrorBrace,idlErrorSquareBracket +" skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral +syn match idlErrorBrace contained "}" +syn match idlErrorBracket contained ")" +syn match idlErrorSquareBracket contained "\]" +syn match idlUuid contained +[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}+ " Raises -syn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon +syn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon " Context -syn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon +syn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon " Operation -syn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms -syn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral -syn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySize -syn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmName -syn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmInt -syn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteral -syn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmName -syn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmName -syn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName -syn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmType - -syn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon contains=idlOpParms -syn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContents -syn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpName -syn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral -syn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpInt -syn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpName -syn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpName -syn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpName -syn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpName -syn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp +syn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms +syn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral +syn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySize +syn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmName +syn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmInt +syn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteral +syn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmName +syn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmName +syn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName +syn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmType + +if !exists('idl_no_ms_extensions') +syn keyword idlOpParms contained retval optional skipempty skipwhite nextgroup=idlParmType + syn match idlOpParms contained +\<\(iid_is\|defaultvalue\)\s*([^)]*)+ skipempty skipwhite nextgroup=idlParamType + + syn keyword idlVariantType contained BSTR VARIANT VARIANT_BOOL long short unsigned double CURRENCY DATE + syn region idlSafeArray contained matchgroup=idlVariantType start=+SAFEARRAY(\s*+ end=+)+ contains=idlVariantType +endif + +syn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon contains=idlOpParms,idlSafeArray,idlVariantType,@idlCommentable +syn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContents +syn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpName +syn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral +syn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpInt +syn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpName +syn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpName +syn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpName +syn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpName +syn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp " Enum -syn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlId,idlComment -syn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContents -syn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName +syn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlId,idlAttributes,@idlCommentable +syn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContents +syn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName,idlEnumContents " Typedef -syn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlBaseType, idlBaseTypeInt, idlSeqType +syn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlTypedefOtherTypeQualifier,idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError + +if !exists('idl_no_extensions') + syn keyword idlTypedefOtherTypeQualifier contained struct enum interface nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError skipwhite + + syn region idlDefAttributes contained start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace skipempty skipwhite nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlError + + syn keyword idlDefBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlTypedefDecl,idlError + syn keyword idlDefBaseTypeInt contained short long skipempty skipwhite nextgroup=idlTypedefDecl,idlError + syn match idlDefOtherType contained +\<\k\+\>+ skipempty nextgroup=idlTypedefDecl,idlError + " syn keyword idlDefSeqType contained sequence skipempty skipwhite nextgroup=idlD4 + + " Enum typedef + syn keyword idlDefEnum contained enum skipempty skipwhite nextgroup=idlDefEnumName,idlDefEnumContents + syn match idlDefEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlDefEnumContents,idlTypedefDecl + syn region idlDefEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlTypedefDecl contains=idlId,idlAttributes + + syn match idlTypedefDecl contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlError,idlSemiColon +endif " Struct -syn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlBaseType, idlBaseTypeInt, idlSeqType,idlComment, idlEnum, idlUnion -syn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent -syn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName +syn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlBaseType,idlBaseTypeInt,idlSeqType,@idlCommentable,idlEnum,idlUnion +syn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent +syn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName " Exception -syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName +syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName " Union -syn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt -syn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString -syn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabel -syn keyword idlCase contained default skipempty skipwhite nextgroup=idlColon -syn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon,idlSimpDecl contains=idlCase -syn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContent -syn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchType -syn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitch -syn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionName - -syn sync lines=200 - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_idl_syntax_inits") - if version < 508 - let did_idl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> +syn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt +syn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString +syn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabel +syn keyword idlCase contained default skipempty skipwhite nextgroup=idlColon +syn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlCase +syn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContent +syn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchType +syn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitch +syn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionName + +if !exists('idl_no_extensions') + syn sync match idlInterfaceSync grouphere idlInterfaceContent "\<\(disp\)\=interface\>\s\+\k\+\s*:\s*\k\+\_s*{" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable + syn sync maxlines=1000 minlines=100 +else + syn sync lines=200 +endif +" syn sync fromstart + +if !exists("did_idl_syntax_inits") + let did_idl_syntax_inits = 1 + " The default methods for highlighting. Can be overridden later + command -nargs=+ HiLink hi def link <args> + + HiLink idlInclude Include + HiLink idlPreProc PreProc + HiLink idlPreCondit PreCondit + HiLink idlDefine Macro + HiLink idlIncluded String + HiLink idlString String + HiLink idlComment Comment + HiLink idlTodo Todo + HiLink idlLiteral Number + HiLink idlUuid Number + HiLink idlType Type + HiLink idlVariantType idlType + + HiLink idlModule Keyword + HiLink idlInterface Keyword + HiLink idlEnum Keyword + HiLink idlStruct Keyword + HiLink idlUnion Keyword + HiLink idlTypedef Keyword + HiLink idlException Keyword + HiLink idlTypedefOtherTypeQualifier keyword + + HiLink idlModuleName Typedef + HiLink idlInterfaceName Typedef + HiLink idlEnumName Typedef + HiLink idlStructName Typedef + HiLink idlUnionName Typedef + + HiLink idlBaseTypeInt idlType + HiLink idlBaseType idlType + HiLink idlSeqType idlType + HiLink idlD1 Paren + HiLink idlD2 Paren + HiLink idlD3 Paren + HiLink idlD4 Paren + "HiLink idlArraySize Paren + "HiLink idlArraySize1 Paren + HiLink idlModuleContent Paren + HiLink idlUnionContent Paren + HiLink idlStructContent Paren + HiLink idlEnumContents Paren + HiLink idlInterfaceContent Paren + + HiLink idlSimpDecl Identifier + HiLink idlROAttr StorageClass + HiLink idlAttr Keyword + HiLink idlConst StorageClass + + HiLink idlOneWayOp StorageClass + HiLink idlOp idlType + HiLink idlParmType idlType + HiLink idlOpName Function + HiLink idlOpParms SpecialComment + HiLink idlParmName Identifier + HiLink idlInheritFrom Identifier + HiLink idlAttribute SpecialComment + + HiLink idlId Constant + "HiLink idlCase Keyword + HiLink idlCaseLabel Constant + + HiLink idlErrorBracket Error + HiLink idlErrorBrace Error + HiLink idlErrorSquareBracket Error + + HiLink idlImport Keyword + HiLink idlImportString idlString + HiLink idlCoclassAttribute StorageClass + HiLink idlLibrary Keyword + HiLink idlImportlib Keyword + HiLink idlCoclass Keyword + HiLink idlLibraryName Typedef + HiLink idlCoclassName Typedef + " hi idlLibraryContent guifg=red + HiLink idlTypedefDecl Typedef + HiLink idlDefEnum Keyword + HiLink idlDefv1Enum Keyword + HiLink idlDefEnumName Typedef + HiLink idlDefEnumContents Paren + HiLink idlDefBaseTypeInt idlType + HiLink idlDefBaseType idlType + HiLink idlDefSeqType idlType + HiLink idlInterfaceSections Label + + if exists("idlsyntax_showerror") + if exists("idlsyntax_showerror_soft") + hi default idlError guibg=#d0ffd0 + else + HiLink idlError Error + endif endif - - HiLink idlInclude Include - HiLink idlPreProc PreProc - HiLink idlPreCondit PreCondit - HiLink idlDefine Macro - HiLink idlIncluded String - HiLink idlString String - HiLink idlComment Comment - HiLink idlTodo Todo - HiLink idlLiteral Number - - HiLink idlModule Keyword - HiLink idlInterface Keyword - HiLink idlEnum Keyword - HiLink idlStruct Keyword - HiLink idlUnion Keyword - HiLink idlTypedef Keyword - HiLink idlException Keyword - - HiLink idlModuleName Typedef - HiLink idlInterfaceName Typedef - HiLink idlEnumName Typedef - HiLink idlStructName Typedef - HiLink idlUnionName Typedef - - HiLink idlBaseTypeInt idlType - HiLink idlBaseType idlType - HiLink idlSeqType idlType - HiLink idlD1 Paren - HiLink idlD2 Paren - HiLink idlD3 Paren - HiLink idlD4 Paren - "HiLink idlArraySize Paren - "HiLink idlArraySize1 Paren - HiLink idlModuleContent Paren - HiLink idlUnionContent Paren - HiLink idlStructContent Paren - HiLink idlEnumContents Paren - HiLink idlInterfaceContent Paren - - HiLink idlSimpDecl Identifier - HiLink idlROAttr StorageClass - HiLink idlAttr Keyword - HiLink idlConst StorageClass - - HiLink idlOneWayOp StorageClass - HiLink idlOp idlType - HiLink idlParmType idlType - HiLink idlOpName Function - HiLink idlOpParms StorageClass - HiLink idlParmName Identifier - HiLink idlInheritFrom Identifier - - HiLink idlId Constant - "HiLink idlCase Keyword - HiLink idlCaseLabel Constant - delcommand HiLink endif let b:current_syntax = "idl" -" vim: ts=8 +" vim: sw=2 et diff --git a/runtime/syntax/lilo.vim b/runtime/syntax/lilo.vim index a97bb9ca8..e3ba2af00 100644 --- a/runtime/syntax/lilo.vim +++ b/runtime/syntax/lilo.vim @@ -2,22 +2,23 @@ " This is a GENERATED FILE. Please always refer to source file at the URI below. " Language: lilo configuration (lilo.conf) " Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz> -" Last Change: 2003 May 04 +" Last Change: 2004-07-20 " URL: http://trific.ath.cx/Ftp/vim/syntax/lilo.vim + " Setup if version >= 600 - if exists("b:current_syntax") - finish - endif + if exists("b:current_syntax") + finish + endif else - syntax clear + syntax clear endif if version >= 600 - command -nargs=1 SetIsk setlocal iskeyword=<args> + command -nargs=1 SetIsk setlocal iskeyword=<args> else - command -nargs=1 SetIsk set iskeyword=<args> + command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,.,-,_ delcommand SetIsk @@ -34,23 +35,23 @@ syn match liloHexNumber "0[xX]\x\+" contained syn match liloDecNumberP "\d\+p\=" contained syn match liloSpecial contained "\\\(\"\|\\\|$\)" syn region liloString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=liloSpecial,liloEnviron -syn match liloLabel "\S\+" contained contains=liloSpecial,liloEnviron +syn match liloLabel :[^ "]\+: contained contains=liloSpecial,liloEnviron syn region liloPath start=+[$/]+ skip=+\\\\\|\\ \|\\$"+ end=+ \|$+ contained contains=liloSpecial,liloEnviron syn match liloDecNumberList "\(\d\|,\)\+" contained contains=liloDecNumber syn match liloDecNumberPList "\(\d\|[,p]\)\+" contained contains=liloDecNumberP,liloDecNumber syn region liloAnything start=+[^[:space:]#]+ skip=+\\\\\|\\ \|\\$+ end=+ \|$+ contained contains=liloSpecial,liloEnviron,liloString " Path -syn keyword liloOption backup bitmap boot disktab force-backup install keytable map message nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty +syn keyword liloOption backup bitmap boot disktab force-backup keytable map message nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty syn keyword liloKernelOpt initrd root nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty syn keyword liloImageOpt path loader table nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty syn keyword liloDiskOpt partition nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty " Other -syn keyword liloOption menu-scheme raid-extra-boot serial nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty -syn keyword liloOption default nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty +syn keyword liloOption menu-scheme raid-extra-boot serial install nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty +syn keyword liloOption bios-passes-dl nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty +syn keyword liloOption default label alias wmdefault nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty syn keyword liloKernelOpt ramdisk nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty -syn keyword liloImageOpt alias label nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty syn keyword liloImageOpt password range nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty syn keyword liloDiskOpt set type nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty @@ -67,19 +68,21 @@ syn keyword liloKernelOpt append nextgroup=liloEqString,liloEqStringComment,lilo syn keyword liloImageOpt fallback literal nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty " Hex number -syn keyword liloImageOpt map-drive to nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty +syn keyword liloImageOpt map-drive to boot-as nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty syn keyword liloDiskOpt bios normal hidden nextgroup=liloEqNumber,liloEqNumberComment,liloError skipwhite skipempty " Number list -syn keyword liloOption bmp-colors bmp-timer nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty +syn keyword liloOption bmp-colors nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty " Number list, some of the numbers followed by p -syn keyword liloOption bmp-table nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty +syn keyword liloOption bmp-table bmp-timer nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty " Flag syn keyword liloOption compact fix-table geometric ignore-table lba32 linear mandatory nowarn prompt +syn keyword liloOption bmp-retain el-torito-bootable-CD large-memory suppress-boot-time-BIOS-data syn keyword liloKernelOpt read-only read-write syn keyword liloImageOpt bypass lock mandatory optional restricted single-key unsafe +syn keyword liloImageOpt master-boot wmwarn wmdisable syn keyword liloDiskOpt change activate deactivate inaccessible reset " Image @@ -97,7 +100,7 @@ syn match liloEqNumberComment "#.*$" contained nextgroup=liloEqNumber,liloEqNumb syn match liloEqDecNumberComment "#.*$" contained nextgroup=liloEqDecNumber,liloEqDecNumberComment,liloError skipwhite skipempty syn match liloEqHexNumberComment "#.*$" contained nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty syn match liloEqStringComment "#.*$" contained nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty -syn match liloEqLabelComment "#.*$" contained nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty +syn match liloEqLabelStringComment "#.*$" contained nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty syn match liloEqNumberListComment "#.*$" contained nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty syn match liloEqDecNumberPListComment "#.*$" contained nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty syn match liloEqAnythingComment "#.*$" contained nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty @@ -109,7 +112,7 @@ syn match liloEqNumber "=" contained nextgroup=liloDecNumber,liloHexNumber,liloN syn match liloEqDecNumber "=" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty syn match liloEqHexNumber "=" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty syn match liloEqString "=" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty -syn match liloEqLabel "=" contained nextgroup=liloLabel,liloLabelComment,liloError skipwhite skipempty +syn match liloEqLabelString "=" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty syn match liloEqNumberList "=" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty syn match liloEqDecNumberPList "=" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty syn match liloEqAnything "=" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty @@ -121,74 +124,71 @@ syn match liloNumberComment "#.*$" contained nextgroup=liloDecNumber,liloHexNumb syn match liloDecNumberComment "#.*$" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty syn match liloHexNumberComment "#.*$" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty syn match liloStringComment "#.*$" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty -syn match liloLabelComment "#.*$" contained nextgroup=liloLabel,liloLabelComment,liloError skipwhite skipempty +syn match liloLabelStringComment "#.*$" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty syn match liloDecNumberListComment "#.*$" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty syn match liloDecNumberPListComment "#.*$" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty syn match liloAnythingComment "#.*$" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty " Define the default highlighting if version >= 508 || !exists("did_lilo_syntax_inits") - if version < 508 - let did_lilo_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink liloEqPath liloEquals - HiLink liloEqWord liloEquals - HiLink liloEqVga liloEquals - HiLink liloEqDecNumber liloEquals - HiLink liloEqHexNumber liloEquals - HiLink liloEqNumber liloEquals - HiLink liloEqString liloEquals - HiLink liloEqLabel liloEquals - HiLink liloEqAnything liloEquals - HiLink liloEquals Special - - HiLink liloError Error - - HiLink liloEqPathComment liloComment - HiLink liloEqVgaComment liloComment - HiLink liloEqDecNumberComment liloComment - HiLink liloEqHexNumberComment liloComment - HiLink liloEqStringComment liloComment - HiLink liloEqLabelComment liloComment - HiLink liloEqAnythingComment liloComment - HiLink liloPathComment liloComment - HiLink liloVgaComment liloComment - HiLink liloDecNumberComment liloComment - HiLink liloHexNumberComment liloComment - HiLink liloNumberComment liloComment - HiLink liloStringComment liloComment - HiLink liloLabelComment liloComment - HiLink liloAnythingComment liloComment - HiLink liloComment Comment - - HiLink liloDiskOpt liloOption - HiLink liloKernelOpt liloOption - HiLink liloImageOpt liloOption - HiLink liloOption Keyword - - HiLink liloDecNumber liloNumber - HiLink liloHexNumber liloNumber - HiLink liloDecNumberP liloNumber - HiLink liloNumber Number - HiLink liloString String - HiLink liloPath Constant - - HiLink liloSpecial Special - HiLink liloLabel Title - HiLink liloDecNumberList Special - HiLink liloDecNumberPList Special - HiLink liloAnything Normal - HiLink liloEnviron Identifier - HiLink liloVgaKeyword Identifier - HiLink liloImage Type - HiLink liloChRules Preproc - HiLink liloDisk Preproc - - delcommand HiLink + if version < 508 + let did_lilo_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink liloEqPath liloEquals + HiLink liloEqWord liloEquals + HiLink liloEqVga liloEquals + HiLink liloEqDecNumber liloEquals + HiLink liloEqHexNumber liloEquals + HiLink liloEqNumber liloEquals + HiLink liloEqString liloEquals + HiLink liloEqAnything liloEquals + HiLink liloEquals Special + + HiLink liloError Error + + HiLink liloEqPathComment liloComment + HiLink liloEqVgaComment liloComment + HiLink liloEqDecNumberComment liloComment + HiLink liloEqHexNumberComment liloComment + HiLink liloEqStringComment liloComment + HiLink liloEqAnythingComment liloComment + HiLink liloPathComment liloComment + HiLink liloVgaComment liloComment + HiLink liloDecNumberComment liloComment + HiLink liloHexNumberComment liloComment + HiLink liloNumberComment liloComment + HiLink liloStringComment liloComment + HiLink liloAnythingComment liloComment + HiLink liloComment Comment + + HiLink liloDiskOpt liloOption + HiLink liloKernelOpt liloOption + HiLink liloImageOpt liloOption + HiLink liloOption Keyword + + HiLink liloDecNumber liloNumber + HiLink liloHexNumber liloNumber + HiLink liloDecNumberP liloNumber + HiLink liloNumber Number + HiLink liloString String + HiLink liloPath Constant + + HiLink liloSpecial Special + HiLink liloLabel Title + HiLink liloDecNumberList Special + HiLink liloDecNumberPList Special + HiLink liloAnything Normal + HiLink liloEnviron Identifier + HiLink liloVgaKeyword Identifier + HiLink liloImage Type + HiLink liloChRules Preproc + HiLink liloDisk Preproc + + delcommand HiLink endif let b:current_syntax = "lilo" diff --git a/runtime/syntax/lprolog.vim b/runtime/syntax/lprolog.vim index 2cc42f9ed..7007f239f 100644 --- a/runtime/syntax/lprolog.vim +++ b/runtime/syntax/lprolog.vim @@ -2,10 +2,10 @@ " Language: LambdaProlog (Teyjus) " Filenames: *.mod *.sig " Maintainer: Markus Mottl <markus@oefai.at> -" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/lprolog.vim -" Last Change: 2003 May 11 -" 2001 Apr 26 - Upgraded for new Vim version -" 2000 Jun 5 - Initial release +" URL: http://www.oefai.at/~markus/vim/syntax/lprolog.vim +" Last Change: 2004 Jul 26 +" 2001 Apr 26 - Upgraded for new Vim version +" 2000 Jun 5 - Initial release " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim index 95534a489..b2ff18d88 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -2,12 +2,12 @@ " Language: OCaml " Filenames: *.ml *.mli *.mll *.mly " Maintainers: Markus Mottl <markus@oefai.at> -" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> -" Issac Trotts <<ijtrotts@ucdavis.edu> -" URL: http://www.oefai.at/~markus/vim/syntax/ocaml.vim -" Last Change: 2003 May 04 -" 2002 Oct 24 - Small fix for "module type" (MM) -" 2002 Jun 16 - Added "&&", "<" and ">" as operators (MM) +" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> +" Issac Trotts <ijtrotts@ucdavis.edu> +" URL: http://www.oefai.at/~markus/vim/syntax/ocaml.vim +" Last Change: 2004 Jul 26 +" 2003 Jan 19 - Added keyword "require" for scripting (MM) +" 2002 Oct 30 - New variable "ocaml_revised" (MM) " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -24,7 +24,7 @@ syn case match syn match ocamlComment "^#!.*" " Scripting directives -syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|trace\|untrace\|untrace_all\|print_depth\|print_length\)\>" +syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|require\|trace\|untrace\|untrace_all\|print_depth\|print_length\)\>" " lowercase identifier - the standard way to match syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ @@ -163,7 +163,7 @@ else syn match ocamlKeyChar "!" endif -syn keyword ocamlType array bool char exn float format int +syn keyword ocamlType array bool char exn float format format4 int syn keyword ocamlType list option string unit syn keyword ocamlOperator asr lor lsl lsr lxor mod not diff --git a/runtime/syntax/sml.vim b/runtime/syntax/sml.vim index b3c335b8b..5f6a86217 100644 --- a/runtime/syntax/sml.vim +++ b/runtime/syntax/sml.vim @@ -1,12 +1,12 @@ " Vim syntax file " Language: SML " Filenames: *.sml *.sig -" Maintainers: Markus Mottl <markus@oefai.at> -" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it> -" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/sml.vim -" Last Change: 2003 May 11 -" 2001 Nov 20 - Fixed small highlighting bug with modules (MM) -" 2001 Aug 29 - Fixed small highlighting bug (MM) +" Maintainers: Markus Mottl <markus@oefai.at> +" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it> +" URL: http://www.oefai.at/~markus/vim/syntax/sml.vim +" Last Change: 2004 Jul 26 +" 2001 Nov 20 - Fixed small highlighting bug with modules (MM) +" 2001 Aug 29 - Fixed small highlighting bug (MM) " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded diff --git a/src/Makefile b/src/Makefile index e080477d6..fade47f35 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1055,9 +1055,9 @@ LINKIT = @echo >/dev/null NONE_INSTALL = install_normal ### KDE GUI interface. -KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_widget.cc gui_kde_widget_moc.cc kvim_iface_skel.cc +KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_wid.cc gui_kde_wid_moc.cc kvim_iface_skel.cc KDE_OBJ = objects/gui.o objects/pty.o objects/gui_kde.o objects/gui_kde_x11.o \ - objects/gui_kde_widget.o objects/gui_kde_widget_moc.o \ + objects/gui_kde_wid.o objects/gui_kde_wid_moc.o \ objects/kvim_iface_skel.o KDE_DEFS = -DFEAT_GUI_KDE $(NARROW_PROTO) KDE_IPATH = $(GUI_INC_LOC) @@ -1201,7 +1201,7 @@ CARBONGUI_BUNDLE = $(VIMNAME).app CARBONGUI_TESTARG = VIMPROG=../$(CARBONGUI_BUNDLE)/Contents/MacOS/$(VIMTARGET) # All GUI files -ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_widget.cc gui_kde_x11.cc gui_kde_widget_moc.cc +ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_wid.cc gui_kde_x11.cc gui_kde_wid_moc.cc ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w16.pro gui_w32.pro gui_amiga.pro gui_photon.pro gui_kde.pro gui_kde_x11.pro # }}} @@ -2038,7 +2038,7 @@ clean celan: testclean -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c -rm -f conftest* *~ auto/link.sed -rm -rf $(GUI_BUNDLE) - -rm -f gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl + -rm -f gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl if test -d $(PODIR); then \ cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \ fi @@ -2393,17 +2393,17 @@ objects/gui_kde.o: gui_kde.cc objects/gui_kde_x11.o: gui_kde_x11.cc $(CCC) -o $@ gui_kde_x11.cc -objects/gui_kde_widget.o: gui_kde_widget.cc - $(MOC) -o gui_kde_widget_moc.cc gui_kde_widget.h +objects/gui_kde_wid.o: gui_kde_wid.cc + $(MOC) -o gui_kde_wid_moc.cc gui_kde_wid.h $(KDE_DIR)/bin/dcopidl kvim_iface.h > kvim_iface.kidl || ( rm -f kvim_iface.kidl ; /bin/false ) $(KDE_DIR)/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl - $(CCC) -o $@ gui_kde_widget.cc + $(CCC) -o $@ gui_kde_wid.cc -gui_kde_widget_moc.cc: objects/gui_kde_widget.o -objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc - $(CCC) -o $@ gui_kde_widget_moc.cc +gui_kde_wid_moc.cc: objects/gui_kde_wid.o +objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc + $(CCC) -o $@ gui_kde_wid_moc.cc -kvim_iface_skel.cc: objects/gui_kde_widget.o +kvim_iface_skel.cc: objects/gui_kde_wid.o objects/kvim_iface_skel.o: kvim_iface_skel.cc $(CCC) -o $@ kvim_iface_skel.cc @@ -2716,21 +2716,21 @@ objects/pty.o: pty.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ proto/gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h -objects/gui_kde.o: gui_kde.cc gui_kde_widget.h kvim_iface.h vim.h \ +objects/gui_kde.o: gui_kde.cc gui_kde_wid.h kvim_iface.h vim.h \ auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h -objects/gui_kde_widget.o: gui_kde_widget.cc gui_kde_widget.h kvim_iface.h \ +objects/gui_kde_wid.o: gui_kde_wid.cc gui_kde_wid.h kvim_iface.h \ vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h proto/../../pixmaps/alert.xpm proto/../../pixmaps/error.xpm \ proto/../../pixmaps/generic.xpm proto/../../pixmaps/info.xpm \ proto/../../pixmaps/quest.xpm -objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_widget.h kvim_iface.h vim.h \ +objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_wid.h kvim_iface.h vim.h \ auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h version.h ../runtime/vim32x32.xpm -objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc gui_kde_widget.h \ +objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc gui_kde_wid.h \ kvim_iface.h vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h option.h \ ex_cmds.h proto.h globals.h diff --git a/src/buffer.c b/src/buffer.c index 4d07eb63e..c2bc09473 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -216,6 +216,12 @@ open_buffer(read_stdin, eap) #endif curbuf->b_flags |= BF_READERR; +#ifdef FEAT_FOLDING + /* Need to update automatic folding. Do this before the autocommands, + * they may use the fold info. */ + foldUpdateAll(curwin); +#endif + #ifdef FEAT_AUTOCMD /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) @@ -263,11 +269,6 @@ open_buffer(read_stdin, eap) #endif } -#ifdef FEAT_FOLDING - /* Need to update automatic folding. */ - foldUpdateAll(curwin); -#endif - return retval; } @@ -408,8 +409,7 @@ close_buffer(win, buf, action) if (!buf_valid(buf)) return; # ifdef FEAT_EVAL - /* Autocommands may abort script processing. */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return; # endif @@ -538,7 +538,8 @@ buf_freeall(buf, del_buf, wipe_buf) return; } # ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + /* autocmds may abort script processing */ + if (aborting()) return; # endif @@ -669,8 +670,16 @@ goto_buffer(eap, start, dir, count) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { - /* Quitting means closing the split window, nothing else. */ + int old_got_int = got_int; + + /* Quitting means closing the split window, nothing else. + * Reset got_int here, because it causes aborting() to return TRUE + * which breaks closing a window. */ + got_int = FALSE; + win_close(curwin, TRUE); + + got_int |= old_got_int; swap_exists_action = SEA_NONE; } else @@ -688,6 +697,12 @@ goto_buffer(eap, start, dir, count) handle_swap_exists(old_curbuf) buf_T *old_curbuf; { + int old_got_int = got_int; + + /* Reset got_int here, because it causes aborting() to return TRUE which + * breaks closing a buffer. */ + got_int = FALSE; + if (swap_exists_action == SEA_QUIT) { /* User selected Quit at ATTENTION prompt. Go back to previous @@ -712,6 +727,7 @@ handle_swap_exists(old_curbuf) do_modelines(); } swap_exists_action = SEA_NONE; + got_int |= old_got_int; } #endif @@ -4226,26 +4242,28 @@ ex_buffer_all(eap) #endif set_curbuf(buf, DOBUF_GOTO); #ifdef FEAT_AUTOCMD -# ifdef FEAT_EVAL - /* Autocommands deleted the buffer or aborted script - * processing!!! */ - if (!buf_valid(buf) || aborting()) -# else if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */ -# endif { -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) +# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) swap_exists_action = SEA_NONE; -#endif +# endif break; } #endif #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (swap_exists_action == SEA_QUIT) { - /* User selected Quit at ATTENTION prompt; close this window. */ + int old_got_int = got_int; + + /* User selected Quit at ATTENTION prompt; close this window. + * Reset got_int here, because it causes aborting() to return + * TRUE which breaks closing a window. */ + got_int = FALSE; + win_close(curwin, TRUE); --open_wins; + + got_int |= old_got_int; swap_exists_action = SEA_NONE; } else @@ -4259,6 +4277,11 @@ ex_buffer_all(eap) (void)vgetc(); /* only break the file loading, not the rest */ break; } +#ifdef FEAT_EVAL + /* Autocommands deleted the buffer or aborted script processing!!! */ + if (aborting()) + break; +#endif } #ifdef FEAT_AUTOCMD --autocmd_no_enter; diff --git a/src/edit.c b/src/edit.c index 0ca698c3f..1e2aded13 100644 --- a/src/edit.c +++ b/src/edit.c @@ -2641,7 +2641,7 @@ ins_compl_next_buf(buf, flag) #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)); +static int expand_by_function __ARGS((linenr_T lnum, int col, char_u *base, char_u ***matches)); /* * Execute user defined complete function 'completefunc'. @@ -2665,7 +2665,7 @@ call_completefunc(line, base, col, preproc) args[0] = line; args[1] = base; args[2] = colbuf; - args[3] = preproc ? "1" : "0"; + args[3] = (char_u *)(preproc ? "1" : "0"); return call_vim_function(curbuf->b_p_cfu, 4, args, FALSE); } @@ -2676,7 +2676,7 @@ call_completefunc(line, base, col, preproc) */ static int expand_by_function(lnum, col, base, matches) - int lnum; + linenr_T lnum; int col; char_u *base; char_u ***matches; @@ -3528,7 +3528,7 @@ ins_complete(c) lenstr = call_completefunc(line, NULL, complete_col, 1); if (lenstr == NULL) return FAIL; - keeplen = atoi(lenstr); + keeplen = atoi((char *)lenstr); vim_free(lenstr); if (keeplen < 0) return FAIL; diff --git a/src/eval.c b/src/eval.c index b2955ff11..78513a230 100644 --- a/src/eval.c +++ b/src/eval.c @@ -295,8 +295,10 @@ static void f_getcharmod __ARGS((VAR argvars, VAR retvar)); static void f_getcmdline __ARGS((VAR argvars, VAR retvar)); static void f_getcmdpos __ARGS((VAR argvars, VAR retvar)); static void f_getcwd __ARGS((VAR argvars, VAR retvar)); +static void f_getfperm __ARGS((VAR argvars, VAR retvar)); static void f_getfsize __ARGS((VAR argvars, VAR retvar)); static void f_getftime __ARGS((VAR argvars, VAR retvar)); +static void f_getftype __ARGS((VAR argvars, VAR retvar)); static void f_getline __ARGS((VAR argvars, VAR retvar)); static void f_getreg __ARGS((VAR argvars, VAR retvar)); static void f_getregtype __ARGS((VAR argvars, VAR retvar)); @@ -751,7 +753,7 @@ call_vim_function(func, argc, argv, safe) if (argv[i] == NULL || *argv[i] == NUL) { argvars[i].var_type = VAR_STRING; - argvars[i].var_val.var_string = ""; + argvars[i].var_val.var_string = (char_u *)""; continue; } @@ -2853,8 +2855,10 @@ static struct fst {"getcmdline", 0, 0, f_getcmdline}, {"getcmdpos", 0, 0, f_getcmdpos}, {"getcwd", 0, 0, f_getcwd}, + {"getfperm", 1, 1, f_getfperm}, {"getfsize", 1, 1, f_getfsize}, {"getftime", 1, 1, f_getftime}, + {"getftype", 1, 1, f_getftype}, {"getline", 1, 1, f_getline}, {"getreg", 0, 1, f_getreg}, {"getregtype", 0, 1, f_getregtype}, @@ -2941,7 +2945,7 @@ static struct fst {"wincol", 0, 0, f_wincol}, {"winheight", 1, 1, f_winheight}, {"winline", 0, 0, f_winline}, - {"winnr", 0, 0, f_winnr}, + {"winnr", 0, 1, f_winnr}, {"winrestcmd", 0, 0, f_winrestcmd}, {"winwidth", 1, 1, f_winwidth}, }; @@ -4578,6 +4582,38 @@ f_getcwd(argvars, retvar) } /* + * "getfperm({fname})" function + */ + static void +f_getfperm(argvars, retvar) + VAR argvars; + VAR retvar; +{ + char_u *fname; + struct stat st; + char_u *perm = NULL; + char_u flags[] = "rwx"; + int i; + + fname = get_var_string(&argvars[0]); + + retvar->var_type = VAR_STRING; + if (mch_stat((char *)fname, &st) >= 0) + { + perm = vim_strsave((char_u *)"---------"); + if (perm != NULL) + { + for (i = 0; i < 9; i++) + { + if (st.st_mode & (1 << (8 - i))) + perm[i] = flags[i % 3]; + } + } + } + retvar->var_val.var_string = perm; +} + +/* * "getfsize({fname})" function */ static void @@ -4623,6 +4659,86 @@ f_getftime(argvars, retvar) } /* + * "getftype({fname})" function + */ + static void +f_getftype(argvars, retvar) + VAR argvars; + VAR retvar; +{ + char_u *fname; + struct stat st; + char_u *type = NULL; + char *t; + + fname = get_var_string(&argvars[0]); + + retvar->var_type = VAR_STRING; + if (mch_lstat((char *)fname, &st) >= 0) + { +#ifdef S_ISREG + if (S_ISREG(st.st_mode)) + t = "file"; + else if (S_ISDIR(st.st_mode)) + t = "dir"; +# ifdef S_ISLNK + else if (S_ISLNK(st.st_mode)) + t = "link"; +# endif +# ifdef S_ISBLK + else if (S_ISBLK(st.st_mode)) + t = "bdev"; +# endif +# ifdef S_ISCHR + else if (S_ISCHR(st.st_mode)) + t = "cdev"; +# endif +# ifdef S_ISFIFO + else if (S_ISFIFO(st.st_mode)) + t = "fifo"; +# endif +# ifdef S_ISSOCK + else if (S_ISSOCK(st.st_mode)) + t = "fifo"; +# endif + else + t = "other"; +#else +# ifdef S_IFMT + switch (st.st_mode & S_IFMT) + { + case S_IFREG: t = "file"; break; + case S_IFDIR: t = "dir"; break; +# ifdef S_IFLNK + case S_IFLNK: t = "link"; break; +# endif +# ifdef S_IFBLK + case S_IFBLK: t = "bdev"; break; +# endif +# ifdef S_IFCHR + case S_IFCHR: t = "cdev"; break; +# endif +# ifdef S_IFIFO + case S_IFIFO: t = "fifo"; break; +# endif +# ifdef S_IFSOCK + case S_IFSOCK: t = "socket"; break; +# endif + default: t = "other"; + } +# else + if (mch_isdir(fname)) + t = "dir"; + else + t = "file"; +# endif +#endif + type = vim_strsave((char_u *)t); + } + retvar->var_val.var_string = type; +} + +/* * "getreg()" function */ static void @@ -6305,6 +6421,10 @@ f_simplify(argvars, retvar) retvar->var_type = VAR_STRING; } +#define SP_NOMOVE 1 /* don't move cursor */ +#define SP_REPEAT 2 /* repeat to find outer pair */ +#define SP_RETCOUNT 4 /* return matchcount */ + /* * "search()" function */ @@ -6315,13 +6435,24 @@ f_search(argvars, retvar) { char_u *pat; pos_T pos; + pos_T save_cursor; int save_p_ws = p_ws; int dir; + int flags = 0; + + retvar->var_val.var_number = 0; /* default: FAIL */ pat = get_var_string(&argvars[0]); - dir = get_search_arg(&argvars[1], NULL); /* may set p_ws */ + dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */ + if (dir == 0) + goto theend; + if ((flags & ~SP_NOMOVE) != 0) + { + EMSG2(_(e_invarg2), get_var_string(&argvars[1])); + goto theend; + } - pos = curwin->w_cursor; + pos = save_cursor = curwin->w_cursor; if (searchit(curwin, curbuf, &pos, dir, pat, 1L, SEARCH_KEEP, RE_SEARCH) != FAIL) { @@ -6331,15 +6462,14 @@ f_search(argvars, retvar) * correct that here */ check_cursor(); } - else - retvar->var_val.var_number = 0; + + /* If 'n' flag is used: restore cursor position. */ + if (flags & SP_NOMOVE) + curwin->w_cursor = save_cursor; +theend: p_ws = save_p_ws; } -#define SP_NOMOVE 1 /* don't move cursor */ -#define SP_REPEAT 2 /* repeat to find outer pair */ -#define SP_RETCOUNT 4 /* return matchcount */ - /* * "searchpair()" function */ @@ -6393,6 +6523,8 @@ f_searchpair(argvars, retvar) /* Handle the optional fourth argument: flags */ dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ + if (dir == 0) + goto theend; /* Optional fifth argument: skip expresion */ if (argvars[3].var_type == VAR_UNKNOWN @@ -6474,6 +6606,11 @@ theend: p_cpo = save_cpo; } +/* + * Get flags for a search function. + * Possibly sets "p_ws". + * Returns BACKWARD, FORWARD or zero (for an error). + */ static int get_search_arg(varp, flagsp) VAR varp; @@ -6482,24 +6619,37 @@ get_search_arg(varp, flagsp) int dir = FORWARD; char_u *flags; char_u nbuf[NUMBUFLEN]; + int mask; if (varp->var_type != VAR_UNKNOWN) { flags = get_var_string_buf(varp, nbuf); - if (vim_strchr(flags, 'b') != NULL) - dir = BACKWARD; - if (vim_strchr(flags, 'w') != NULL) - p_ws = TRUE; - if (vim_strchr(flags, 'W') != NULL) - p_ws = FALSE; - if (flagsp != NULL) - { - if (vim_strchr(flags, 'n') != NULL) - *flagsp |= SP_NOMOVE; - if (vim_strchr(flags, 'r') != NULL) - *flagsp |= SP_REPEAT; - if (vim_strchr(flags, 'm') != NULL) - *flagsp |= SP_RETCOUNT; + while (*flags != NUL) + { + switch (*flags) + { + case 'b': dir = BACKWARD; break; + case 'w': p_ws = TRUE; break; + case 'W': p_ws = FALSE; break; + default: mask = 0; + if (flagsp != NULL) + switch (*flags) + { + case 'n': mask = SP_NOMOVE; break; + case 'r': mask = SP_REPEAT; break; + case 'm': mask = SP_RETCOUNT; break; + } + if (mask == 0) + { + EMSG2(_(e_invarg2), flags); + dir = 0; + } + else + *flagsp |= mask; + } + if (dir == 0) + break; + ++flags; } } return dir; @@ -7648,7 +7798,9 @@ f_tr(argvars, retvar) /* not multi-byte: fromstr and tostr must be the same length */ if (STRLEN(fromstr) != STRLEN(tostr)) { +#ifdef FEAT_MBYTE error: +#endif EMSG2(_(e_invarg2), fromstr); ga_clear(&ga); return; @@ -7859,9 +8011,30 @@ f_winnr(argvars, retvar) int nr = 1; #ifdef FEAT_WINDOWS win_T *wp; + win_T *twin = curwin; + char_u *arg; + + if (argvars[0].var_type != VAR_UNKNOWN) + { + arg = get_var_string(&argvars[0]); + if (STRCMP(arg, "$") == 0) + twin = lastwin; + else if (STRCMP(arg, "#") == 0) + { + twin = prevwin; + if (prevwin == NULL) + nr = 0; + } + else + { + EMSG2(_(e_invexpr2), arg); + nr = 0; + } + } - for (wp = firstwin; wp != curwin; wp = wp->w_next) - ++nr; + if (nr > 0) + for (wp = firstwin; wp != twin; wp = wp->w_next) + ++nr; #endif retvar->var_val.var_number = nr; } diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index d4cf86b82..b651f34a7 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3806,6 +3806,7 @@ static struct prt_ps_font_S prt_ps_courier_font = {"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique"} }; +#ifdef FEAT_MBYTE /* Generic font metrics for multi-byte fonts */ static struct prt_ps_font_S prt_ps_mb_font = { @@ -3814,6 +3815,7 @@ static struct prt_ps_font_S prt_ps_mb_font = -250, 805, {NULL, NULL, NULL, NULL} }; +#endif /* Pointer to current font set being used */ static struct prt_ps_font_S* prt_ps_font; @@ -3822,8 +3824,8 @@ static struct prt_ps_font_S* prt_ps_font; * building CID font name */ struct prt_ps_encoding_S { - char_u *encoding; - char_u *cmap_encoding; + char *encoding; + char *cmap_encoding; int needs_charset; }; @@ -3834,6 +3836,8 @@ struct prt_ps_charset_S int has_charset; }; +#ifdef FEAT_MBYTE + #define CS_JIS_C_1978 (0x01) #define CS_JIS_X_1983 (0x02) #define CS_JIS_X_1990 (0x04) @@ -4017,6 +4021,7 @@ static struct prt_ps_mbfont_S prt_ps_mbfonts[] = "KS_X_1992" } }; +#endif /* FEAT_MBYTE */ struct prt_ps_resource_S { @@ -4076,7 +4081,7 @@ static char *prt_resource_types[] = struct prt_dsc_comment_S { - char_u *string; + char *string; int len; int type; }; @@ -4092,11 +4097,11 @@ struct prt_dsc_line_S #define SIZEOF_CSTR(s) (sizeof(s) - 1) struct prt_dsc_comment_S prt_dsc_table[] = { - {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, + {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, {PRT_DSC_VERSION, SIZEOF_CSTR(PRT_DSC_VERSION), - PRT_DSC_VERSION_TYPE}, + PRT_DSC_VERSION_TYPE}, {PRT_DSC_ENDCOMMENTS, SIZEOF_CSTR(PRT_DSC_ENDCOMMENTS), - PRT_DSC_ENDCOMMENTS_TYPE} + PRT_DSC_ENDCOMMENTS_TYPE} }; static void prt_write_file_raw_len __ARGS((char_u *buffer, int bytes)); @@ -4135,6 +4140,7 @@ static int prt_resfile_skip_nonws __ARGS((int offset)); static int prt_resfile_skip_ws __ARGS((int offset)); static int prt_next_dsc __ARGS((struct prt_dsc_line_S *p_dsc_line)); #ifdef FEAT_MBYTE +static int prt_build_cid_fontname __ARGS((int font, char_u *name, int name_len)); static void prt_def_cidfont __ARGS((char *new_name, int height, char *cidfont)); static int prt_match_encoding __ARGS((char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc)); static int prt_match_charset __ARGS((char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar)); @@ -5097,15 +5103,16 @@ prt_get_cpl() return (int)((prt_right_margin - prt_left_margin) / prt_char_width); } +#ifdef FEAT_MBYTE static int prt_build_cid_fontname(font, name, name_len) int font; - char *name; + char_u *name; int name_len; { char *fontname; - fontname = alloc(name_len + 1); + fontname = (char *)alloc(name_len + 1); if (fontname == NULL) return FALSE; STRNCPY(fontname, name, name_len); @@ -5114,6 +5121,7 @@ prt_build_cid_fontname(font, name, name_len) return TRUE; } +#endif /* * Get number of lines of text that fit on a page (excluding the header). @@ -5152,13 +5160,13 @@ prt_get_lpp() #ifdef FEAT_MBYTE static int prt_match_encoding(p_encoding, p_cmap, pp_mbenc) - char *p_encoding; - struct prt_ps_mbfont_S *p_cmap; - struct prt_ps_encoding_S **pp_mbenc; + char *p_encoding; + struct prt_ps_mbfont_S *p_cmap; + struct prt_ps_encoding_S **pp_mbenc; { - int mbenc; - int enc_len; - struct prt_ps_encoding_S *p_mbenc; + int mbenc; + int enc_len; + struct prt_ps_encoding_S *p_mbenc; *pp_mbenc = NULL; /* Look for recognised encoding */ @@ -5178,12 +5186,12 @@ prt_match_encoding(p_encoding, p_cmap, pp_mbenc) static int prt_match_charset(p_charset, p_cmap, pp_mbchar) - char *p_charset; - struct prt_ps_mbfont_S *p_cmap; + char *p_charset; + struct prt_ps_mbfont_S *p_cmap; struct prt_ps_charset_S **pp_mbchar; { - int mbchar; - int char_len; + int mbchar; + int char_len; struct prt_ps_charset_S *p_mbchar; /* Look for recognised character set, using default if one is not given */ @@ -5226,7 +5234,7 @@ mch_print_init(psettings, jobname, forceit) char_u *p_encoding; struct prt_ps_encoding_S *p_mbenc; struct prt_ps_encoding_S *p_mbenc_first; - struct prt_ps_charset_S *p_mbchar; + struct prt_ps_charset_S *p_mbchar; #endif #if 0 @@ -5262,11 +5270,13 @@ mch_print_init(psettings, jobname, forceit) p_mbenc_first = NULL; p_mbchar = NULL; for (cmap = 0; cmap < NUM_ELEMENTS(prt_ps_mbfonts); cmap++) - if (prt_match_encoding(p_encoding, &prt_ps_mbfonts[cmap], &p_mbenc)) + if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap], + &p_mbenc)) { if (p_mbenc_first == NULL) p_mbenc_first = p_mbenc; - if (prt_match_charset(p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar)) + if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap], + &p_mbchar)) break; } @@ -5343,8 +5353,8 @@ mch_print_init(psettings, jobname, forceit) return FALSE; if (mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].present) if (!prt_build_cid_fontname(PRT_PS_FONT_BOLDOBLIQUE, - mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string, - mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen)) + mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string, + mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen)) return FALSE; /* Check if need to use Courier for ASCII code range, and if so pick up @@ -5555,8 +5565,8 @@ prt_add_resource(resource) EMSG2(_("E456: Can't open file \"%s\""), resource->filename); return FALSE; } - prt_dsc_resources("BeginResource", - prt_resource_types[resource->type], resource->title); + prt_dsc_resources("BeginResource", prt_resource_types[resource->type], + (char *)resource->title); prt_dsc_textline("BeginDocument", (char *)resource->filename); @@ -5602,7 +5612,7 @@ mch_print_begin(psettings) double bottom; struct prt_ps_resource_S res_prolog; struct prt_ps_resource_S res_encoding; - char_u buffer[256]; + char buffer[256]; char_u *p_encoding; #ifdef FEAT_MBYTE struct prt_ps_resource_S res_cidfont; @@ -5614,7 +5624,7 @@ mch_print_begin(psettings) */ prt_dsc_start(); prt_dsc_textline("Title", (char *)psettings->jobname); - if (!get_user_name(buffer, 256)) + if (!get_user_name((char_u *)buffer, 256)) STRCPY(buffer, "Unknown"); prt_dsc_textline("For", buffer); prt_dsc_textline("Creator", VIM_VERSION_LONG); @@ -5757,7 +5767,7 @@ mch_print_begin(psettings) if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), - prt_ascii_encoding); + prt_ascii_encoding); return FALSE; } if (!prt_open_resource(&res_encoding)) @@ -5786,7 +5796,7 @@ mch_print_begin(psettings) if (!prt_find_resource(prt_cmap, &res_cmap)) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), - prt_cmap); + prt_cmap); return FALSE; } if (!prt_open_resource(&res_cmap)) @@ -5911,7 +5921,7 @@ mch_print_begin(psettings) /* When using Courier for ASCII range when printing multi-byte, need to * pick up ASCII encoding to use with it. */ if (prt_use_courier) - p_encoding = prt_ascii_encoding; + p_encoding = (char_u *)prt_ascii_encoding; #endif prt_dsc_resources("IncludeResource", "font", prt_ps_courier_font.ps_fontname[PRT_PS_FONT_ROMAN]); @@ -6015,7 +6025,7 @@ mch_print_end(psettings) /* Write CTRL-D to close serial communication link if used. * NOTHING MUST BE WRITTEN AFTER THIS! */ - prt_write_file(IF_EB("\004", "\067")); + prt_write_file((char_u *)IF_EB("\004", "\067")); if (!prt_file_error && psettings->outfile == NULL && !got_int && !psettings->user_abort) @@ -6274,7 +6284,7 @@ mch_print_text_out(p, len) */ do { - ch = prt_hexchar[(*p) >> 4]; + ch = prt_hexchar[(unsigned)(*p) >> 4]; ga_append(&prt_ps_buffer, ch); ch = prt_hexchar[(*p) & 0xf]; ga_append(&prt_ps_buffer, ch); diff --git a/src/gui_kde.cc b/src/gui_kde.cc index 772e45792..2be18b9b7 100644 --- a/src/gui_kde.cc +++ b/src/gui_kde.cc @@ -29,7 +29,7 @@ #include <qmessagebox.h> #include <qiconset.h> #include <qtextcodec.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" extern "C" { #include "vim.h" diff --git a/src/gui_kde_widget.cc b/src/gui_kde_wid.cc index ae48abfe0..91ea10be1 100644 --- a/src/gui_kde_widget.cc +++ b/src/gui_kde_wid.cc @@ -43,10 +43,11 @@ #include <kmenubar.h> #include <ktoolbar.h> #include <kstandarddirs.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" #include <qxembed.h> -extern "C" { +extern "C" +{ #include "version.h" } @@ -187,25 +188,19 @@ void VimWidget::mousePressEvent(QMouseEvent *event)//{{{ ButtonState buttons = event->button(); //Look at button states - if(buttons & QMouseEvent::LeftButton) { - button|=MOUSE_LEFT; - } - if(buttons & QMouseEvent::RightButton) { - button|=MOUSE_RIGHT; - } - if(buttons & QMouseEvent::MidButton) { - button|=MOUSE_MIDDLE; - } + if (buttons & QMouseEvent::LeftButton) + button |= MOUSE_LEFT; + if (buttons & QMouseEvent::RightButton) + button |= MOUSE_RIGHT; + if (buttons & QMouseEvent::MidButton) + button |= MOUSE_MIDDLE; //Look for keyboard modifiers - if(state & QMouseEvent::ShiftButton) { - modifiers|=MOUSE_SHIFT; - } - if(state & QMouseEvent::ControlButton){ - modifiers|=MOUSE_CTRL; - } - if(state & QMouseEvent::AltButton){ - modifiers|=MOUSE_ALT; - } + if (state & QMouseEvent::ShiftButton) + modifiers |= MOUSE_SHIFT; + if (state & QMouseEvent::ControlButton) + modifiers |= MOUSE_CTRL; + if (state & QMouseEvent::AltButton) + modifiers |= MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers); #if QT_VERSION>=300 QByteArray params; @@ -254,11 +249,11 @@ void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{ button|=MOUSE_4; else button|=MOUSE_5; - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers); @@ -279,19 +274,19 @@ void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{ int button=0; //Look at button states - if(buttons & LeftButton) + if (buttons & LeftButton) button|=MOUSE_LEFT; - if(buttons & RightButton) + if (buttons & RightButton) button|=MOUSE_RIGHT; - if(buttons & MidButton) + if (buttons & MidButton) button|=MOUSE_MIDDLE; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),TRUE,modifiers); @@ -313,15 +308,15 @@ void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{ //Look at button states //warning: we use state here, this is important ! - if(state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton) + if (state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton) button|=MOUSE_DRAG; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; if (button!=MOUSE_DRAG) gui_mouse_moved(event->x(),event->y()); @@ -335,11 +330,11 @@ void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{ int modifiers=0; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(MOUSE_RELEASE,event->x(),event->y(),FALSE,modifiers); @@ -454,21 +449,25 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ /* Count how many items there may be and normalize delimiters. */ - if (QUriDrag::decode(e, urls)) { + if (QUriDrag::decode(e, urls)) + { n = urls.count(); fnames = (char_u **)lalloc((n+1) * sizeof(char_u *), TRUE); nfiles = 0; #if QT_VERSION>=300 QPtrListIterator<char> it(urls); - for( ; it.current(); ++it ) { + for (; it.current(); ++it ) + { KURL u(*it); #else - for (i=0;i<urls.count();++i) { + for (i=0;i<urls.count();++i) + { KURL u(urls.at(i)); #endif if ( !u.isLocalFile() ) url = TRUE; - else { + else + { fnames[nfiles] = (char_u *)strdup((const char *)u.path()); ++nfiles; } @@ -488,7 +487,9 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ redo_dirs = TRUE; } } - } else { + } + else + { /* Ignore any directories */ for (i = 0; i < nfiles; ++i) { @@ -505,7 +506,9 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ /* Shift held down, change to first file's directory */ if (fnames[0] != NULL && vim_chdirfile(fnames[0]) == OK) redo_dirs = TRUE; - } else { + } + else + { char_u dirname[MAXPATHL]; char_u *s; if (mch_dirname(dirname, MAXPATHL) == OK) @@ -561,7 +564,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ // ignore certain keys if (key == Qt::Key_Shift || key == Qt::Key_Alt || key == Qt::Key_Control || key == Qt::Key_Meta - || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock ) { + || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock ) + { e->ignore(); return; } @@ -591,13 +595,13 @@ void gui_keypress(QKeyEvent *e) { // {{{ // change shift-tab (backtab) into S_TAB - if ( key == Qt::Key_BackTab && state & Qt::ShiftButton) { + if ( key == Qt::Key_BackTab && state & Qt::ShiftButton) key = Qt::Key_Tab; - } // Change C-@ and C-2 in NUL ? Gtk does this if ( (key == Qt::Key_2 || key == Qt::Key_At) - && state & Qt::ControlButton ) { + && state & Qt::ControlButton ) + { string[0] = NUL; len = 1; } @@ -639,7 +643,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete) { while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key ) i++; - if (special_keys[i].qtkey != 0) { + if (special_keys[i].qtkey != 0) + { string[0] = CSI; string[1] = special_keys[i].code0; string[2] = special_keys[i].code1; @@ -648,7 +653,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ /* for (i = 0; special_keys[i].qtkey != 0 ; i++) { - if (special_keys[i].qtkey == key ) { + if (special_keys[i].qtkey == key ) + { string[0] = CSI; string[1] = special_keys[i].code0; string[2] = special_keys[i].code1; @@ -658,7 +664,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ }*/ } - if (len == 0) { + if (len == 0) + { //no need to dump that, that's a QT problem, we can't do anything //dbf("Unrecognised Key : %X %s", key, e->text().latin1()); e->ignore(); @@ -669,7 +676,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ /* Special keys (and a few others) may have modifiers */ if (len == -3 || key == Qt::Key_Space || key == Qt::Key_Tab || key == Qt::Key_Return || key == Qt::Key_Enter || - key == Qt::Key_Escape) { + key == Qt::Key_Escape) + { modifiers = 0; if (state & Qt::ShiftButton) modifiers |= MOD_MASK_SHIFT; @@ -689,18 +697,22 @@ void gui_keypress(QKeyEvent *e) { // {{{ key = simplify_key(key, &modifiers); if (key == CSI) key=K_CSI; - if (IS_SPECIAL(key)) { + if (IS_SPECIAL(key)) + { string[0] = CSI; string[1] = K_SECOND(key); string[2] = K_THIRD(key); len = 3; - } else { + } + else + { string[0] = key; len = 1; } - if (modifiers!=0) { + if (modifiers!=0) + { uchar string2[10]; string2[0] = CSI; string2[1] = KS_MODIFIER; @@ -718,9 +730,9 @@ void gui_keypress(QKeyEvent *e) { // {{{ } add_to_input_buf(string, len); - if (p_mh) { + if (p_mh) gui_mch_mousehide(TRUE); - } + //DCOP Embedding stuff //if we are here then the user has type something in the window, thus we can easily imagine that : // 1 - text has changed (emit textChanged()) @@ -744,21 +756,24 @@ void gui_keypress(QKeyEvent *e) { // {{{ #ifdef FEAT_CLIENTSERVER void VimWidget::serverActivate(WId id) //{{{ { - if (serverName == NULL && serverDelayedStartName != NULL) { + if (serverName == NULL && serverDelayedStartName != NULL) + { commWindow = id; (void)serverRegisterName(qt_xdisplay(), serverDelayedStartName); - } else { - serverChangeRegisteredWindow( qt_xdisplay(), id ); } + else + serverChangeRegisteredWindow( qt_xdisplay(), id); }//}}} #endif #ifdef FEAT_XIM -void VimWidget::imStartEvent(QIMEvent *e) { +void VimWidget::imStartEvent(QIMEvent *e) +{ e->accept(); } -void VimWidget::imEndEvent(QIMEvent *e) { +void VimWidget::imEndEvent(QIMEvent *e) +{ uchar string[256]; QCString unistring = vmw->codec->fromUnicode(e->text()); @@ -771,7 +786,8 @@ void VimWidget::imEndEvent(QIMEvent *e) { e->accept(); } -void VimWidget::imComposeEvent(QIMEvent *e) { +void VimWidget::imComposeEvent(QIMEvent *e) +{ //i should do something here, displaying the text somewhere ... (status area ?) e->accept(); } @@ -851,7 +867,8 @@ void VimWidget::start_cursor_blinking()//{{{ if (blink_timer.isActive()) blink_timer.stop(); /* Only switch blinking on if none of the times is zero */ - if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus) { + if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus) + { blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); // The first blink appears after wait_time @@ -861,12 +878,15 @@ void VimWidget::start_cursor_blinking()//{{{ void VimWidget::blink_cursor()//{{{ { - if (blink_state == BLINK_ON) { + if (blink_state == BLINK_ON) + { // set cursor off gui_undraw_cursor(); blink_state = BLINK_OFF; blink_timer.start( blink_off_time, true); - } else { + } + else + { // set cursor on gui_update_cursor(TRUE, FALSE); blink_state = BLINK_ON; @@ -926,7 +946,8 @@ void VimWidget::flash()//{{{ #ifdef FEAT_CLIENTSERVER oldFilter = qt_set_x11_event_filter( kvim_x11_event_filter ); #endif - if (echo_wid_arg== 1) { + if (echo_wid_arg== 1) + { fprintf(stderr, "WID: %ld\n", (long)winId()); fflush(stderr); } @@ -988,26 +1009,23 @@ void VimMainWindow::menu_activated(int dx)//{{{ void VimMainWindow::clipboard_selection_update(){//{{{ - if(kapp->clipboard()->ownsSelection()) { + if (kapp->clipboard()->ownsSelection()) clip_own_selection(&clip_star); - } else { + else clip_lose_selection(&clip_star); - } }//}}} void VimMainWindow::clipboard_data_update(){//{{{ #if QT_VERSION>=300 - if (kapp->clipboard()->ownsClipboard()) { + if (kapp->clipboard()->ownsClipboard()) clip_own_selection(&clip_plus); - } else { + else clip_lose_selection(&clip_plus); - } #else - if (kapp->clipboard()->ownsSelection()) { + if (kapp->clipboard()->ownsSelection()) clip_own_selection(&clip_star); - } else { + else clip_lose_selection(&clip_star); - } #endif }//}}} @@ -1182,17 +1200,20 @@ Vim releases instead of the text that was included with it."); about->show(); }//}}} -void VimMainWindow::showTipOfTheDay() { +void VimMainWindow::showTipOfTheDay() +{ #if QT_VERSION>=300 KTipDialog::showTip (vmw,QString::null,true); #endif } -void VimMainWindow::buffersToolbar() { +void VimMainWindow::buffersToolbar() +{ } -void VimMainWindow::showBugReport() { +void VimMainWindow::showBugReport() +{ KBugReport *bug= new KBugReport(this,true); bug->show(); } @@ -1217,7 +1238,8 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ * Create Icon */ char ** icon_data; - switch (type) { + switch (type) + { case VIM_GENERIC: icon_data = generic_xpm; break; @@ -1255,25 +1277,29 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ hly1->addWidget( icon ); hly1->addWidget( text ); QHBoxLayout * hly3 = new QHBoxLayout ( vly , 5); - if (textfield!=NULL) { + if (textfield!=NULL) + { entry = new QLineEdit((const char *)textfield,this); entry->setText((const char *)textfield); hly3->addWidget( entry ); ret=textfield; - } else entry=NULL; + } + else + entry=NULL; QHBoxLayout * hly2 = new QHBoxLayout( vly, 15); QString s; QPushButton * pushButton = 0L; - for( int i=0; i<butNb; i++) { + for (int i=0; i<butNb; i++) + { s = buttonText[i]; pushButton = new QPushButton(s, this ); - if (s.find('&') != -1) { - pushButton->setAccel( s.at(s.find('&')+1).latin1() ); - } + if (s.find('&') != -1) + pushButton->setAccel(s.at(s.find('&')+1).latin1()); hly2->addWidget( pushButton ); - if (i == def_but-1) { + if (i == def_but-1) + { pushButton->setDefault( true ); pushButton->setAutoDefault( true ); setResult( i+1 ); @@ -1288,12 +1314,16 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ vly->activate(); }//}}} -void VimDialog::done(int r) { - if (entry!=NULL) { - if (r) { +void VimDialog::done(int r) +{ + if (entry!=NULL) + { + if (r) + { QCString unistring=vmw->codec->fromUnicode(entry->text()); STRCPY(ret,(const char*)unistring); - } else + } + else *ret=NUL; } QDialog::done(r); @@ -1311,7 +1341,8 @@ SBPool::SBPool(void)//{{{ void SBPool::create(GuiScrollbar * sb, int orient)//{{{ { - switch(orient) { + switch(orient) + { case SBAR_HORIZ: sb->w = new QScrollBar(QScrollBar::Horizontal, vmw); break; @@ -1349,9 +1380,8 @@ static int kvim_x11_event_filter( XEvent* e)//{{{ if (e->xproperty.type == PropertyNotify && e->xproperty.atom == commProperty && e->xproperty.window == commWindow - && e->xproperty.state == PropertyNewValue ) { + && e->xproperty.state == PropertyNewValue) serverEventProc(qt_xdisplay(), e); - } if (oldFilter) return oldFilter( e ); return FALSE; @@ -1381,29 +1411,31 @@ bool KVimUtils::fromString(QFont *f, QString descrip) QStringList l(QStringList::split(',', descrip)); int count = l.count(); - if (count != 10 && count != 9) { + if (count != 10 && count != 9) return FALSE; - } f->setFamily(l[0]); f->setPointSize(l[1].toInt()); - if ( count == 9 ) { - f->setStyleHint((QFont::StyleHint) l[2].toInt()); - f->setWeight(l[3].toInt()); - f->setItalic(l[4].toInt()); - f->setUnderline(l[5].toInt()); - f->setStrikeOut(l[6].toInt()); - f->setFixedPitch(l[7].toInt()); - f->setRawMode(l[8].toInt()); - } else { - f->setPixelSize(l[2].toInt()); - f->setStyleHint((QFont::StyleHint) l[3].toInt()); - f->setWeight(l[4].toInt()); - f->setItalic(l[5].toInt()); - f->setUnderline(l[6].toInt()); - f->setStrikeOut(l[7].toInt()); - f->setFixedPitch(l[8].toInt()); - f->setRawMode(l[9].toInt()); + if ( count == 9 ) + { + f->setStyleHint((QFont::StyleHint) l[2].toInt()); + f->setWeight(l[3].toInt()); + f->setItalic(l[4].toInt()); + f->setUnderline(l[5].toInt()); + f->setStrikeOut(l[6].toInt()); + f->setFixedPitch(l[7].toInt()); + f->setRawMode(l[8].toInt()); + } + else + { + f->setPixelSize(l[2].toInt()); + f->setStyleHint((QFont::StyleHint) l[3].toInt()); + f->setWeight(l[4].toInt()); + f->setItalic(l[5].toInt()); + f->setUnderline(l[6].toInt()); + f->setStrikeOut(l[7].toInt()); + f->setFixedPitch(l[8].toInt()); + f->setRawMode(l[9].toInt()); } return TRUE; } diff --git a/src/gui_kde_widget.h b/src/gui_kde_wid.h index d84544656..39102daa5 100644 --- a/src/gui_kde_widget.h +++ b/src/gui_kde_wid.h @@ -96,14 +96,14 @@ public: void disable_mzscheme_threads(); #endif void flash(); - + /** DCOP */ void execNormal(QString command); void execInsert(QString command); void execRaw(QString command); void execCmd(QString command); QString eval(QString expr); - + bool wait_done; BlinkState blink_state; QPainter *painter; @@ -134,7 +134,7 @@ protected: /* wait for input */ QTimer wait_timer; - + #ifdef FEAT_MZSCHEME int mzscheme_timer_id; #endif diff --git a/src/gui_kde_x11.cc b/src/gui_kde_x11.cc index c0aec8909..6517cd2f8 100644 --- a/src/gui_kde_x11.cc +++ b/src/gui_kde_x11.cc @@ -45,7 +45,7 @@ #include <qfont.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" extern "C" { diff --git a/src/if_python.c b/src/if_python.c index 21c436520..8f4fdfd19 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -2731,6 +2731,7 @@ StringToLine(PyObject *obj) char *save; int len; int i; + char *p; if (obj == NULL || !PyString_Check(obj)) { @@ -2741,14 +2742,22 @@ StringToLine(PyObject *obj) str = PyString_AsString(obj); len = PyString_Size(obj); - /* Error checking: String must not contain newlines, as we + /* + * Error checking: String must not contain newlines, as we * are replacing a single line, and we must replace it with * a single line. + * A trailing newline is removed, so that append(f.readlines()) works. */ - if (memchr(str, '\n', len)) + p = memchr(str, '\n', len); + if (p != NULL) { - PyErr_SetVim(_("string cannot contain newlines")); - return NULL; + if (p == str + len - 1) + --len; + else + { + PyErr_SetVim(_("string cannot contain newlines")); + return NULL; + } } /* Create a copy of the string, with internal nulls replaced by diff --git a/src/main.aap b/src/main.aap index 8c243cad1..3b785795e 100644 --- a/src/main.aap +++ b/src/main.aap @@ -100,9 +100,9 @@ prefix = `os.path.expanduser(prefix)` GUI_TESTTARGET = gui KDE GUI_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc - gui_kde_widget_moc.cc + gui_kde_wid_moc.cc kvim_iface_skel.cc - GUI_OBJ = $BDIR/gui_kde_widget.o + GUI_OBJ = $BDIR/gui_kde_wid.o GUI_DEFS = -DFEAT_GUI_KDE $NARROW_PROTO GUI_IPATH = $GUI_INC_LOC GUI_LIBS_DIR = $GUI_LIB_LOC @@ -218,7 +218,7 @@ test check: testclean {virtual}: :del {force} testdir/*.out testdir/test.log -CLEANFILES += gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl +CLEANFILES += gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl # When no fetch target exists we are not a child of the ../main.aap recipe, # Use ../main.aap to do the fetching. @@ -356,18 +356,18 @@ auto/if_perl.c: if_perl.xs :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \ $PERLLIB/ExtUtils/typemap if_perl.xs >> $target -$BDIR/gui_kde_widget.o: gui_kde_widget.cc - :sys $MOC -o gui_kde_widget_moc.cc gui_kde_widget.h +$BDIR/gui_kde_wid.o: gui_kde_wid.cc + :sys $MOC -o gui_kde_wid_moc.cc gui_kde_wid.h @try: :sys $KDE_PREFIX/bin/dcopidl kvim_iface.h > kvim_iface.kidl @except: :del {f} kvim_iface.kidl :sys $KDE_PREFIX/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl - :do compile gui_kde_widget.cc + :do compile gui_kde_wid.cc -gui_kde_widget_moc.cc: $BDIR/gui_kde_widget.o +gui_kde_wid_moc.cc: $BDIR/gui_kde_wid.o -kvim_iface_skel.cc: $BDIR/gui_kde_widget.o +kvim_iface_skel.cc: $BDIR/gui_kde_wid.o auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in diff --git a/src/memline.c b/src/memline.c index 176705392..67d233b9e 100644 --- a/src/memline.c +++ b/src/memline.c @@ -4338,8 +4338,17 @@ ml_find_line_or_offset(buf, line, offp) curline = buf->b_ml.ml_locked_high + 1; } - if (ffdos) - size += line - 1; + if (line != 0) + { + /* Count extra CR characters. */ + if (ffdos) + size += line - 1; + + /* Don't count the last line break if 'bin' and 'noeol'. */ + if (buf->b_p_bin && !buf->b_p_eol) + size -= ffdos + 1; + } + return size; } diff --git a/src/misc2.c b/src/misc2.c index dbc5166c8..82b88876a 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3606,8 +3606,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, need_dir, } /* Store information on starting dir now if path is relative. - * If path is absolute, we do that later. - */ + * If path is absolute, we do that later. */ if (path[0] == '.' && (vim_ispathsep(path[1]) || path[1] == NUL) && (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL) @@ -3886,7 +3885,7 @@ vim_findfile_cleanup(ctx) * Return a pointer to an allocated file name or NULL if nothing found. * To get all matching files call this function until you get NULL. * - * If the passed search_context is NULL, it the returns NULL. + * If the passed search_context is NULL, NULL is returned. * * The search algorithm is depth first. To change this replace the * stack with a list (don't forget to leave partly searched directories on the @@ -1129,7 +1129,7 @@ do_execreg(regname, colon, addcr) new_last_cmdline = NULL; /* Escape all control characters with a CTRL-V */ p = vim_strsave_escaped_ext(last_cmdline, - "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); + (char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); if (p != NULL) retval = put_in_typebuf(p, TRUE); vim_free(p); diff --git a/src/os_mac.h b/src/os_mac.h index 940e267b9..5ef7310b5 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -119,8 +119,8 @@ * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) */ /* When compiled under MacOS X (including CARBON version) - * we use the Unix File path style */ -#if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX + * we use the Unix File path style. Also when UNIX is defined. */ +#if defined(UNIX) || (defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX) # undef COLON_AS_PATHSEP # define USE_UNIXFILENAME #else @@ -140,14 +140,16 @@ #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ #define SPACE_IN_FILENAME #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's - quite fast. Did I forgot to update the comment */ + quite fast. Did I forgot to update the + comment */ -#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file as os_mac.c */ +#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file + as os_mac.c */ #define BINARY_FILE_IO #define EOL_DEFAULT EOL_MAC -#ifndef MACOS_X_UNIX /* I hope that switching these two lines */ -# define USE_CR /* does what I want -- BNF */ +#ifndef MACOS_X_UNIX /* I hope that switching these two lines */ +# define USE_CR /* does what I want -- BNF */ # define NO_CONSOLE /* don't include console mode */ #endif #define HAVE_AVAIL_MEM diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c index 3dfacfe68..3f64e3da4 100644 --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -16,6 +16,7 @@ #define NO_X11_INCLUDES #include "vim.h" +#ifdef FEAT_MBYTE extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp)); extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size)); extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp)); @@ -228,3 +229,5 @@ enc2macroman(from, fromlen, to, tolenp, maxtolen, rest, restlenp) *tolenp = l; return OK; } + +#endif /* FEAT_MBYTE */ diff --git a/src/po/ru.cp1251.po b/src/po/ru.cp1251.po index 85b1d6835..7ae34cb25 100644 --- a/src/po/ru.cp1251.po +++ b/src/po/ru.cp1251.po @@ -1239,7 +1239,7 @@ msgstr "E173: 1 файл ожидает редактирования." #: ex_docmd.c:4584 #, c-format msgid "E173: %ld more files to edit" -msgstr "E173: Есть неотредактированные файлы (%d)." +msgstr "E173: Есть неотредактированные файлы (%ld)." #: ex_docmd.c:4679 msgid "E174: Command already exists: add ! to replace it" @@ -2446,7 +2446,7 @@ msgstr "Добавлена база данных cscope %s" #: if_cscope.c:589 #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: ошибка получения информации от соединения cscope %d" +msgstr "E262: ошибка получения информации от соединения cscope %ld" #: if_cscope.c:694 msgid "E561: unknown cscope search type" @@ -2524,7 +2524,7 @@ msgstr "E261: соединение с cscope %s не обнаружено" #: if_cscope.c:1458 #, c-format msgid "cscope connection %s closed" -msgstr "соединение с cscope закрыто" +msgstr "соединение с cscope %s закрыто" #. should not reach here #: if_cscope.c:1598 diff --git a/src/po/ru.po b/src/po/ru.po index 7bd9d72f3..1d1c5d5a9 100644 --- a/src/po/ru.po +++ b/src/po/ru.po @@ -1239,7 +1239,7 @@ msgstr "E173: 1 файл ожидает редактирования." #: ex_docmd.c:4584 #, c-format msgid "E173: %ld more files to edit" -msgstr "E173: Есть неотредактированные файлы (%d)." +msgstr "E173: Есть неотредактированные файлы (%ld)." #: ex_docmd.c:4679 msgid "E174: Command already exists: add ! to replace it" @@ -2446,7 +2446,7 @@ msgstr "Добавлена база данных cscope %s" #: if_cscope.c:589 #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: ошибка получения информации РѕС‚ соединения cscope %d" +msgstr "E262: ошибка получения информации РѕС‚ соединения cscope %ld" #: if_cscope.c:694 msgid "E561: unknown cscope search type" @@ -2524,7 +2524,7 @@ msgstr "E261: соединение СЃ cscope %s РЅРµ обнаружено" #: if_cscope.c:1458 #, c-format msgid "cscope connection %s closed" -msgstr "соединение СЃ cscope закрыто" +msgstr "соединение СЃ cscope %s закрыто" #. should not reach here #: if_cscope.c:1598 diff --git a/src/search.c b/src/search.c index 227b25468..4513ea110 100644 --- a/src/search.c +++ b/src/search.c @@ -3760,10 +3760,11 @@ find_prev_quote(line, col_start, quotechar, escape) * Find quote under the cursor, cursor at end. * Returns TRUE if found, else FALSE. */ +/*ARGSUSED*/ int current_quote(oap, count, include, quotechar) oparg_T *oap; - long count; + long count; /* not used */ int include; /* TRUE == include quote char */ int quotechar; /* Quote character */ { |