]> granicus.if.org Git - vim/commitdiff
updated for version 7.0049
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2005 22:01:03 +0000 (22:01 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2005 22:01:03 +0000 (22:01 +0000)
28 files changed:
runtime/doc/autocmd.txt
runtime/doc/editing.txt
runtime/doc/eval.txt
runtime/doc/intro.txt
runtime/doc/motion.txt
runtime/doc/options.txt
runtime/doc/tags
runtime/doc/usr_41.txt
runtime/doc/usr_toc.txt
runtime/doc/various.txt
runtime/syntax/vim.vim
src/edit.c
src/ex_cmds2.c
src/ex_docmd.c
src/ex_getln.c
src/fileio.c
src/gui_motif.c
src/gui_xmebw.c
src/move.c
src/ops.c
src/option.c
src/option.h
src/os_unix.c
src/proto/gui_motif.pro
src/quickfix.c
src/structs.h
src/version.h
src/vim.h

index 2b7edf5ecade533315f19317b4645bf1b5ea3208..c815f362aa15899ee9bb3e13b75bbfea64a1cb18 100644 (file)
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 7.0aa.  Last change: 2005 Jan 26
+*autocmd.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -324,6 +324,7 @@ FuncUndefined                       When a user function is used but it isn't
                                defined.  Useful for defining a function only
                                when it's used.  Both <amatch> and <afile> are
                                set to the name of the function.
+                               See |autoload-functions|.
                                                        *CursorHold*
 CursorHold                     When the user doesn't press a key for the time
                                specified with 'updatetime'.  Not re-triggered
@@ -520,6 +521,20 @@ TermResponse                       After the response to |t_RV| is received from
                                the terminal.  The value of |v:termresponse|
                                can be used to do things depending on the
                                terminal version.
+QuickFixCmdPre                                         *QuickFixCmdPre*
+                               Before a quickfix command is run (|:make|,
+                               |:grep|, |:grepadd|, |:vimgrep|,
+                               |:vimgrepadd|). The pattern is matched against
+                               the command being run.  When |:grep| is used
+                               but 'grepprg' is set to "internal" it still
+                               matches "grep".
+                               This command cannot be used to set the
+                               'makeprg' and 'grepprg' variables.
+                               If this command causes an error, the quickfix
+                               command is not executed.
+QuickFixCmdPost                                                *QuickFixCmdPost*
+                               like QuickFixCmdPre, but after a quickfix
+                               command is run.
                                                        *UserGettingBored*
 UserGettingBored               When the user hits CTRL-C.  Just kidding! :-)
                                                        *User*
index e5acbb921e41bd381db59a2fb0e3cee39ac1633a..ae7543e8d67016e27a7958e209eac0acd596d773 100644 (file)
@@ -1,4 +1,4 @@
-*editing.txt*   For Vim version 7.0aa.  Last change: 2005 Jan 26
+*editing.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -69,18 +69,21 @@ CTRL-G              or                              *CTRL-G* *:f* *:fi* *:file*
                        buffer number is also given.  {not in Vi}
 
                                        *g_CTRL-G* *word-count* *byte-count*
-g CTRL-G               Prints the current position of the cursor in four
-                       ways: Column, Line, Word and Byte.  If there are
-                       characters in the line that take more than one
-                       position on the screen (<Tab> or special character),
-                       both the "real" column and the screen column are
-                       shown, separated with a dash.  See also 'ruler'
-                       option.  {not in Vi}
+g CTRL-G               Prints the current position of the cursor in five
+                       ways: Column, Line, Word, Character and Byte.  If the
+                       number of Characters and Bytes is the same then the
+                       Character position is omitted.
+                       If there are characters in the line that take more
+                       than one position on the screen (<Tab> or special
+                       character), both the "real" column and the screen
+                       column are shown, separated with a dash.
+                       See also 'ruler' option.  {not in Vi}
 
                                                        *v_g_CTRL-G*
-{Visual}g CTRL-G       Similar to "g CTRL-G", but Word, Line, and Byte counts
-                       for the visually selected region are displayed.  In
-                       Blockwise mode, Column count is also shown.  (For
+{Visual}g CTRL-G       Similar to "g CTRL-G", but Word, Character, Line, and
+                       Byte counts for the visually selected region are
+                       displayed.
+                       In Blockwise mode, Column count is also shown.  (For
                        {Visual} see |Visual-mode|.)
                        {not in VI}
 
index c0031e85315c8171055c51fb2809577a4284dbcc..450408c814bd84d3049f51fe8d09fd157e7f9663 100644 (file)
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Feb 05
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -15,7 +15,7 @@ done, the features in this document are not available.  See |+eval| and
 1.  Variables                  |variables|
     1.1 Variable types
     1.2 Function references            |Funcref|
-    1.3 Lists                          |List|
+    1.3 Lists                          |Lists|
     1.4 Dictionaries                   |Dictionaries|
     1.5 More about variables           |more-variables|
 2.  Expression syntax          |expression-syntax|
@@ -126,7 +126,7 @@ arguments: >
 
 
 1.3 Lists ~
-                                                       *List* *E686*
+                                                       *List* *Lists* *E686*
 A List is an ordered sequence of items.  An item can be of any type.  Items
 can be accessed by their index number.  Items can be added and removed at any
 position in the sequence.
@@ -410,7 +410,7 @@ a List in which each item is a  List with two items, the key and the value: >
 
 
 Dictionary identity ~
-
+                                                       *dict-identity*
 Just like Lists you need to use |copy()| and |deepcopy()| to make a copy of a
 Dictionary.  Otherwise, assignment results in referring to the same
 Dictionary: >
@@ -1362,6 +1362,7 @@ USAGE                             RESULT  DESCRIPTION     ~
 
 add( {list}, {item})           List    append {item} to List {list}
 append( {lnum}, {string})      Number  append {string} below line {lnum}
+append( {lnum}, {list})                Number  append lines {list} below line {lnum}
 argc()                         Number  number of files in the argument list
 argidx()                       Number  current index in the argument list
 argv( {nr})                    String  {nr} entry of the argument list
@@ -1429,7 +1430,8 @@ getfsize( {fname})                Number  size in bytes of file {fname}
 getfontname( [{name}])         String  name of font being used
 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
+getline( {lnum})               String  line {lnum} of current buffer
+getline( {lnum}, {end})                List    lines {lnum} to {end} of current buffer
 getreg( [{regname}])           String  contents of register
 getregtype( [{regname}])       String  type of register
 getwinposx()                   Number  X coord in pixels of GUI Vim window
@@ -4342,16 +4344,64 @@ the caller to set the names.
 The recursiveness of user functions is restricted with the |'maxfuncdepth'|
 option.
 
+
+AUTOMATICALLY LOADING FUNCTIONS ~
                                                        *autoload-functions*
 When using many or large functions, it's possible to automatically define them
-only when they are used.  Use the FuncUndefined autocommand event with a
-pattern that matches the function(s) to be defined.  Example: >
+only when they are used.  There are two methods: with an autocommand and with
+the "autoload" directory in 'runtimepath'.
+
+
+Using an autocommand ~
+
+The autocommand is useful if you have a plugin that is a long Vim script file.
+You can define the autocommand and quickly quit the script with |:finish|.
+That makes Vim startup faster.  The autocommand should then load the same file
+again, setting a variable to skip the |:finish| command.
+
+Use the FuncUndefined autocommand event with a pattern that matches the
+function(s) to be defined.  Example: >
 
        :au FuncUndefined BufNet* source ~/vim/bufnetfuncs.vim
 
 The file "~/vim/bufnetfuncs.vim" should then define functions that start with
 "BufNet".  Also see |FuncUndefined|.
 
+
+Using an autoload script ~
+
+Using a script in the "autoload" directory is simpler, but requires using
+exactly the right file name.  A function that can be autoloaded has a name
+like this: >
+
+       :call filename:funcname()
+
+When such a function is called, and it is not defined yet, Vim will search the
+"autoload" directories in 'runtimepath' for a script file called
+"filename.vim".  For example "~/.vim/autoload/filename.vim".  That file should
+then define the function like this: >
+
+       function filename:funcname()
+          echo "Done!"
+       endfunction
+
+The file name and the name used before the colon in the function must match
+exactly, and the defined function must have the name exactly as it will be
+called.
+
+It is possible to use subdirectories.  Every colon in the function name works
+like a path separator.  Thus when calling a function: >
+
+       :call foo:bar:func()
+
+Vim will look for the file "autoload/foo/bar.vim" in 'runtimepath'.
+
+The name before the first colon must be at least two characters long,
+otherwise it looks like a scope, such as "s:".
+
+Note that the script will be sourced again and again if a function is called
+that looks like it is defined in the autoload script but it isn't.
+
 ==============================================================================
 6. Curly braces names                                  *curly-braces-names*
 
index d984ce259421e475cdd3b15efa1470d0fe2482c5..935577724c199fb85d82a79561392e64e9e0ebfa 100644 (file)
@@ -1,4 +1,4 @@
-*intro.txt*     For Vim version 7.0aa.  Last change: 2004 Dec 16
+*intro.txt*     For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -289,8 +289,7 @@ Vi  "the original".  Without further remarks this is the version
 Posix  From the IEEE standard 1003.2, Part 2: Shell and utilities.
        Generally known as "Posix".  This is a textual description of
        how Vi is supposed to work.
-       The version used is a draft from beginning 1996, so all remarks are
-       "expected to comply to" this.  Anything can change though...
+       See |posix-compliance|.
                                                        *Nvi*
 Nvi    The "New" Vi.  The version of Vi that comes with BSD 4.4 and FreeBSD.
        Very good compatibility with the original Vi, with a few extensions.
@@ -691,9 +690,9 @@ Q                   Switch to "Ex" mode.  This is a bit like typing ":"
                        |vimrc_example.vim| script "Q" works like "gq".
 
                                        *gQ*
-gQ                     Switch to "Ex" mode, but really behave like typing ":"
-                       commands after another.  All command line editing,
-                       completion etc. is available.
+gQ                     Switch to "Ex" mode like with "Q", but really behave
+                       like typing ":" commands after another.  All command
+                       line editing, completion etc. is available.
                        Use the ":vi" command |:visual| to exit "Ex" mode.
                        {not in Vi}
 
index bee238e5e082ef8fe5ffe4e0b29744177642677c..daaa6020e2d02a771b3f5a64c6b4c974d2603dde 100644 (file)
@@ -1,4 +1,4 @@
-*motion.txt*    For Vim version 7.0aa.  Last change: 2005 Jan 08
+*motion.txt*    For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -350,6 +350,10 @@ or the last line.  The first two commands put the cursor in the same column
 except after the "$" command, then the cursor will be put on the last
 character of the line.
 
+If "k", "-" or CTRL-P is used with a [count] and there are less than [count]
+lines above the cursor and the 'cpo' option includes the "-" flag it is an
+error. |cpo--|.
+
 ==============================================================================
 4. Word motions                                                *word-motions*
 
index d79aab72e21800abe290f7f65e15b7787cf311d9..e1c6f5ae404312fb9f6139fcb90240c41c4dc263 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 7.0aa.  Last change: 2005 Jan 30
+*options.txt*  For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1382,7 +1382,8 @@ A jump table for the options with a short description can be found at |Q_op|.
                        global
                        {not in Vi}
        Number of columns of the screen.  Normally this is set by the terminal
-       initialization and does not have to be set by hand.
+       initialization and does not have to be set by hand.  Also see
+       |posix-screen-size|.
        When Vim is running in the GUI or in a resizable window, setting this
        option will cause the window size to be changed.  When you only want
        to use the size for the GUI, put the command in your |gvimrc| file.
@@ -1431,7 +1432,7 @@ A jump table for the options with a short description can be found at |Q_op|.
        to the Vim defaults.  Effectively, this means that when a ".vimrc"
        file exists, Vim will use the Vim defaults, otherwise it will use the
        Vi defaults.  (Note: This doesn't happen for the system-wide vimrc
-       file).  Also see |compatible-default|.
+       file).  Also see |compatible-default| and |posix-compliance|.
        You can also set this option with the "-C" argument, and reset it with
        "-N".  See |-C| and |-N|.
        Switching this option off makes the Vim defaults be used for options
@@ -1844,6 +1845,13 @@ A jump table for the options with a short description can be found at |Q_op|.
                        there is one).  This works very well for C programs.
                        This flag is also used for other features, such as
                        C-indenting.
+                                                               *cpo--*
+               -       When included, a vertical movement command fails when
+                       it would above the first line or below the last line.
+                       Without it the cursor moves to the first or last line,
+                       unless it already was in that line.
+                       Applies to the commands "-", "k", CTRL-P, "+", "j",
+                       CTRL-N and CTRL-J.
                                                                *cpo-+*
                +       When included, a ":write file" command will reset the
                        'modified' flag of the buffer, even though the buffer
@@ -2804,7 +2812,7 @@ A jump table for the options with a short description can be found at |Q_op|.
                                                      VMS: "SEARCH/NUMBERS ")
                        global or local to buffer |global-local|
                        {not in Vi}
-       Program to use for the ":grep" command. This option may contain '%'
+       Program to use for the |:grep| command. This option may contain '%'
        and '#' characters, which are expanded like when used in a command-
        line.  The placeholder "$*" is allowed to specify where the arguments
        will be included.  Environment variables are expanded |:set_env|.  See
@@ -2812,8 +2820,8 @@ A jump table for the options with a short description can be found at |Q_op|.
        When your "grep" accepts the "-H" argument, use this to make ":grep"
        also work well with a single file: >
                :set grepprg=grep\ -nH
-<      Special value: When 'grepprg' is set to "internal" the ":grep" works
-       like ":vimgrep".
+<      Special value: When 'grepprg' is set to "internal" the |:grep| command
+       works like |:vimgrep| and |:grepadd| like |:vimgrepadd|.
        See also the section |:make_makeprg|, since most of the comments there
        apply equally to 'grepprg'.
        For Win32, the default is "findstr /n" if "findstr.exe" can be found,
@@ -3882,7 +3890,7 @@ A jump table for the options with a short description can be found at |Q_op|.
                        global
        Number of lines of the Vim window.
        Normally you don't need to set this.  It is done automatically by the
-       terminal initialization code.
+       terminal initialization code.  Also see |posix-screen-size|.
        When Vim is running in the GUI or in a resizable window, setting this
        option will cause the window size to be changed.  When you only want
        to use the size for the GUI, put the command in your |gvimrc| file.
index 8ad645313d168a5213b71d17389c6b895c465198..30611f86f5afe4affb20ae7d5e3d49683ae986de 100644 (file)
@@ -1531,6 +1531,7 @@ $VIMRUNTIME       starting.txt    /*$VIMRUNTIME*
 41.10  usr_41.txt      /*41.10*
 41.11  usr_41.txt      /*41.11*
 41.12  usr_41.txt      /*41.12*
+41.13  usr_41.txt      /*41.13*
 41.2   usr_41.txt      /*41.2*
 41.3   usr_41.txt      /*41.3*
 41.4   usr_41.txt      /*41.4*
@@ -3738,6 +3739,7 @@ Korean    mbyte.txt       /*Korean*
 L      motion.txt      /*L*
 Linux-backspace        options.txt     /*Linux-backspace*
 List   eval.txt        /*List*
+Lists  eval.txt        /*Lists*
 M      motion.txt      /*M*
 MDI    starting.txt    /*MDI*
 MS-DOS os_msdos.txt    /*MS-DOS*
@@ -3833,6 +3835,8 @@ Q_vi      quickref.txt    /*Q_vi*
 Q_vm   quickref.txt    /*Q_vm*
 Q_wi   quickref.txt    /*Q_wi*
 Q_wq   quickref.txt    /*Q_wq*
+QuickFixCmdPost        autocmd.txt     /*QuickFixCmdPost*
+QuickFixCmdPre autocmd.txt     /*QuickFixCmdPre*
 Quickfix       quickfix.txt    /*Quickfix*
 R      change.txt      /*R*
 RISC-OS        os_risc.txt     /*RISC-OS*
@@ -4378,6 +4382,7 @@ cpo-!     options.txt     /*cpo-!*
 cpo-$  options.txt     /*cpo-$*
 cpo-%  options.txt     /*cpo-%*
 cpo-+  options.txt     /*cpo-+*
+cpo--  options.txt     /*cpo--*
 cpo-<  options.txt     /*cpo-<*
 cpo-A  options.txt     /*cpo-A*
 cpo-B  options.txt     /*cpo-B*
@@ -4524,6 +4529,7 @@ diW       motion.txt      /*diW*
 dialog gui_w32.txt     /*dialog*
 dialogs-added  version5.txt    /*dialogs-added*
 dib    motion.txt      /*dib*
+dict-identity  eval.txt        /*dict-identity*
 dict-modification      eval.txt        /*dict-modification*
 did_filetype() eval.txt        /*did_filetype()*
 diff   diff.txt        /*diff*
@@ -5460,6 +5466,7 @@ match()   eval.txt        /*match()*
 match-highlight        pattern.txt     /*match-highlight*
 matchend()     eval.txt        /*matchend()*
 matchit-install        usr_05.txt      /*matchit-install*
+matchlist()    eval.txt        /*matchlist()*
 matchstr()     eval.txt        /*matchstr()*
 max()  eval.txt        /*max()*
 mbyte-IME      mbyte.txt       /*mbyte-IME*
@@ -5830,6 +5837,8 @@ popup-menu        gui.txt /*popup-menu*
 popup-menu-added       version5.txt    /*popup-menu-added*
 ports-5.2      version5.txt    /*ports-5.2*
 ports-6        version6.txt    /*ports-6*
+posix-compliance       vi_diff.txt     /*posix-compliance*
+posix-screen-size      vi_diff.txt     /*posix-screen-size*
 postscr-syntax syntax.txt      /*postscr-syntax*
 postscr.vim    syntax.txt      /*postscr.vim*
 postscript-cjk-printing        print.txt       /*postscript-cjk-printing*
index d90c24abfd8d1747d03d186f70394f027fccc7cd..74c74fdb7ceb19a38c2e20df2f4be12737e8967e 100644 (file)
@@ -1,4 +1,4 @@
-*usr_41.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 04
+*usr_41.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 07
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -16,11 +16,12 @@ script.  There are a lot of them, thus this is a long chapter.
 |41.5| Executing an expression
 |41.6| Using functions
 |41.7| Defining a function
-|41.8| Exceptions
-|41.9| Various remarks
-|41.10|        Writing a plugin
-|41.11|        Writing a filetype plugin
-|41.12|        Writing a compiler plugin
+|41.8| Lists and Dictionaries
+|41.9| Exceptions
+|41.10|        Various remarks
+|41.11|        Writing a plugin
+|41.12|        Writing a filetype plugin
+|41.13|        Writing a compiler plugin
 
      Next chapter: |usr_42.txt|  Add new menus
  Previous chapter: |usr_40.txt|  Make new commands
@@ -42,7 +43,7 @@ Let's start with a simple example: >
        :let i = 1
        :while i < 5
        :  echo "count is" i
-       :  let i = i + 1
+       :  let i += 1
        :endwhile
 <
        Note:
@@ -50,8 +51,19 @@ Let's start with a simple example: >
        them when you type a command.  In a Vim script file they can be left
        out.  We will use them here anyway to make clear these are colon
        commands and make them stand out from Normal mode commands.
+       Note:
+       You can try out the examples by yanking the lines from the text here
+       and executing them with :@"
+
+The output of the example code is:
+
+       count is 1 ~
+       count is 2 ~
+       count is 3 ~
+       count is 4 ~
 
-The ":let" command assigns a value to a variable.  The generic form is: >
+In the first line the ":let" command assigns a value to a variable.  The
+generic form is: >
 
        :let {variable} = {expression}
 
@@ -66,61 +78,52 @@ the number one.
 The statements until the matching ":endwhile" are executed for as long as the
 condition is true.  The condition used here is the expression "i < 5".  This
 is true when the variable i is smaller than five.
-   The ":echo" command prints its arguments.  In this case the string "count
-is" and the value of the variable i.  Since i is one, this will print:
-
-       count is 1 ~
+       Note:
+       If you happen to write a while loop that keeps on running, you can
+       interrupt it by pressing CTRL-C (CTRL-Break on MS-Windows).
 
-Then there is another ":let i =" command.  The value used is the expression "i
-+ 1".  This adds one to the variable i and assigns the new value to the same
-variable.
-   The output of the example code is:
+The ":echo" command prints its arguments.  In this case the string "count is"
+and the value of the variable i.  Since i is one, this will print:
 
        count is 1 ~
-       count is 2 ~
-       count is 3 ~
-       count is 4 ~
 
-       Note:
-       If you happen to write a while loop that keeps on running, you can
-       interrupt it by pressing CTRL-C (CTRL-Break on MS-Windows).
-       Note:
-       You can try out the examples by yanking the lines from the text here
-       and executing them with :@"
+Then there is the ":let i += 1" command.  This does the same thing as
+":let i = i + 1".  This adds one to the variable i and assigns the new value
+to the same variable.
 
-The example was given to explain the commands, but you would really want to
+The example was given to explain the commands, but would you really want to
 make such a loop it can be written much more compact: >
 
        :for i in range(1, 4)
        :  echo "count is" i
        :endfor
 
-We won't explain how |:for| and |range()| work right now.  Follow the links if
-you are impatient.
+We won't explain how |:for| and |range()| work until later.  Follow the links
+if you are impatient.
 
 
 THREE KINDS OF NUMBERS
 
 Numbers can be decimal, hexadecimal or octal.  A hexadecimal number starts
-with "0x" or "0X".  For example "0x1f" is 31.  An octal number starts with a
-zero.  "017" is 15.  Careful: don't put a zero before a decimal number, it
-will be interpreted as an octal number!
+with "0x" or "0X".  For example "0x1f" is decimal 31.  An octal number starts
+with a zero.  "017" is decimal 15.  Careful: don't put a zero before a decimal
+number, it will be interpreted as an octal number!
    The ":echo" command always prints decimal numbers.  Example: >
 
        :echo 0x7f 036
 <      127 30 ~
 
 A number is made negative with a minus sign.  This also works for hexadecimal
-and octal numbers.   A minus sign is also for subtraction.  Compare this with
-the previous example: >
+and octal numbers.   A minus sign is also used for subtraction.  Compare this
+with the previous example: >
 
        :echo 0x7f -036
 <      97 ~
 
 White space in an expression is ignored.  However, it's recommended to use it
 for separating items, to make the expression easier to read.  For example, to
-avoid the confusion with a negative number, put a space between the minus sign
-and the following number: >
+avoid the confusion with a negative number above, put a space between the
+minus sign and the following number: >
 
        :echo 0x7f - 036
 
@@ -151,7 +154,7 @@ example, one script contains this code: >
        :let s:count = 1
        :while s:count < 5
        :  source other.vim
-       :  let s:count = s:count + 1
+       :  let s:count += 1
        :endwhile
 
 Since "s:count" is local to this script, you can be sure that sourcing the
@@ -202,15 +205,21 @@ exists() checks.  That's not what you want.
    The exclamation mark ! negates a value.  When the value was true, it
 becomes false.  When it was false, it becomes true.  You can read it as "not".
 Thus "if !exists()" can be read as "if not exists()".
-   What Vim calls true is anything that is not zero.  Only zero is false.
+   What Vim calls true is anything that is not zero.  Zero is false.
+       Note:
+       Vim automatically converts a string to a number when it is looking for
+       a number.  When using a string that doesn't start with a digit the
+       resulting number is zero.  Thus look out for this: >
+               :if "true"
+<      The "true" will be interpreted as a zero, thus as false!
 
 
 STRING VARIABLES AND CONSTANTS
 
 So far only numbers were used for the variable value.  Strings can be used as
-well.  Numbers and strings are the only two types of variables that Vim
-supports.  The type is dynamic, it is set each time when assigning a value to
-the variable with ":let".
+well.  Numbers and strings are the basic types of variables that Vim supports.
+The type is dynamic, it is set each time when assigning a value to the
+variable with ":let".  More about types in |41.8|.
    To assign a string value to a variable, you need to use a string constant.
 There are two types of these.  First the string in double quotes: >
 
@@ -231,9 +240,9 @@ To avoid the need for a backslash, you can use a string in single quotes: >
        :echo name
 <      "peter" ~
 
-Inside a single-quote string all the characters are as they are.  The drawback
-is that it's impossible to include a single quote.  A backslash is taken
-literally as well, thus you can't use it to change the meaning of the
+Inside a single-quote string all the characters are as they are.  Only the
+single quote itself is special: you need to use two to get one.  A backslash
+is taken literally, thus you can't use it to change the meaning of the
 character after it.
    In double-quote strings it is possible to use special characters.  Here are
 a few useful ones:
@@ -281,7 +290,8 @@ do something and restore the old value.  Example: >
        :let &ic = save_ic
 
 This makes sure the "The Start" pattern is used with the 'ignorecase' option
-off.  Still, it keeps the value that the user had set.
+off.  Still, it keeps the value that the user had set.  (Another way to do
+this would be to add "\C" to the pattern, see |/\C|.)
 
 
 MATHEMATICS
@@ -387,7 +397,7 @@ ones:
 
 The result is one if the condition is met and zero otherwise.  An example: >
 
-       :if v:version >= 600
+       :if v:version >= 700
        :  echo "congratulations"
        :else
        :  echo "you are using an old version, upgrade!"
@@ -428,8 +438,8 @@ pattern, like what's used for searching.  Example: >
        :endif
 
 Notice the use of a single-quote string for the pattern.  This is useful,
-because backslashes need to be doubled in a double-quote string and patterns
-tend to contain many backslashes.
+because backslashes would need to be doubled in a double-quote string and
+patterns tend to contain many backslashes.
 
 The 'ignorecase' option is used when comparing strings.  When you don't want
 that, append "#" to match case and "?" to ignore case.  Thus "==?" compares
@@ -464,6 +474,8 @@ Example: >
 The ":sleep" command makes Vim take a nap.  The "50m" specifies fifty
 milliseconds.  Another example is ":sleep 4", which sleeps for four seconds.
 
+Even more looping can be done with the ":for" command, see below in |41.8|.
+
 ==============================================================================
 *41.5* Executing an expression
 
@@ -503,6 +515,17 @@ This inserts "new text " in the current line.  Notice the use of the special
 key "\<Esc>".  This avoids having to enter a real <Esc> character in your
 script.
 
+If you don't want to execute a string but evaluate it to get its expression
+value, you can use the eval() function: >
+
+       :let optname = "path"
+       :let optval = eval('&' . optname)
+
+A "&" character is prepended to "path", thus the argument to eval() is
+"&path".  The result will then be the value of the 'path' option.
+   The same thing can be done with: >
+       :exe 'let optval = &' . optname
+
 ==============================================================================
 *41.6* Using functions
 
@@ -526,9 +549,9 @@ A function can be called in an expression.  Example: >
        :let repl = substitute(line, '\a', "*", "g")
        :call setline(".", repl)
 
-The getline() function obtains a line from the current file.  Its argument is
-a specification of the line number.  In this case "." is used, which means the
-line where the cursor is.
+The getline() function obtains a line from the current buffer.  Its argument
+is a specification of the line number.  In this case "." is used, which means
+the line where the cursor is.
    The substitute() function does something similar to the ":substitute"
 command.  The first argument is the string on which to perform the
 substitution.  The second argument is the pattern, the third the replacement
@@ -567,7 +590,6 @@ String manipulation:
        submatch()              get a specific match in a ":substitute"
        strpart()               get part of a string
        expand()                expand special keywords
-       type()                  type of a variable
        iconv()                 convert text from one encoding to another
 
 List manipulation:
@@ -588,11 +610,10 @@ List manipulation:
        join()                  join List items into a String
        string()                String representation of a List
        call()                  call a function with List as arguments
+       index()                 index of a value in a list
        max()                   maximum value in a List
        min()                   minimum value in a List
        count()                 count number of times a value appears in a List
-       getline()               get List with buffer lines
-       append()                append List of lines to the buffer
 
 Dictionary manipulation:
        get()                   get an entries without error for wrong key
@@ -622,9 +643,9 @@ Working with text in the current buffer:
        wincol()                window column number of the cursor
        winline()               window line number of the cursor
        cursor()                position the cursor at a line/column
-       getline()               get a line from the buffer
+       getline()               get a line or list of lines from the buffer
        setline()               replace a line in the buffer
-       append()                append {string} below line {lnum}
+       append()                append line or list of lines in the buffer
        indent()                indent of a specific line
        cindent()               indent according to C indenting
        lispindent()            indent according to Lisp indenting
@@ -713,6 +734,7 @@ Vim server:
        remote_foreground()     move the Vim server window to the foreground
 
 Various:
+       type()                  type of a variable
        mode()                  get current editing mode
        visualmode()            last visual mode used
        hasmapto()              check if a mapping exists
@@ -792,6 +814,15 @@ The complete function definition is as follows: >
        :  return smaller
        :endfunction
 
+For people who like short functions, this does the same thing: >
+
+       :function Min(num1, num2)
+       :  if a:num1 < a:num2
+       :    return a:num1
+       :  endif
+       :  return a:num2
+       :endfunction
+
 A user defined function is called in exactly the same way as a builtin
 function.  Only the name is different.  The Min function can be used like
 this: >
@@ -879,6 +910,9 @@ This uses the ":echohl" command to specify the highlighting used for the
 following ":echo" command.  ":echohl None" stops it again.  The ":echon"
 command works like ":echo", but doesn't output a line break.
 
+You can also use the a:000 variable, it is a List of all the "..." arguments.
+See |a:000|.
+
 
 LISTING FUNCTIONS
 
@@ -915,8 +949,327 @@ To delete the Show() function: >
 
 You get an error when the function doesn't exist.
 
+
+FUNCTION REFERENCES
+
+Sometimes it can be useful to have a variable point to one function or
+another.  You can do it with the function() function.  It turns the name of a
+function into a reference: >
+
+       :let result = 0         " or 1
+       :function! Right()
+       :  return 'Right!'
+       :endfunc
+       :function! Wrong()
+       :  return 'Wrong!'
+       :endfunc
+       :
+       :if result == 1
+       :  let Afunc = function('Right')
+       :else
+       :  let Afunc = function('Wrong')
+       :endif
+       :echo call(Afunc, [])
+<      Wrong! ~
+
+Note that the name of a variable that holds a function reference must start
+with a capital.  Otherwise it could be confused with the name of a builtin
+function.
+   The way to invoke a function that a variable refers to is with the call()
+function.  Its first argument is the function reference, the second argument
+is a List with arguments.
+
+Function references are most useful in combination with a Dictionary, as is
+explained in the next section.
+
+==============================================================================
+*41.8* Lists and Dictionaries
+
+So far we have used the basic types String and Number.  Vim also supports two
+composite types: List and Dictionary.
+
+A List is an ordered sequence of things.  The things can be any kind of value,
+thus you can make a List of numbers, a List of Lists and even a List of mixed
+items.  To create a List with three strings: >
+
+       :let alist = ['aap', 'mies', 'noot']
+
+The List items are enclosed in square brackets and separated by commas.  To
+create an empty List: >
+
+       :let alist = []
+
+You can add items to a List with the add() function: >
+
+       :let alist = []
+       :call add(alist, 'foo')
+       :call add(alist, 'bar')
+       :echo alist
+<      ['foo', 'bar'] ~
+
+List concatenation is done with +: >
+
+       :echo alist + ['foo', 'bar']
+<      ['foo', 'bar', 'foo', 'bar'] ~
+
+Or, if you want to extend a List directly: >
+
+       :let alist = ['one']
+       :call extend(alist, ['two', 'three'])
+       :echo alist
+<      ['one', 'two', 'three'] ~
+
+Notice that using add() will have a different effect: >
+
+       :let alist = ['one']
+       :call add(alist, ['two', 'three'])
+       :echo alist
+<      ['one', ['two', 'three']] ~
+
+The second argument of add() is added as a single item.
+
+
+FOR LOOP
+
+One of the nice things you can do with a List is iterate over it: >
+
+       :let alist = ['one', 'two', 'three']
+       :for n in alist
+       :  echo n
+       :endfor
+<      one ~
+       two ~
+       three ~
+
+This will loop over each element in List "alist", assigning the value to
+variable "n".  The generic form of a for loop is: >
+
+       :for {varname} in {listexpression}
+       :  {commands}
+       :endfor
+
+To loop a certain number of times you need a List of a specific length.  The
+range() function creates one for you: >
+
+       :for a in range(3)
+       :  echo a
+       :endfor
+<      0 ~
+       1 ~
+       2 ~
+
+Notice that the first item of the List that range() produces is zero, thus the
+last item is one less than the length of the list.
+   You can also specify the maximum value, the stride and even go backwards: >
+
+       :for a in range(8, 4, -2)
+       :  echo a
+       :endfor
+<      8 ~
+       6 ~
+       4 ~
+
+A more useful example, looping over lines in the buffer: >
+
+        :for line in getline(1, 20)
+        :  if line =~ "Date: "
+        :    echo matchstr(line, 'Date: \zs.*')
+        :  endif
+        :endfor
+
+This looks into lines 1 to 20 (inclusive) and echoes any date found in there.
+
+
+DICTIONARIES
+
+A Dictionary stores key-value pairs.  You can quickly lookup a value if you
+know the key.  A Dictionary is created with curly braces: >
+       
+       :let uk2nl = {'one': 'een', 'two': 'twee', 'three': 'drie'}
+
+Now you can lookup words by putting the key in square brakets: >
+
+       :echo uk2nl['two']
+<      twee ~
+
+The generic form for defining a Dictionary is: >
+
+       {<key> : <value>, ...}
+
+An empty Dictionary is one without any keys: >
+
+       {}
+
+The possibilities with Dictionaries are numerous.  There are various functions
+for them as well.  For example, you can obtain a list of the keys and loop
+over them: >
+
+       :for key in keys(uk2nl)
+       :  echo key
+       :endfor
+<      three ~
+       one ~
+       two ~
+
+The will notice the items are not ordered.  You can sort the list to get a
+specific order: >
+
+       :for key in sort(keys(uk2nl))
+       :  echo key
+       :endfor
+<      one ~
+       three ~
+       two ~
+
+But you can never get back the order in which items are defined.  For that you
+need to use a List, it stores items in an ordered sequence.
+
+
+DICTIONARY FUNCTIONS
+
+The items in a Dictionary can normally be obtained with an index in square
+brackets: >
+
+       :echo uk2nl['one']
+<      een ~
+
+A method that does the same, but without so many punctuation characters: >
+
+       :echo uk2nl.one
+<      een ~
+
+This only works for a key that is made of ASCII letters, digits and the
+underscore.  You can also assign a new value this way: >
+
+       :let uk2nl.four = 'vier'
+       :echo uk2nl
+<      {'three': 'drie', 'four': 'vier', 'one': 'een', 'two': 'twee'} ~
+
+And now for something special: you can directly define a function and store a
+reference to it in the dictionary: >
+
+       :function uk2nl.translate(line) dict
+       :  return join(map(split(a:line), 'get(self, v:val, "???")'))
+       :endfunction
+
+Let's first try it out: >
+
+       :echo uk2nl.translate('three two five one')
+<      drie twee ??? een ~
+
+The first special thing you notice is the "dict" at the end of the ":function"
+line.  This marks the function as being used from a Dictionary.  The "self"
+local variable will then refer to that Dictionary.
+   Now let's break up the complicated return command: >
+
+       split(a:line)
+
+The split() function takes a string, chops it into white separated words
+and returns a list with these words.  Thus in the example it returns: >
+
+       :echo split('three two five one')
+<      ['three', 'two', 'five', 'one'] ~
+
+This list is the first argument to the map() function.  This will go through
+the list, evaluating its second argument with "v:val" set to the value of each
+item.  This is a shortcut to using a for loop.  This command: >
+
+       :let alist = map(split(a:line), 'get(self, v:val, "???")')
+
+Is equivalent to: >
+
+       :let alist = split(a:line)
+       :for idx in range(len(alist))
+       :  let alist[idx] = get(self, alist[idx], "???")
+       :endfor
+
+The get() function checks if a key is present in a Dictionary.  If it is, then
+the value is retrieved.  If it isn't, then the default value is returned, in
+the example it's '???'.  This is a covenient way to handle situations where a
+key may not be present and you don't want an error message.
+
+The join() function does the opposite of split(): it joins together a list of
+words, putting a space in between.
+  This combination of split(), map() and join() is a nice way to filter a line
+of words in a very compact way.
+
+
+OBJECT ORIENTED PROGRAMMING
+
+Now that you can put both values and functions in a Dictionary, you can
+actually use a Dictionary like an object.
+   Above we used a Dictionary for translating Dutch to English.  We might want
+to do the same for other languages.  Let's first make an object (aka
+Dictionary) that has the translate function, but no words to translate: >
+
+       :let transdict = {}
+       :function transdict.translate(line) dict
+       :  return join(map(split(a:line), 'get(self.words, v:val, "???")'))
+       :endfunction
+
+It's slightly different from the function above, using 'self.words' to lookup
+word translations.  But we don't have a self.words.  Thus you could call this
+an abstract class.
+
+Now we can instantiate a Dutch translation object: >
+
+       :let uk2nl = copy(transdict)
+       :let uk2nl.words = {'one': 'een', 'two': 'twee', 'three': 'drie'}
+       :echo uk2nl.translate('three one')
+<      drie een ~
+
+And a German translator: >
+
+       :let uk2de = copy(transdict)
+       :let uk2de.words = {'one': 'ein', 'two': 'zwei', 'three': 'drei'}
+       :echo uk2de.translate('three one')
+<      drei ein ~
+
+You see that the copy() function is used to make a copy of the "transdict"
+Dictionary and then the copy is changed to add the words.  The original
+remains the same, of course.
+
+Now you can go one step further, and use your preferred translator: >
+
+       :if $LANG =~ "de"
+       :  let trans = uk2de
+       :else
+       :  let trans = uk2nl
+       :endif
+       :echo trans.translate('one two three')
+<      een twee drie ~
+
+Here "trans" refers to one of the two objects (Dictionaries).  No copy is
+made.  More about List and Dictionary identity can be found at |list-identity|
+and |dict-identity|.
+
+Now you might use a language that isn't supported.  You can overrule the
+translate() function to do nothing: >
+
+       :let uk2uk = copy(transdict)
+       :function! uk2uk.translate(line)
+       :  return a:line
+       :endfunction
+       :echo uk2uk.translate('three one wladiwostok')
+<      three one wladiwostok ~
+
+Notice that a ! was used to overwrite the existing function reference.  Now
+use "uk2uk" when no recognized language is found: >
+
+       :if $LANG =~ "de"
+       :  let trans = uk2de
+       :elseif $LANG =~ "nl"
+       :  let trans = uk2nl
+       :else
+       :  let trans = uk2uk
+       :endif
+       :echo trans.translate('one two three')
+<      one two three ~
+
+For further reading see |Lists| and |Dictionaries|.
+
 ==============================================================================
-*41.8* Exceptions
+*41.9* Exceptions
 
 Let's start with an example: >
 
@@ -973,7 +1326,7 @@ More information about exception handling can be found in the reference
 manual: |exception-handling|.
 
 ==============================================================================
-*41.9* Various remarks
+*41.10*        Various remarks
 
 Here is a summary of items that apply to Vim scripts.  They are also mentioned
 elsewhere, but form a nice checklist.
@@ -1131,7 +1484,7 @@ Example: >
        let XXX_loaded = 1
 
 ==============================================================================
-*41.10*        Writing a plugin                                *write-plugin*
+*41.11*        Writing a plugin                                *write-plugin*
 
 You can write a Vim script in such a way that many people can use it.  This is
 called a plugin.  Vim users can drop your script in their plugin directory and
@@ -1544,13 +1897,13 @@ hasmapto()              Function to test if the user already defined a mapping
 exists(":Cmd")         Check if a user command already exists.
 
 ==============================================================================
-*41.11*        Writing a filetype plugin       *write-filetype-plugin* *ftplugin*
+*41.12*        Writing a filetype plugin       *write-filetype-plugin* *ftplugin*
 
 A filetype plugin is like a global plugin, except that it sets options and
 defines mappings for the current buffer only.  See |add-filetype-plugin| for
 how this type of plugin is used.
 
-First read the section on global plugins above |41.10|.  All that is said there
+First read the section on global plugins above |41.11|.  All that is said there
 also applies to filetype plugins.  There are a few extras, which are explained
 here.  The essential thing is that a filetype plugin should only have an
 effect on the current buffer.
@@ -1730,7 +2083,7 @@ exists("*s:Func") Check if a function was already defined.
 Also see |plugin-special|, the special things used for all plugins.
 
 ==============================================================================
-*41.12*        Writing a compiler plugin               *write-compiler-plugin*
+*41.13*        Writing a compiler plugin               *write-compiler-plugin*
 
 A compiler plugin sets options for use with a specific compiler.  The user can
 load it with the |:compiler| command.  The main use is to set the
index c371dda8fd2936628c51f3cbeaadb92a6f8f8591..51e8171eb86ed90cdadb1349128cbb70c0122e54 100644 (file)
@@ -1,4 +1,4 @@
-*usr_toc.txt*  For Vim version 7.0aa.  Last change: 2003 Aug 18
+*usr_toc.txt*  For Vim version 7.0aa.  Last change: 2005 Feb 06
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -286,11 +286,12 @@ Make Vim work as you like it.
                |41.5|  Executing an expression
                |41.6|  Using functions
                |41.7|  Defining a function
-               |41.8|  Exceptions
-               |41.9|  Various remarks
-               |41.10| Writing a plugin
-               |41.11| Writing a filetype plugin
-               |41.12| Writing a compiler plugin
+               |41.8|  Lists and Dictionaries
+               |41.9|  Exceptions
+               |41.10| Various remarks
+               |41.11| Writing a plugin
+               |41.12| Writing a filetype plugin
+               |41.13| Writing a compiler plugin
 
 |usr_42.txt|  Add new menus
                |42.1|  Introduction
index 84093032d3305d62b5ec2a925276140b27034539..0f794707307fdd87f133606495a64968e1b60566 100644 (file)
@@ -1,4 +1,4 @@
-*various.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 04
+*various.txt*   For Vim version 7.0aa.  Last change: 2005 Feb 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -140,7 +140,8 @@ g8                  Print the hex values of the bytes used in the
                        The display isn't updated while ":normal" is busy.
                        This implies that an insert command must be completed
                        (to start Insert mode, see |:startinsert|).  A ":"
-                       command must be completed as well.
+                       command must be completed as well.  And you can't use
+                       "Q" or "gQ" to start Ex mode.
                        {commands} cannot start with a space. Put a 1 (one)
                        before it, 1 space is one space.
                        The 'insertmode' option is ignored for {commands}.
index fe36e0ce652e845ccc29d700cd4705274fe22f13..60373bf902cb1bb5150f116ad3132e978a655769 100644 (file)
@@ -44,7 +44,7 @@ syn keyword vimErrSetting contained   hardtabs ht w1200 w300 w9600 wi window
 
 " AutoBuf Events {{{2
 syn case ignore
-syn keyword vimAutoEvent contained     BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave RemoteReply StdinReadPost StdinReadPre Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave 
+syn keyword vimAutoEvent contained     BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave QuickFixCmdPre QuickFixCmdPost RemoteReply StdinReadPost StdinReadPre Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave 
 
 " Highlight commonly used Groupnames {{{2
 syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo 
index 175256e64c41508ab33d46d7fac9fc09b529da82..a8897362d2a210b5b67f34d158a602bb1f903fc1 100644 (file)
@@ -5151,7 +5151,9 @@ cursor_up(n, upd_topline)
     if (n > 0)
     {
        lnum = curwin->w_cursor.lnum;
-       if (lnum <= 1)
+       /* This fails if the cursor is already in the first line or the count
+        * is larger than the line number and '-' is in 'cpoptions' */
+       if (lnum <= 1 || (n >= lnum && vim_strchr(p_cpo, CPO_MINUS) != NULL))
            return FAIL;
        if (n >= lnum)
            lnum = 1;
@@ -5212,7 +5214,11 @@ cursor_down(n, upd_topline)
        /* Move to last line of fold, will fail if it's the end-of-file. */
        (void)hasFolding(lnum, NULL, &lnum);
 #endif
-       if (lnum >= curbuf->b_ml.ml_line_count)
+       /* This fails if the cursor is already in the last line or would move
+        * beyound the last line and '-' is in 'cpoptions' */
+       if (lnum >= curbuf->b_ml.ml_line_count
+               || (lnum + n > curbuf->b_ml.ml_line_count
+                   && vim_strchr(p_cpo, CPO_MINUS) != NULL))
            return FAIL;
        if (lnum + n >= curbuf->b_ml.ml_line_count)
            lnum = curbuf->b_ml.ml_line_count;
index 82557febb7f9a0da4b7d034d3409237d318ff551..6c8ece95b1739a05f4cb947143dfc180568ac15c 100644 (file)
@@ -2339,11 +2339,12 @@ do_source(fname, check_other, is_vimrc)
        if (SCRIPT_NAME(current_SID) != NULL
                && (
 # ifdef UNIX
-                   /* compare dev/ino when possible, it catches symbolic
-                    * links */
-                   (stat_ok && SCRIPT_DEV(current_SID) != -1)
-                       ? (SCRIPT_DEV(current_SID) == st.st_dev
-                           && SCRIPT_INO(current_SID) == st.st_ino) :
+                   /* Compare dev/ino when possible, it catches symbolic
+                    * links.  Also compare file names, the inode may change
+                    * when the file was edited. */
+                   ((stat_ok && SCRIPT_DEV(current_SID) != -1)
+                       && (SCRIPT_DEV(current_SID) == st.st_dev
+                           && SCRIPT_INO(current_SID) == st.st_ino)) ||
 # endif
                fnamecmp(SCRIPT_NAME(current_SID), fname_exp) == 0))
            break;
index 5cecf30c67b0dcfca0318b8eb3e9050939716ad5..899e4c8f478f066d438b40f6ca7d81f7691f1ea7 100644 (file)
@@ -594,6 +594,14 @@ do_exmode(improved)
     MSG(_("Entering Ex mode.  Type \"visual\" to go to Normal mode."));
     while (exmode_active)
     {
+#ifdef FEAT_EX_EXTRA
+       /* Check for a ":normal" command and no more characters left. */
+       if (ex_normal_busy > 0 && typebuf.tb_len == 0)
+       {
+           exmode_active = FALSE;
+           break;
+       }
+#endif
        msg_scroll = TRUE;
        need_wait_return = FALSE;
        ex_pressedreturn = FALSE;
index e17e671efabe84c9e51c5e18e161b1ff99b2adc0..a7dfd9a75f4cb6e0f97b4a7287a1d2a4eb05c151 100644 (file)
@@ -996,8 +996,13 @@ getcmdline(firstc, count, indent)
 
        case ESC:       /* get here if p_wc != ESC or when ESC typed twice */
        case Ctrl_C:
-               /* In exmode it doesn't make sense to return. */
-               if (exmode_active)
+               /* In exmode it doesn't make sense to return. Except when
+                * ":normal" runs out of characters. */
+               if (exmode_active
+#ifdef FEAT_EX_EXTRA
+                       && (ex_normal_busy == 0 || typebuf.tb_len > 0)
+#endif
+                  )
                    goto cmdline_not_changed;
 
                gotesc = TRUE;          /* will free ccline.cmdbuff after
index ee1c90b883d46a17368eeaa4d12a70cbea056859..ea7c924d92d3e8ea5706b04615091d4d792d6a2b 100644 (file)
@@ -2701,6 +2701,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
        int             buf_fname_s = FALSE;
        int             did_cmd = FALSE;
        int             nofile_err = FALSE;
+       int             empty_memline = (buf->b_ml.ml_mfp == NULL);
 
        /*
         * Apply PRE aucocommands.
@@ -2772,7 +2773,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
         */
        if (!buf_valid(buf))
            buf = NULL;
-       if (buf == NULL || buf->b_ml.ml_mfp == NULL
+       if (buf == NULL || (buf->b_ml.ml_mfp == NULL && !empty_memline)
                                       || did_cmd || nofile_err || aborting())
        {
            --no_wait_return;
@@ -6650,6 +6651,8 @@ static struct event_name
     {"InsertChange",   EVENT_INSERTCHANGE},
     {"InsertEnter",    EVENT_INSERTENTER},
     {"InsertLeave",    EVENT_INSERTLEAVE},
+    {"QuickFixCmdPost",        EVENT_QUICKFIXCMDPOST},
+    {"QuickFixCmdPre", EVENT_QUICKFIXCMDPRE},
     {"RemoteReply",    EVENT_REMOTEREPLY},
     {"StdinReadPost",  EVENT_STDINREADPOST},
     {"StdinReadPre",   EVENT_STDINREADPRE},
@@ -8042,9 +8045,12 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
     else
     {
        sfname = vim_strsave(fname);
-       /* Don't try expanding FileType, Syntax or WindowID. */
-       if (event == EVENT_FILETYPE || event == EVENT_SYNTAX
-                                               || event == EVENT_REMOTEREPLY)
+       /* Don't try expanding FileType, Syntax, WindowID or QuickFixCmd* */
+       if (event == EVENT_FILETYPE
+               || event == EVENT_SYNTAX
+               || event == EVENT_REMOTEREPLY
+               || event == EVENT_QUICKFIXCMDPRE
+               || event == EVENT_QUICKFIXCMDPOST)
            fname = vim_strsave(fname);
        else
            fname = FullName_save(fname, FALSE);
index acb9d81faabbfc1d9cc24e948cfffd27226f6464..a1da3d0afbdf8f04ec1ec83aeace16cc870262d6 100644 (file)
@@ -886,7 +886,8 @@ gui_mch_compute_menu_height(id)
 #include "gui_x11_pm.h"
 
 static int check_xpm __ARGS((char_u *path));
-static char **get_toolbar_pixmap __ARGS((vimmenu_T *menu));
+static char **get_toolbar_pixmap __ARGS((vimmenu_T *menu, char **fname));
+static int add_pixmap_args __ARGS((vimmenu_T *menu, Arg *args, int n));
 
 /*
  * Read an Xpm file.  Return OK or FAIL.
@@ -916,16 +917,20 @@ check_xpm(path)
 
 /*
  * Allocated a pixmap for toolbar menu "menu".
+ * When it's to be read from a file, "fname" is set to the file name
+ * (in allocated memory).
  * Return a blank pixmap if it fails.
  */
     static char **
-get_toolbar_pixmap(menu)
+get_toolbar_pixmap(menu, fname)
     vimmenu_T  *menu;
+    char       **fname;
 {
     char_u     buf[MAXPATHL];          /* buffer storing expanded pathname */
     char       **xpm = NULL;           /* xpm array */
     int                res;
 
+    *fname = NULL;
     buf[0] = NUL;                      /* start with NULL path */
 
     if (menu->iconfile != NULL)
@@ -938,7 +943,10 @@ get_toolbar_pixmap(menu)
        if (res == FAIL && gui_find_bitmap(menu->name, buf, "xpm") == OK)
            res = check_xpm(buf);
        if (res == OK)
+       {
+           *fname = (char *)vim_strsave(buf);
            return tb_blank_xpm;
+       }
     }
 
     if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
@@ -952,6 +960,33 @@ get_toolbar_pixmap(menu)
 
     return xpm;
 }
+
+/*
+ * Add arguments for the toolbar pixmap to a menu item.
+ */
+    static int
+add_pixmap_args(menu, args, n)
+    vimmenu_T  *menu;
+    Arg                *args;
+    int                n;
+{
+    vim_free(menu->xpm_fname);
+    menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname);
+    if (menu->xpm == NULL)
+    {
+       XtSetArg(args[n], XmNlabelType, XmSTRING); n++;
+    }
+    else
+    {
+       if (menu->xpm_fname != NULL)
+       {
+           XtSetArg(args[n], XmNpixmapFile, menu->xpm_fname); n++;
+       }
+       XtSetArg(args[n], XmNpixmapData, menu->xpm); n++;
+       XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++;
+    }
+    return n;
+}
 #endif /* FEAT_TOOLBAR */
 
     void
@@ -1025,16 +1060,8 @@ gui_mch_add_menu_item(menu, idx)
            xms = XmStringCreate((char *)menu->dname, STRING_TAG);
            XtSetArg(args[n], XmNlabelString, xms); n++;
 
-           menu->xpm = get_toolbar_pixmap(menu);
-           if (menu->xpm == NULL)
-           {
-               XtSetArg(args[n], XmNlabelType, XmSTRING); n++;
-           }
-           else
-           {
-               XtSetArg(args[n], XmNpixmapData, menu->xpm); n++;
-               XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++;
-           }
+           n = add_pixmap_args(menu, args, n);
+
            type = xmEnhancedButtonWidgetClass;
        }
 
@@ -1264,16 +1291,7 @@ submenu_change(menu, colors)
                    int         n = 0;
                    Arg         args[18];
 
-                   mp->xpm = get_toolbar_pixmap(mp);
-                   if (menu->xpm == NULL)
-                   {
-                       XtSetArg(args[n], XmNlabelType, XmSTRING); n++;
-                   }
-                   else
-                   {
-                       XtSetArg(args[n], XmNpixmapData, menu->xpm); n++;
-                       XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++;
-                   }
+                   n = add_pixmap_args(mp, args, n);
                    XtSetValues(mp->id, args, n);
                }
 # ifdef FEAT_BEVAL
@@ -2846,6 +2864,23 @@ gui_mch_compute_toolbar_height()
     return (int)(height + (borders << 1));
 }
 
+    void
+motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
+    Pixel       *bgp;
+    Pixel       *fgp;
+    Pixel       *bsp;
+    Pixel       *tsp;
+    Pixel       *hsp;
+{
+    XtVaGetValues(toolBar,
+            XmNbackground, bgp,
+            XmNforeground, fgp,
+            XmNbottomShadowColor, bsp,
+            XmNtopShadowColor, tsp,
+            XmNhighlightColor, hsp,
+            NULL);
+}
+
 # ifdef FEAT_FOOTER
 /*
  * The next toolbar enter/leave callbacks should really do balloon help.  But
index aa22a88b185614d28623a595d32560989c147917..ff7d2e68d1e4476291eee475604be658d30da848 100644 (file)
@@ -292,13 +292,14 @@ set_pixmap(XmEnhancedButtonWidget eb)
     int                    x;
     int                    y;
     unsigned int    height, width, border, depth;
-    int                    status;
+    int                    status = 0;
     Pixmap         mask;
     Pixmap         pix = None;
     Pixmap         arm_pix = None;
     Pixmap         ins_pix = None;
     Pixmap         high_pix = None;
     char           **data = (char **) eb->enhancedbutton.pixmap_data;
+    char           *fname = (char *) eb->enhancedbutton.pixmap_file;
     int                    shift;
     GC             gc;
 
@@ -313,6 +314,7 @@ set_pixmap(XmEnhancedButtonWidget eb)
     root = RootWindow(dpy, scr);
 
     eb->label.pixmap = None;
+
     eb->enhancedbutton.pixmap_depth = 0;
     eb->enhancedbutton.pixmap_width = 0;
     eb->enhancedbutton.pixmap_height = 0;
@@ -321,6 +323,14 @@ set_pixmap(XmEnhancedButtonWidget eb)
     eb->enhancedbutton.highlight_pixmap = None;
     eb->enhancedbutton.insensitive_pixmap = None;
 
+    /* We use dynamic colors, get them now. */
+    motif_get_toolbar_colors(
+           &eb->core.background_pixel,
+           &eb->primitive.foreground,
+           &eb->primitive.bottom_shadow_color,
+           &eb->primitive.top_shadow_color,
+           &eb->primitive.highlight_color);
+
     /* Setup color subsititution table. */
     color[0].pixel = eb->core.background_pixel;
     color[1].pixel = eb->core.background_pixel;
@@ -337,9 +347,12 @@ set_pixmap(XmEnhancedButtonWidget eb)
     attr.colorsymbols = color;
     attr.numsymbols = XtNumber(color);
 
-    status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
+    if (fname)
+       status = XpmReadFileToPixmap(dpy, root, fname, &pix, &mask, &attr);
+    if (!fname || status != XpmSuccess)
+       status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
 
-    /* If somethin failed, we will fill in the default pixmap. */
+    /* If something failed, we will fill in the default pixmap. */
     if (status != XpmSuccess)
        status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix,
                                                                &mask, &attr);
index 2fc2260560d6ab5eed78a75b355adaebb7c92687..f3d7825f38689129aa4cac7c5cabd5856fc910a5 100644 (file)
@@ -2471,7 +2471,8 @@ onepage(dir, count)
     foldAdjustCursor();
 #endif
     cursor_correct();
-    beginline(BL_SOL | BL_FIX);
+    if (retval == OK)
+       beginline(BL_SOL | BL_FIX);
     curwin->w_valid &= ~(VALID_WCOL|VALID_WROW|VALID_VIRTCOL);
 
     /*
index 4a052925db240986de73c511d1b9723c7700e7ca..8541c3192150e7eafdf4b1804441a49a3b418223 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -5829,16 +5829,16 @@ clear_oparg(oap)
     vim_memset(oap, 0, sizeof(oparg_T));
 }
 
-static long    line_count_info __ARGS((char_u *line, long *wc, long limit, int eol_size));
+static long    line_count_info __ARGS((char_u *line, long *wc, long *cc, long limit, int eol_size));
 
 /*
- *  Count the number of characters and "words" in a line.
+ *  Count the number of bytes, characters and "words" in a line.
  *
  *  "Words" are counted by looking for boundaries between non-space and
  *  space characters.  (it seems to produce results that match 'wc'.)
  *
- *  Return value is character count; word count for the line is ADDED
- *  to "*wc".
+ *  Return value is byte count; word count for the line is added to "*wc".
+ *  Char count is added to "*cc".
  *
  *  The function will only examine the first "limit" characters in the
  *  line, stopping if it encounters an end-of-line (NUL byte).  In that
@@ -5846,16 +5846,19 @@ static long     line_count_info __ARGS((char_u *line, long *wc, long limit, int eol_
  *  the size of the EOL character.
  */
     static long
-line_count_info(line, wc, limit, eol_size)
+line_count_info(line, wc, cc, limit, eol_size)
     char_u     *line;
     long       *wc;
+    long       *cc;
     long       limit;
     int                eol_size;
 {
-    long       i, words = 0;
+    long       i;
+    long       words = 0;
+    long       chars = 0;
     int                is_word = 0;
 
-    for (i = 0; line[i] && i < limit; i++)
+    for (i = 0; line[i] && i < limit; )
     {
        if (is_word)
        {
@@ -5867,6 +5870,12 @@ line_count_info(line, wc, limit, eol_size)
        }
        else if (!vim_isspace(line[i]))
            is_word = 1;
+       ++chars;
+#ifdef FEAT_MBYTE
+       i += mb_ptr2len_check(line + i);
+#else
+       ++i;
+#endif
     }
 
     if (is_word)
@@ -5874,8 +5883,12 @@ line_count_info(line, wc, limit, eol_size)
     *wc += words;
 
     /* Add eol_size if the end of line was reached before hitting limit. */
-    if (!line[i] && i < limit)
+    if (line[i] == NUL && i < limit)
+    {
        i += eol_size;
+       chars += eol_size;
+    }
+    *cc += chars;
     return i;
 }
 
@@ -5891,12 +5904,14 @@ cursor_pos_info()
     char_u     buf1[20];
     char_u     buf2[20];
     linenr_T   lnum;
+    long       byte_count = 0;
+    long       byte_count_cursor = 0;
     long       char_count = 0;
     long       char_count_cursor = 0;
-    int                eol_size;
-    long       last_check = 100000L;
     long       word_count = 0;
     long       word_count_cursor = 0;
+    int                eol_size;
+    long       last_check = 100000L;
 #ifdef FEAT_VISUAL
     long       line_count_selected = 0;
     pos_T      min_pos, max_pos;
@@ -5956,12 +5971,12 @@ cursor_pos_info()
        for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum)
        {
            /* Check for a CTRL-C every 100000 characters. */
-           if (char_count > last_check)
+           if (byte_count > last_check)
            {
                ui_breakcheck();
                if (got_int)
                    return;
-               last_check = char_count + 100000L;
+               last_check = byte_count + 100000L;
            }
 
 #ifdef FEAT_VISUAL
@@ -6003,13 +6018,13 @@ cursor_pos_info()
                }
                if (s != NULL)
                {
-                   char_count_cursor += line_count_info(s,
-                                          &word_count_cursor, len, eol_size);
+                   byte_count_cursor += line_count_info(s, &word_count_cursor,
+                                          &char_count_cursor, len, eol_size);
                    if (lnum == curbuf->b_ml.ml_line_count
                            && !curbuf->b_p_eol
                            && curbuf->b_p_bin
                            && (long)STRLEN(s) < len)
-                       char_count_cursor -= eol_size;
+                       byte_count_cursor -= eol_size;
                }
            }
            else
@@ -6019,19 +6034,21 @@ cursor_pos_info()
                if (lnum == curwin->w_cursor.lnum)
                {
                    word_count_cursor += word_count;
-                   char_count_cursor = char_count +
-                       line_count_info(ml_get(lnum), &word_count_cursor,
+                   char_count_cursor += char_count;
+                   byte_count_cursor = byte_count +
+                       line_count_info(ml_get(lnum),
+                               &word_count_cursor, &char_count_cursor,
                                  (long)(curwin->w_cursor.col + 1), eol_size);
                }
            }
            /* Add to the running totals */
-           char_count += line_count_info(ml_get(lnum), &word_count,
-                                                     (long)MAXCOL, eol_size);
+           byte_count += line_count_info(ml_get(lnum), &word_count,
+                                        &char_count, (long)MAXCOL, eol_size);
        }
 
        /* Correction for when last line doesn't have an EOL. */
        if (!curbuf->b_p_eol && curbuf->b_p_bin)
-           char_count -= eol_size;
+           byte_count -= eol_size;
 
 #ifdef FEAT_VISUAL
        if (VIsual_active)
@@ -6046,12 +6063,20 @@ cursor_pos_info()
            else
                buf1[0] = NUL;
 
-           sprintf((char *)IObuff,
-           _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"),
+           if (char_count_cursor == byte_count_cursor
+                   && char_count == byte_count)
+               sprintf((char *)IObuff, _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"),
                        buf1, line_count_selected,
                        (long)curbuf->b_ml.ml_line_count,
                        word_count_cursor, word_count,
-                       char_count_cursor, char_count);
+                       byte_count_cursor, byte_count);
+           else
+               sprintf((char *)IObuff, _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"),
+                       buf1, line_count_selected,
+                       (long)curbuf->b_ml.ml_line_count,
+                       word_count_cursor, word_count,
+                       char_count_cursor, char_count,
+                       byte_count_cursor, byte_count);
        }
        else
 #endif
@@ -6062,20 +6087,29 @@ cursor_pos_info()
                    (int)curwin->w_virtcol + 1);
            col_print(buf2, (int)STRLEN(p), linetabsize(p));
 
-           sprintf((char *)IObuff,
-               _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"),
+           if (char_count_cursor == byte_count_cursor
+                   && char_count == byte_count)
+               sprintf((char *)IObuff, _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"),
+                   (char *)buf1, (char *)buf2,
+                   (long)curwin->w_cursor.lnum,
+                   (long)curbuf->b_ml.ml_line_count,
+                   word_count_cursor, word_count,
+                   byte_count_cursor, byte_count);
+           else
+               sprintf((char *)IObuff, _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld"),
                    (char *)buf1, (char *)buf2,
                    (long)curwin->w_cursor.lnum,
                    (long)curbuf->b_ml.ml_line_count,
                    word_count_cursor, word_count,
-                   char_count_cursor, char_count);
+                   char_count_cursor, char_count,
+                   byte_count_cursor, byte_count);
        }
 
 #ifdef FEAT_MBYTE
-       char_count = bomb_size();
-       if (char_count > 0)
+       byte_count = bomb_size();
+       if (byte_count > 0)
            sprintf((char *)IObuff + STRLEN(IObuff), _("(+%ld for BOM)"),
-                                                                 char_count);
+                                                                 byte_count);
 #endif
        /* Don't shorten this message, the user asked for it. */
        p = p_shm;
index 0c6178d6320dd2da107cc7c44eefd1a3077fd36d..ffeaf8644f098ba5f6ba5e051c8283f0dfbf5c19 100644 (file)
@@ -2593,18 +2593,19 @@ set_init_1()
 
     /*
      * Find default value for 'shell' option.
+     * Don't use it if it is empty.
      */
-    if ((p = mch_getenv((char_u *)"SHELL")) != NULL
+    if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
 # ifdef __EMX__
-           || (p = mch_getenv((char_u *)"EMXSHELL")) != NULL
+           || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL)
 # endif
-           || (p = mch_getenv((char_u *)"COMSPEC")) != NULL
+           || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
 # ifdef WIN3264
-           || (p = default_shell()) != NULL
+           || ((p = default_shell()) != NULL && *p != NUL)
 # endif
 #endif
-       )
+           )
        set_string_default("sh", p);
 
 #ifdef FEAT_WILDIGN
index 1fb5488d392a22662bbbbaeacd77a7e50d8474bd..9be2c498894298a45fe8538d090fdf8d7bc18b26 100644 (file)
 #define CPO_MATCH      '%'
 #define CPO_STAR       '*'     /* ":*" means ":@" */
 #define CPO_PLUS       '+'     /* ":write file" resets 'modified' */
+#define CPO_MINUS      '-'     /* "9-" fails at and before line 9 */
 #define CPO_SPECI      '<'     /* don't recognize <> in mappings */
 #define CPO_DEFAULT    "aABceFs"
-#define CPO_ALL                "aAbBcCdDeEfFgiIjJkKlLmMnoOprRsStuvwWxy$!%*+<"
+#define CPO_ALL                "aAbBcCdDeEfFgiIjJkKlLmMnoOprRsStuvwWxy$!%*-+<"
 
 /* characters for p_ww option: */
 #define WW_ALL         "bshl<>[],~"
index 4dd38ce7e0e5af11979c03ff4e778e87ceda4528..c09638f4c8b2253002bfd8f61485ba4e8e79242b 100644 (file)
@@ -3222,8 +3222,9 @@ mch_get_shellsize()
 
     /*
      * 2. get size from environment
+     *    When being POSIX compliant this overrules the ioctl() values!
      */
-    if (columns == 0 || rows == 0)
+    if (columns == 0 || rows == 0 || getenv("VIM_POSIX") != NULL)
     {
        if ((p = (char_u *)getenv("LINES")))
            rows = atoi((char *)p);
index 94a7c4519c98875826a7f8e92800aaaa8630cbdf..8c49d2f2f482d9fd0b17c036ed3a2402e76c6798 100644 (file)
@@ -34,6 +34,7 @@ void gui_mch_enable_footer __ARGS((int showit));
 void gui_mch_set_footer __ARGS((char_u *s));
 void gui_mch_show_toolbar __ARGS((int showit));
 int gui_mch_compute_toolbar_height __ARGS((void));
+void motif_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp));
 void gui_motif_menu_fontlist __ARGS((Widget id));
 void gui_mch_find_dialog __ARGS((exarg_T *eap));
 void gui_mch_replace_dialog __ARGS((exarg_T *eap));
index a4110035f43893fe09c47ac2be26cd3870d2b1e2..a8544b34e585a2733b4fd46051c193b5c58c5f10 100644 (file)
@@ -2083,9 +2083,27 @@ grep_internal(cmdidx)
 ex_make(eap)
     exarg_T    *eap;
 {
-    char_u     *name;
+    char_u     *fname;
     char_u     *cmd;
     unsigned   len;
+#ifdef FEAT_AUTOCMD
+    char_u     *au_name = NULL;
+
+    switch (eap->cmdidx)
+    {
+       case CMD_make: au_name = (char_u *)"make"; break;
+       case CMD_grep: au_name = (char_u *)"grep"; break;
+       case CMD_grepadd: au_name = (char_u *)"grepadd"; break;
+       default: break;
+    }
+    if (au_name != NULL)
+    {
+       apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
+                                              curbuf->b_fname, TRUE, curbuf);
+       if (did_throw || force_abort)
+           return;
+    }
+#endif
 
     /* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */
     if (grep_internal(eap->cmdidx))
@@ -2095,24 +2113,24 @@ ex_make(eap)
     }
 
     autowrite_all();
-    name = get_mef_name();
-    if (name == NULL)
+    fname = get_mef_name();
+    if (fname == NULL)
        return;
-    mch_remove(name);      /* in case it's not unique */
+    mch_remove(fname);     /* in case it's not unique */
 
     /*
      * If 'shellpipe' empty: don't redirect to 'errorfile'.
      */
     len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(eap->arg) + 1;
     if (*p_sp != NUL)
-       len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(name) + 3;
+       len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3;
     cmd = alloc(len);
     if (cmd == NULL)
        return;
     sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg,
                                                               (char *)p_shq);
     if (*p_sp != NUL)
-       append_redir(cmd, p_sp, name);
+       append_redir(cmd, p_sp, fname);
     /*
      * Output a newline if there's something else than the :make command that
      * was typed (in which case the cursor is in column 0).
@@ -2132,14 +2150,20 @@ ex_make(eap)
     (void)char_avail();
 #endif
 
-    if (qf_init(name, eap->cmdidx != CMD_make ? p_gefm : p_efm,
+    if (qf_init(fname, eap->cmdidx != CMD_make ? p_gefm : p_efm,
                                               eap->cmdidx != CMD_grepadd) > 0
            && !eap->forceit)
        qf_jump(0, 0, FALSE);           /* display first error */
 
-    mch_remove(name);
-    vim_free(name);
+    mch_remove(fname);
+    vim_free(fname);
     vim_free(cmd);
+
+#ifdef FEAT_AUTOCMD
+    if (au_name != NULL)
+       apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
+                                              curbuf->b_fname, TRUE, curbuf);
+#endif
 }
 
 /*
@@ -2275,6 +2299,23 @@ ex_vimgrep(eap)
     char_u     *save_ei = NULL;
     aco_save_T aco;
 #endif
+#ifdef FEAT_AUTOCMD
+    char_u     *au_name =  NULL;
+
+    switch (eap->cmdidx)
+    {
+       case CMD_vimgrep: au_name = (char_u *)"vimgrep"; break;
+       case CMD_vimgrepadd: au_name = (char_u *)"vimgrepadd"; break;
+       default: break;
+    }
+    if (au_name != NULL)
+    {
+       apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
+                                              curbuf->b_fname, TRUE, curbuf);
+       if (did_throw || force_abort)
+           return;
+    }
+#endif
 
     /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
     save_cpo = p_cpo;
@@ -2496,6 +2537,12 @@ jumpend:
     else
        EMSG2(_(e_nomatch2), s);
 
+#ifdef FEAT_AUTOCMD
+    if (au_name != NULL)
+       apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
+                                              curbuf->b_fname, TRUE, curbuf);
+#endif
+
 theend:
     vim_free(regmatch.regprog);
 
index ff4d2d64e460b32a3a6948bc145d96b3e156bdb6..8a81611c2b78ec16d010b749c320d06d6c31f413 100644 (file)
@@ -1967,6 +1967,7 @@ struct VimMenu
 #ifdef FEAT_GUI_MOTIF
     int                sensitive;          /* turn button on/off */
     char       **xpm;              /* pixmap data */
+    char       *xpm_fname;         /* file with pixmap data */
 #endif
 #ifdef FEAT_GUI_ATHENA
     Pixmap     image;              /* Toolbar image */
index 187babb41b52b1e30ef5700e53ab04c59e70274f..6dfc7d5fc7773af4e354cebba264ee949bca3f69 100644 (file)
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT      "vim70aa"
 #define VIM_VERSION_SHORT      "7.0aa"
 #define VIM_VERSION_MEDIUM     "7.0aa ALPHA"
-#define VIM_VERSION_LONG       "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 5)"
-#define VIM_VERSION_LONG_DATE  "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 5, compiled "
+#define VIM_VERSION_LONG       "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 7)"
+#define VIM_VERSION_LONG_DATE  "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 7, compiled "
index 98d33317a0c308ef66a31ff7379ad6e6cacfc038..9ffaf9f05bfbb77aeb155d1c3a3528492ebee461 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1074,6 +1074,8 @@ enum auto_event
     EVENT_INSERTCHANGE,                /* when changing Insert/Replace mode */
     EVENT_INSERTENTER,         /* when entering Insert mode */
     EVENT_INSERTLEAVE,         /* when leaving Insert mode */
+    EVENT_QUICKFIXCMDPOST,     /* after :make, :grep etc */
+    EVENT_QUICKFIXCMDPRE,      /* before :make, :grep etc */
     EVENT_STDINREADPOST,       /* after reading from stdin */
     EVENT_STDINREADPRE,                /* before reading from stdin */
     EVENT_SYNTAX,              /* syntax selected */