updated for version 7.0052
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.0aa. Last change: 2005 Feb 21
|
||||
*change.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -527,7 +527,7 @@ comment (starting with '"') after the ":!" command.
|
||||
|
||||
4.2 Substitute *:substitute*
|
||||
*:s* *:su*
|
||||
:[range]s[ubstitute]/{pattern}/{string}/[&][#][c][e][g][p][r][i][I] [count]
|
||||
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
|
||||
For each line in [range] replace a match of {pattern}
|
||||
with {string}.
|
||||
For the {pattern} see |pattern|.
|
||||
@ -539,31 +539,31 @@ comment (starting with '"') after the ":!" command.
|
||||
starting with the last line in [range]. When [range]
|
||||
is omitted start in the current line.
|
||||
Also see |cmdline-ranges|.
|
||||
See |:s_flags| for the flags.
|
||||
See |:s_flags| for [flags].
|
||||
|
||||
:[range]s[ubstitute] [#][c][e][g][p][r][i][I] [count]
|
||||
:[range]&[&][#][c][e][g][p][r][i][I] [count] *:&*
|
||||
:[range]s[ubstitute] [flags] [count]
|
||||
:[range]&[&][flags] [count] *:&*
|
||||
Repeat last :substitute with same search pattern and
|
||||
substitute string, but without the same flags. You
|
||||
may add extra flags (see |:s_flags|).
|
||||
may add [flags], see |:s_flags|.
|
||||
Note that after ":substitute" the '&' flag can't be
|
||||
used, it's recognized as a pattern separator.
|
||||
The space between ":substitute" and the 'c', 'g' and
|
||||
'r' flags isn't required, but in scripts it's a good
|
||||
idea to keep it to avoid confusion.
|
||||
|
||||
:[range]~[&][#][c][e][g][p][r][i][I] [count] *:~*
|
||||
:[range]~[&][flags] [count] *:~*
|
||||
Repeat last substitute with same substitute string
|
||||
but with last used search pattern. This is like
|
||||
":&r". See |:s_flags| for the flags.
|
||||
":&r". See |:s_flags| for [flags].
|
||||
|
||||
*&*
|
||||
*&*
|
||||
& Synonym for ":s//~/" (repeat last substitute). Note
|
||||
that the flags are not remembered, thus it might
|
||||
actually work differently. You can use ":&&" to keep
|
||||
the flags.
|
||||
|
||||
*g&*
|
||||
*g&*
|
||||
g& Synonym for ":%s//~/&" (repeat last substitute on all
|
||||
lines with the same flags).
|
||||
Mnemonic: global substitute. {not in Vi}
|
||||
@ -629,6 +629,10 @@ The flags that you can use for the substitute commands:
|
||||
options are not used.
|
||||
{not in Vi}
|
||||
|
||||
[n] Report the number of matches, do not actually substitute. The [c]
|
||||
flag is ignored. The matches are reported as if 'report' is zero.
|
||||
Useful to |count-items|.
|
||||
|
||||
[p] Print the line containing the last substitute.
|
||||
|
||||
[#] Like [p] and prepend the line number.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*debugger.txt* For Vim version 7.0aa. Last change: 2005 Jan 29
|
||||
*debugger.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Gordon Prieur
|
||||
@ -90,8 +90,8 @@ was to allow Sun's Visual WorkShop debugger to display expression evaluations.
|
||||
However, the feature was implemented in as general a manner as possible and
|
||||
could be used for displaying other information as well.
|
||||
|
||||
The Balloon Evaluation has some settable parameters too. The font list and
|
||||
colors can be set via X resources (XmNballoonEvalFontList,
|
||||
The Balloon Evaluation has some settable parameters too. For Motif the font
|
||||
list and colors can be set via X resources (XmNballoonEvalFontList,
|
||||
XmNballoonEvalBackground, and XmNballoonEvalForeground).
|
||||
The 'balloondelay' option sets the delay before an attempt is made to show a
|
||||
balloon.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.0aa. Last change: 2005 Feb 21
|
||||
*eval.txt* For Vim version 7.0aa. Last change: 2005 Feb 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -961,7 +961,7 @@ variable internal variable
|
||||
See below |internal-variables|.
|
||||
|
||||
|
||||
function call *expr-function* *E116* *E117* *E118* *E119* *E120*
|
||||
function call *expr-function* *E116* *E118* *E119* *E120*
|
||||
-------------
|
||||
function(expr1, ...) function call
|
||||
See below |functions|.
|
||||
@ -1270,6 +1270,10 @@ v:prevcount The count given for the last but one Normal mode command.
|
||||
:vmap % <Esc>:call MyFilter(v:prevcount)<CR>
|
||||
< Read-only.
|
||||
|
||||
*v:profiling* *profiling-variable*
|
||||
v:profiling Normally zero. Set to one after using ":profile start".
|
||||
See |profiling|.
|
||||
|
||||
*v:progname* *progname-variable*
|
||||
v:progname Contains the name (with path removed) with which Vim was
|
||||
invoked. Allows you to do special initialisations for "view",
|
||||
@ -1396,6 +1400,7 @@ did_filetype() Number TRUE if FileType autocommand event used
|
||||
diff_filler( {lnum}) Number diff filler lines about {lnum}
|
||||
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
||||
empty( {expr}) Number TRUE if {expr} is empty
|
||||
errorlist() List list of quickfix items
|
||||
escape( {string}, {chars}) String escape {chars} in {string} with '\'
|
||||
eval( {string}) any evaluate {string} into its value
|
||||
eventhandler( ) Number TRUE if inside an event handler
|
||||
@ -1965,6 +1970,28 @@ empty({expr}) *empty()*
|
||||
For a long List this is much faster then comparing the length
|
||||
with zero.
|
||||
|
||||
errorlist() *errorlist()*
|
||||
Returns a list with all the current quickfix errors. Each
|
||||
list item is a dictionary with these entries:
|
||||
bufnr number of buffer that has the file name, use
|
||||
bufname() to get the name
|
||||
lnum line number in the buffer (first line is 1)
|
||||
col column number (first column is 1)
|
||||
vcol non-zero: column number is visual column
|
||||
zero: column number is byte index
|
||||
nr error number
|
||||
text description of the error
|
||||
type type of the error, 'E', '1', etc.
|
||||
valid non-zero: recognized error message
|
||||
|
||||
Useful application: Find pattern matches in multiple files and
|
||||
do something with them: >
|
||||
:vimgrep /theword/jg *.c
|
||||
:for d in errorlist()
|
||||
: echo bufname(d.bufnr) ':' d.lnum '=' d.text
|
||||
:endfor
|
||||
|
||||
|
||||
escape({string}, {chars}) *escape()*
|
||||
Escape the characters in {chars} that occur in {string} with a
|
||||
backslash. Example: >
|
||||
@ -3031,7 +3058,14 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()*
|
||||
:echo match("testing", "ing") " results in 4
|
||||
:echo match([1, 'x'], '\a') " results in 2
|
||||
< See |string-match| for how {pat} is used.
|
||||
|
||||
*strpbrk()*
|
||||
Vim doesn't have a strpbrk() function. But you can do: >
|
||||
:let sepidx = match(line, '[.,;: \t]')
|
||||
< *strcasestr()*
|
||||
Vim doesn't have a strcasestr() function. But you can add
|
||||
"\c" to the pattern to ignore case: >
|
||||
:let idx = match(haystack, '\cneedle')
|
||||
<
|
||||
When {count} is given use the {count}'th match. When a match
|
||||
is found in a String the search for the next one starts on
|
||||
character further. Thus this example results in 1: >
|
||||
@ -3063,6 +3097,13 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()*
|
||||
the match. Example: >
|
||||
:echo matchend("testing", "ing")
|
||||
< results in "7".
|
||||
*strspn()* *strcspn()*
|
||||
Vim doesn't have a strspn() or strcspn() function, but you can
|
||||
do it with matchend(): >
|
||||
:let span = matchend(line, '[a-zA-Z]')
|
||||
:let span = matchend(line, '[^a-zA-Z]')
|
||||
< Except that -1 is returned when there are no matches.
|
||||
|
||||
The {start}, if given, has the same meaning as for match(). >
|
||||
:echo matchend("testing", "ing", 2)
|
||||
< results in "7". >
|
||||
@ -3620,7 +3661,10 @@ stridx({haystack}, {needle} [, {start}]) *stridx()*
|
||||
:echo stridx("An Example", "Example") 3
|
||||
:echo stridx("Starting point", "Start") 0
|
||||
:echo stridx("Starting point", "start") -1
|
||||
<
|
||||
< *strstr()* *strchr()*
|
||||
stridx() works similar to the C function strstr(). When used
|
||||
with a single character it works similar to strchr().
|
||||
|
||||
*string()*
|
||||
string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||
String or a composition of them, then the result can be parsed
|
||||
@ -3673,7 +3717,10 @@ strridx({haystack}, {needle} [, {start}]) *strridx()*
|
||||
If the {needle} is empty the length of {haystack} is returned.
|
||||
See also |stridx()|. Examples: >
|
||||
:echo strridx("an angry armadillo", "an") 3
|
||||
<
|
||||
< *strrchr()*
|
||||
When used with a single character it works similar to the C
|
||||
function strrchr().
|
||||
|
||||
strtrans({expr}) *strtrans()*
|
||||
The result is a String, which is {expr} with all unprintable
|
||||
characters translated into printable characters |'isprint'|.
|
||||
@ -3769,7 +3816,7 @@ system({expr} [, {input}]) *system()* *E677*
|
||||
When {input} is given, this string is written to a file and
|
||||
passed as stdin to the command. The string is written as-is,
|
||||
you need to take care of using the correct line separators
|
||||
yourself.
|
||||
yourself. Pipes are not used.
|
||||
Note: newlines in {expr} may cause the command to fail. The
|
||||
characters in 'shellquote' and 'shellxquote' may also cause
|
||||
trouble.
|
||||
@ -4081,6 +4128,7 @@ path_extra Compiled with up/downwards search in 'path' and 'tags'
|
||||
perl Compiled with Perl interface.
|
||||
postscript Compiled with PostScript file printing.
|
||||
printer Compiled with |:hardcopy| support.
|
||||
profile Compiled with |:profile| support.
|
||||
python Compiled with Python interface.
|
||||
qnx QNX version of Vim.
|
||||
quickfix Compiled with |quickfix| support.
|
||||
@ -4384,6 +4432,8 @@ the "autoload" directory in 'runtimepath'.
|
||||
|
||||
Using an autocommand ~
|
||||
|
||||
This is introduced in the user manual, section |41.14|.
|
||||
|
||||
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
|
||||
@ -4400,6 +4450,8 @@ The file "~/vim/bufnetfuncs.vim" should then define functions that start with
|
||||
|
||||
Using an autoload script ~
|
||||
*autoload* *E746*
|
||||
This is introduced in the user manual, section |41.15|.
|
||||
|
||||
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: >
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*indent.txt* For Vim version 7.0aa. Last change: 2004 Sep 02
|
||||
*indent.txt* For Vim version 7.0aa. Last change: 2005 Feb 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -485,6 +485,20 @@ to get do loops indented in .f90 files and left alone in Fortran files with
|
||||
other extensions such as .for.
|
||||
|
||||
|
||||
PYTHON *python-indent*
|
||||
|
||||
The amount of indent can be set for the following situations. The examples
|
||||
given are de the defaults. Note that the variables are set to an expression,
|
||||
so that you can change the value of 'shiftwidth' later.
|
||||
|
||||
Indent after an open paren: >
|
||||
let g:pyindent_open_paren = '&sw * 2'
|
||||
Indent after a nested paren: >
|
||||
let g:pyindent_nested_paren = '&sw'
|
||||
Indent for a continuation line: >
|
||||
let g:pyindent_continue = '&sw * 2'
|
||||
|
||||
|
||||
VERILOG *verilog-indent*
|
||||
|
||||
General block statements such as if, for, case, always, initial, function,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 7.0aa. Last change: 2005 Jan 31
|
||||
*index.txt* For Vim version 7.0aa. Last change: 2005 Feb 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -1258,10 +1258,13 @@ The commands are sorted on the non-optional part of their name.
|
||||
|:options| :opt[ions] open the options-window
|
||||
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
|
||||
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
|
||||
|:print| :p[rint] print lines
|
||||
|:pclose| :pc[lose] close preview window
|
||||
|:pedit| :ped[it] edit file in the preview window
|
||||
|:perl| :pe[rl] execute Perl command
|
||||
|:print| :p[rint] print lines
|
||||
|:profile| :prof[ile] profiling functions and scripts
|
||||
|:promptfind| :pro[mtfind] open GUI dialog for searching
|
||||
|:promptrepl| :promtr[epl] open GUI dialog for search/replace
|
||||
|:perldo| :perld[o] execute Perl command for each line
|
||||
|:pop| :po[p] jump to older entry in tag stack
|
||||
|:popup| :pop[up] popup a menu by name
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.0aa. Last change: 2005 Feb 21
|
||||
*options.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -2986,7 +2986,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
font names a list can be specified, font names separated with commas.
|
||||
The first valid font is used.
|
||||
|
||||
When 'guifontset' is not empty, 'guifont' is not used.
|
||||
On systems where 'guifontset' is supported (X11) and 'guifontset' is
|
||||
not empty, then 'guifont' is not used.
|
||||
|
||||
Spaces after a comma are ignored. To include a comma in a font name
|
||||
precede it with a backslash. Setting an option requires an extra
|
||||
@ -3003,7 +3004,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
the case of X). The font names given should be "normal" fonts. Vim
|
||||
will try to find the related bold and italic fonts.
|
||||
|
||||
For Win32, GTK and Photon only: >
|
||||
For Win32, GTK, Mac OS and Photon: >
|
||||
:set guifont=*
|
||||
< will bring up a font requester, where you can pick the font you want.
|
||||
|
||||
@ -3013,7 +3014,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
For the GTK+ 2 GUI the font name looks like this: >
|
||||
:set guifont=Andale\ Mono\ 11
|
||||
< That's all. XLFDs are no longer accepted.
|
||||
*E236*
|
||||
|
||||
For Mac OSX you can use something like this: >
|
||||
:set guifont=Monaco:h10
|
||||
< *E236*
|
||||
Note that the fonts must be mono-spaced (all characters have the same
|
||||
width). An exception is GTK 2: all fonts are accepted, but
|
||||
mono-spaced fonts look best.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Feb 06
|
||||
*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Feb 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -30,6 +30,11 @@ The idea is to save the error messages from the compiler in a file and use Vim
|
||||
to jump to the errors one by one. You can examine each problem and fix it,
|
||||
without having to remember all the error messages.
|
||||
|
||||
In Vim the quickfix commands are used more generally to find a list of
|
||||
positions in files. For example, |:vimgrep| finds pattern matches. You can
|
||||
use the positions in a script with the |errorlist()| function. Thus you can
|
||||
do a lot more than the edit/compile/fix cycle!
|
||||
|
||||
If you are using Manx's Aztec C compiler on the Amiga look here for how to use
|
||||
it with Vim: |quickfix-manx|. If you are using another compiler you should
|
||||
save the error messages in a file and start Vim with "vim -q filename". An
|
||||
@ -170,12 +175,14 @@ height manually (e.g., by dragging the status line above it with the mouse).
|
||||
|
||||
In the quickfix window, each line is one error. The line number is equal to
|
||||
the error number. You can use ":.cc" to jump to the error under the cursor.
|
||||
Hitting the <CR> key or double-clicking the mouse on a line has the same
|
||||
Hitting the <Enter> key or double-clicking the mouse on a line has the same
|
||||
effect. The file containing the error is opened in the window above the
|
||||
quickfix window. If there already is a window for that file, it is used
|
||||
instead. If the buffer in the used window has changed, and the error is in
|
||||
another file, jumping to the error will fail. You will first have to make
|
||||
sure the window contains a buffer which can be abandoned.
|
||||
*CTRL-W_<Enter>* *CTRL-W_<CR>*
|
||||
You can use CTRL-W <Enter> to open a new window and jump to the error there.
|
||||
|
||||
When the quickfix window has been filled, two autocommand events are
|
||||
triggered. First the 'filetype' option is set to "qf", which triggers the
|
||||
@ -303,16 +310,25 @@ advantages are:
|
||||
5.1 using Vim's internal grep
|
||||
|
||||
*:vim* *:vimgrep* *E682* *E683*
|
||||
:vim[grep][!] /{pattern}/ {file} ...
|
||||
:vim[grep][!] /{pattern}/[g][j] {file} ...
|
||||
Search for {pattern} in the files {file} ... and set
|
||||
the error list to the matches.
|
||||
{pattern} if a Vim search pattern. Instead of
|
||||
enclosing it in / any non-ID character |'isident'|
|
||||
can be used, so long as it does not appear in
|
||||
{pattern}.
|
||||
'ignorecase' applies. To overrule it use |/\c| to
|
||||
ignore case or |/\C| to match case. 'smartcase' is
|
||||
not used.
|
||||
Without the 'g' flag each line is added only once.
|
||||
With 'g' every match is added.
|
||||
|
||||
{pattern} is a Vim search pattern. Instead of
|
||||
enclosing it in / any non-ID character (see
|
||||
|'isident'|) can be used, so long as it does not
|
||||
appear in {pattern}.
|
||||
'ignorecase' applies. To overrule it put |/\c| in the
|
||||
pattern to ignore case or |/\C| to match case.
|
||||
'smartcase' is not used.
|
||||
|
||||
Without the 'j' flag Vim jumps to the first match.
|
||||
With 'j' only the quickfix list is updated.
|
||||
With the [!] any changes in the current buffer are
|
||||
abandoned.
|
||||
|
||||
Every second or so the searched file name is displayed
|
||||
to give you an idea of the progress made.
|
||||
Examples: >
|
||||
@ -327,7 +343,8 @@ advantages are:
|
||||
:vimgrep Error *.c
|
||||
<
|
||||
*:vimgrepa* *:vimgrepadd*
|
||||
:vimgrepa[dd][!] [/]{pattern}[/] {file} ...
|
||||
:vimgrepa[dd][!] /{pattern}/[g][j] {file} ...
|
||||
:vimgrepa[dd][!] {pattern} {file} ...
|
||||
Just like ":vimgrep", but instead of making a new list
|
||||
of errors the matches are appended to the current
|
||||
list.
|
||||
@ -462,7 +479,7 @@ not "b:current_compiler". What the command actually does is the following:
|
||||
- Execute ":runtime! compiler/{name}.vim". The plugins are expected to set
|
||||
options with "CompilerSet" and set the "current_compiler" variable to the
|
||||
name of the compiler.
|
||||
- Delete the "CompilerSet user command.
|
||||
- Delete the "CompilerSet" user command.
|
||||
- Set "b:current_compiler" to the value of "current_compiler".
|
||||
- Without "!" the old value of "current_compiler" is restored.
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.0aa. Last change: 2005 Feb 19
|
||||
*repeat.txt* For Vim version 7.0aa. Last change: 2005 Feb 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -13,6 +13,7 @@ Chapter 26 of the user manual introduces repeating |usr_26.txt|.
|
||||
3. Complex repeats |complex-repeat|
|
||||
4. Using Vim scripts |using-scripts|
|
||||
5. Debugging scripts |debug-scripts|
|
||||
6. Profiling |profiling|
|
||||
|
||||
==============================================================================
|
||||
1. Single repeats *single-repeat*
|
||||
@ -483,6 +484,7 @@ DEFINING BREAKPOINTS
|
||||
The [lnum] is the line number of the breakpoint. Vim will stop at or after
|
||||
this line. When omitted line 1 is used.
|
||||
|
||||
*:debug-name*
|
||||
{name} is a pattern that is matched with the file or function name. The
|
||||
pattern is like what is used for autocommands. There must be a full match (as
|
||||
if the pattern starts with "^" and ends in "$"). A "*" matches any sequence
|
||||
@ -547,4 +549,88 @@ OBSCURE
|
||||
Undo ":debuggreedy": get debug mode commands directly from the
|
||||
user, don't use typeahead for debug commands.
|
||||
|
||||
==============================================================================
|
||||
6. Profiling *profile* *profiling*
|
||||
|
||||
Profiling means that Vim measures the time that is spend on executing
|
||||
functions and/or scripts. The |+profile| feature is required for this.
|
||||
It is only included when Vim was compiled with "huge" features.
|
||||
{Vi does not have profiling}
|
||||
|
||||
:prof[ile] start {fname} *:prof* *:profile* *E750*
|
||||
Start profiling, write the output in {fname} upon exit.
|
||||
If {fname} already exists it will be overwritten.
|
||||
The variable |v:profiling| is set to one.
|
||||
|
||||
:prof[ile] func {pattern}
|
||||
Profile function that matches the pattern {pattern}.
|
||||
See |:debug-name| for how {pattern} is used.
|
||||
|
||||
:prof[ile][!] file {pattern}
|
||||
Profile script file that matches the pattern {pattern}.
|
||||
See |:debug-name| for how {pattern} is used.
|
||||
This only profiles the script itself, not the functions
|
||||
defined in it.
|
||||
When the [!] is added then all functions defined in the script
|
||||
will also be profiled.
|
||||
|
||||
|
||||
You must always start with a ":profile start fname" command. The resulting
|
||||
file is written when Vim exits. Here is an example of the output, with line
|
||||
numbers prepended for the explanation:
|
||||
|
||||
1 FUNCTION Test2() ~
|
||||
2 Called 1 time ~
|
||||
3 Total time: 0.155251 ~
|
||||
4 Self time: 0.002006 ~
|
||||
5 ~
|
||||
6 count total (s) self (s) ~
|
||||
7 9 0.000096 for i in range(8) ~
|
||||
8 8 0.153655 0.000410 call Test3() ~
|
||||
9 8 0.000070 endfor ~
|
||||
10 " Ask a question ~
|
||||
11 1 0.001341 echo input("give me an answer: ") ~
|
||||
|
||||
The header (lines 1-4) gives the time for the whole function. The "Total"
|
||||
time is the time passed while the function was executing. The "Self" time is
|
||||
the "Total" time reduced by time spent in:
|
||||
- other user defined functions
|
||||
- sourced scripts
|
||||
- executed autocommands
|
||||
- external (shell) commands
|
||||
|
||||
Lines 7-11 show the time spent in each executed line. Lines that are not
|
||||
executed do not count. Thus a comment line is never counted.
|
||||
|
||||
The Count column shows how many times a line was executed. Note that the
|
||||
"for" command in line 7 is executed one more time as the following lines.
|
||||
That is because the line is also executed to detect the end of the loop.
|
||||
|
||||
The time Vim spends waiting for user input isn't counted at all. Thus how
|
||||
long you take to respond to the input() prompt is irrelevant.
|
||||
|
||||
Profiling should give a good indication of where time is spent, but keep in
|
||||
mind there are various things that may clobber the results:
|
||||
|
||||
- The accuracy of the time measured depends on the gettimeofday() system
|
||||
function. It may only be as accurate as 1/100 second, even though the times
|
||||
are displayed in micro seconds.
|
||||
|
||||
- Real elapsed time is measured, if other processes are busy they may cause
|
||||
delays at unpredictable moments. You may want to run the profiling several
|
||||
times and use the lowest results.
|
||||
|
||||
- If you have several commands in one line you only get one time. Split the
|
||||
line to see the time for the individual commands.
|
||||
|
||||
- The time of the lines added up is mostly less than the time of the whole
|
||||
function. There is some overhead in between.
|
||||
|
||||
- Functions that are deleted before Vim exits will not produce profiling
|
||||
information. You can check the |v:profiling| variable if needed: >
|
||||
:if !v:profiling
|
||||
: delfunc MyFunc
|
||||
:endif
|
||||
<
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@ -1539,6 +1539,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
41.11 usr_41.txt /*41.11*
|
||||
41.12 usr_41.txt /*41.12*
|
||||
41.13 usr_41.txt /*41.13*
|
||||
41.14 usr_41.txt /*41.14*
|
||||
41.15 usr_41.txt /*41.15*
|
||||
41.2 usr_41.txt /*41.2*
|
||||
41.3 usr_41.txt /*41.3*
|
||||
41.4 usr_41.txt /*41.4*
|
||||
@ -1824,6 +1826,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
:d change.txt /*:d*
|
||||
:de change.txt /*:de*
|
||||
:debug repeat.txt /*:debug*
|
||||
:debug-name repeat.txt /*:debug-name*
|
||||
:debugg repeat.txt /*:debugg*
|
||||
:debuggreedy repeat.txt /*:debuggreedy*
|
||||
:del change.txt /*:del*
|
||||
@ -2207,6 +2210,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
:previous editing.txt /*:previous*
|
||||
:print various.txt /*:print*
|
||||
:pro change.txt /*:pro*
|
||||
:prof repeat.txt /*:prof*
|
||||
:profile repeat.txt /*:profile*
|
||||
:promptfind change.txt /*:promptfind*
|
||||
:promptr change.txt /*:promptr*
|
||||
:promptrepl change.txt /*:promptrepl*
|
||||
@ -2860,7 +2865,9 @@ CTRL-W_+ windows.txt /*CTRL-W_+*
|
||||
CTRL-W_- windows.txt /*CTRL-W_-*
|
||||
CTRL-W_< windows.txt /*CTRL-W_<*
|
||||
CTRL-W_<BS> windows.txt /*CTRL-W_<BS>*
|
||||
CTRL-W_<CR> quickfix.txt /*CTRL-W_<CR>*
|
||||
CTRL-W_<Down> windows.txt /*CTRL-W_<Down>*
|
||||
CTRL-W_<Enter> quickfix.txt /*CTRL-W_<Enter>*
|
||||
CTRL-W_<Left> windows.txt /*CTRL-W_<Left>*
|
||||
CTRL-W_<Right> windows.txt /*CTRL-W_<Right>*
|
||||
CTRL-W_<Up> windows.txt /*CTRL-W_<Up>*
|
||||
@ -2977,7 +2984,6 @@ E113 eval.txt /*E113*
|
||||
E114 eval.txt /*E114*
|
||||
E115 eval.txt /*E115*
|
||||
E116 eval.txt /*E116*
|
||||
E117 eval.txt /*E117*
|
||||
E118 eval.txt /*E118*
|
||||
E119 eval.txt /*E119*
|
||||
E12 message.txt /*E12*
|
||||
@ -3667,6 +3673,7 @@ E747 syntax.txt /*E747*
|
||||
E748 repeat.txt /*E748*
|
||||
E749 eval.txt /*E749*
|
||||
E75 vi_diff.txt /*E75*
|
||||
E750 repeat.txt /*E750*
|
||||
E76 pattern.txt /*E76*
|
||||
E77 message.txt /*E77*
|
||||
E78 motion.txt /*E78*
|
||||
@ -4596,6 +4603,7 @@ docbkxml-syntax syntax.txt /*docbkxml-syntax*
|
||||
docbkxml.vim syntax.txt /*docbkxml.vim*
|
||||
docbook syntax.txt /*docbook*
|
||||
documentation-6 version6.txt /*documentation-6*
|
||||
donate uganda.txt /*donate*
|
||||
dos os_dos.txt /*dos*
|
||||
dos-:cd os_dos.txt /*dos-:cd*
|
||||
dos-CTRL-Break os_dos.txt /*dos-CTRL-Break*
|
||||
@ -4659,6 +4667,7 @@ errorformat-javac quickfix.txt /*errorformat-javac*
|
||||
errorformat-multi-line quickfix.txt /*errorformat-multi-line*
|
||||
errorformat-separate-filename quickfix.txt /*errorformat-separate-filename*
|
||||
errorformats quickfix.txt /*errorformats*
|
||||
errorlist() eval.txt /*errorlist()*
|
||||
escape intro.txt /*escape*
|
||||
escape() eval.txt /*escape()*
|
||||
escape-bar version4.txt /*escape-bar*
|
||||
@ -5890,6 +5899,8 @@ print.txt print.txt /*print.txt*
|
||||
printcap-syntax syntax.txt /*printcap-syntax*
|
||||
printing print.txt /*printing*
|
||||
printing-formfeed print.txt /*printing-formfeed*
|
||||
profile repeat.txt /*profile*
|
||||
profiling repeat.txt /*profiling*
|
||||
progname-variable eval.txt /*progname-variable*
|
||||
progress-syntax syntax.txt /*progress-syntax*
|
||||
progress.vim syntax.txt /*progress.vim*
|
||||
@ -5907,6 +5918,7 @@ python-current if_pyth.txt /*python-current*
|
||||
python-error if_pyth.txt /*python-error*
|
||||
python-eval if_pyth.txt /*python-eval*
|
||||
python-examples if_pyth.txt /*python-examples*
|
||||
python-indent indent.txt /*python-indent*
|
||||
python-input if_pyth.txt /*python-input*
|
||||
python-output if_pyth.txt /*python-output*
|
||||
python-range if_pyth.txt /*python-range*
|
||||
@ -6200,13 +6212,20 @@ startup-terminal term.txt /*startup-terminal*
|
||||
static-tag tagsrch.txt /*static-tag*
|
||||
status-line windows.txt /*status-line*
|
||||
statusmsg-variable eval.txt /*statusmsg-variable*
|
||||
strcasestr() eval.txt /*strcasestr()*
|
||||
strchr() eval.txt /*strchr()*
|
||||
strcspn() eval.txt /*strcspn()*
|
||||
strftime() eval.txt /*strftime()*
|
||||
stridx() eval.txt /*stridx()*
|
||||
string() eval.txt /*string()*
|
||||
string-match eval.txt /*string-match*
|
||||
strlen() eval.txt /*strlen()*
|
||||
strpart() eval.txt /*strpart()*
|
||||
strpbrk() eval.txt /*strpbrk()*
|
||||
strrchr() eval.txt /*strrchr()*
|
||||
strridx() eval.txt /*strridx()*
|
||||
strspn() eval.txt /*strspn()*
|
||||
strstr() eval.txt /*strstr()*
|
||||
strtrans() eval.txt /*strtrans()*
|
||||
style-changes develop.txt /*style-changes*
|
||||
style-examples develop.txt /*style-examples*
|
||||
@ -6902,8 +6921,10 @@ write-compiler-plugin usr_41.txt /*write-compiler-plugin*
|
||||
write-device editing.txt /*write-device*
|
||||
write-fail editing.txt /*write-fail*
|
||||
write-filetype-plugin usr_41.txt /*write-filetype-plugin*
|
||||
write-library-script usr_41.txt /*write-library-script*
|
||||
write-local-help usr_41.txt /*write-local-help*
|
||||
write-plugin usr_41.txt /*write-plugin*
|
||||
write-plugin-quickload usr_41.txt /*write-plugin-quickload*
|
||||
write-quit editing.txt /*write-quit*
|
||||
write-readonly editing.txt /*write-readonly*
|
||||
writefile() eval.txt /*writefile()*
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*tips.txt* For Vim version 7.0aa. Last change: 2004 Feb 17
|
||||
*tips.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -201,21 +201,22 @@ abbreviations that correct them. For example: >
|
||||
==============================================================================
|
||||
Counting words, lines, etc. *count-items*
|
||||
|
||||
To count how often any pattern occurs in a buffer, set 'report' to 0, and use
|
||||
the substitute command to replace the pattern with itself. The reported
|
||||
number of substitutions is the number of items. Examples: >
|
||||
To count how often any pattern occurs in the current buffer use the substitute
|
||||
command and add the 'n' flag to avoid the substitution. The reported number
|
||||
of substitutions is the number of items. Examples: >
|
||||
|
||||
:set report=0
|
||||
:%s/./&/g characters
|
||||
:%s/\i\+/&/g words
|
||||
:%s/^ lines
|
||||
:%s/the/&/g "the" anywhere
|
||||
:%s/\<the\>/&/g "the" as a word
|
||||
:%s/./&/gn characters
|
||||
:%s/\i\+/&/gn words
|
||||
:%s/^//n lines
|
||||
:%s/the/&/gn "the" anywhere
|
||||
:%s/\<the\>/&/gn "the" as a word
|
||||
|
||||
You might want to reset 'hlsearch' or do ":nohlsearch".
|
||||
Add the 'e' flag if you don't want an error when there are no matches.
|
||||
|
||||
This does not work if the 'modifiable' option is off. An alternative is using
|
||||
|v_g_CTRL-G| in Visual mode.
|
||||
An alternative is using |v_g_CTRL-G| in Visual mode.
|
||||
|
||||
If you want to find matches in multiple files use |:vimgrep|.
|
||||
|
||||
*count-bytes*
|
||||
If you want to count bytes, you can use this:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.0aa. Last change: 2005 Feb 21
|
||||
*todo.txt* For Vim version 7.0aa. Last change: 2005 Feb 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -30,14 +30,21 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Test11 sometimes fails. Must be a problem with fork() and pipes.
|
||||
|
||||
'sw' is sometimes 8 when using :vimgrep.
|
||||
|
||||
Mingw can use setjmp()? Move code from os_unix.c to common file, adjust
|
||||
#ifdefs. Try with example from Michaelis.
|
||||
|
||||
Russian helpfile doesn't show up correctly when 'encoding' is koi8-r.
|
||||
(Vassily Ragosin 2005 Feb 16)
|
||||
|
||||
Mac unicode patch (Da Woon Jung):
|
||||
- default font is ugly
|
||||
- typing doesn't work
|
||||
- selecting proportional font breaks display
|
||||
|
||||
autoload:
|
||||
- Add docs in user manual: one for using one script and FuncUndefined and one
|
||||
for using autoload with two scripts.
|
||||
- Add a Vim script in $VIMRUNTIME/tools that takes a file with a list of
|
||||
script names and a help file and produces a script that can be sourced to
|
||||
install the scripts in the user's directories.
|
||||
@ -48,20 +55,13 @@ autoload:
|
||||
helpfile doc/myscript.txt
|
||||
For the "helpfile" item ":helptags" is run.
|
||||
|
||||
Patch for 'balloonexpr' option. Sergey Khorev, Feb 26.
|
||||
|
||||
Awaiting response:
|
||||
- Patch for mch_FullName() also in Vim 6.3? os_mswin.c
|
||||
- Win32: tearoff menu window should have a scrollbar when it's taller than
|
||||
the screen.
|
||||
|
||||
Improvements for Python indent script: Peter Wilson.
|
||||
|
||||
Win32: when 'encoding' is "utf-8" getenv() should convert from the active
|
||||
codepage to utf-8, putenv() the other way around. Or use _wgetenv() (but that
|
||||
duplicates the environment).
|
||||
|
||||
Russian helpfile doesn't show up correctly when 'encoding' is koi8-r.
|
||||
(Vassily Ragosin 2005 Feb 16)
|
||||
|
||||
|
||||
PLANNED FOR VERSION 7.0:
|
||||
|
||||
@ -309,9 +309,6 @@ Awaiting updated patches:
|
||||
layout and 'c' for console dialog. (Haegg)
|
||||
Flemming Madsen has a patch for the 'c' flag
|
||||
(2003 May 13)
|
||||
system({cmd}, {expr}) Filter {expr} through the shell command
|
||||
{cmd} and return the result.
|
||||
(Patch from Yegappan Lakshmanan)
|
||||
raisewin() raise gvim window (see HierAssist patch for
|
||||
Tcl implementation ~/vim/HierAssist/ )
|
||||
7 Add patch from Benoit Cerrina to integrate Vim and Perl functions
|
||||
@ -1594,11 +1591,12 @@ Built-in script language:
|
||||
mapname({idx}, mode) return the name of the idx'th mapping.
|
||||
Patch by Ilya Sher, 2004 Mar 4.
|
||||
Return a list instead.
|
||||
sprintf(format, arg, ..) How to prevent a crash???
|
||||
printf(format, arg, ..) How to prevent a crash???
|
||||
char2hex() convert char string to hex string.
|
||||
attributes() return file protection flags "drwxrwxrwx"
|
||||
copy(from, to) Copy a file
|
||||
perl(cmd) call Perl and return string
|
||||
filecopy(from, to) Copy a file
|
||||
shorten(fname) shorten a file name, like home_replace()
|
||||
perl(cmd) call Perl and return string
|
||||
input(prompt, complete) like input() but do specified completion
|
||||
inputrl() like input() but right-to-left
|
||||
virtualmode() add argument to obtain whether "$" was used in
|
||||
@ -1608,14 +1606,10 @@ Built-in script language:
|
||||
getbufline() get line from any buffer
|
||||
deletebufline() delete line in any buffer
|
||||
appendbufline() append line in any buffer
|
||||
sort() Sort a newline-separated string. Also:
|
||||
":sort".
|
||||
libcall() Allow more than one argument.
|
||||
libcallext() Like libcall(), but using a callback function
|
||||
to allow the library to execute a command or
|
||||
evaluate an expression.
|
||||
char2hex() convert char string to hex string. XX
|
||||
hex2char() convert hex string to char string. XX
|
||||
7 Make bufname("'0") return the buffer name from mark '0. How to get the
|
||||
column and line number? col("'0") currently returns zero.
|
||||
8 argc() returns 0 when using "vim -t tag". How to detect that no file was
|
||||
@ -2440,7 +2434,8 @@ Text objects:
|
||||
(Scott Graham) "ac" and "au"?
|
||||
8 Add a text object for any kind of quoting, also with multi-byte
|
||||
characters. Option to specify what quotes are recognized (default: all)
|
||||
use "aq" and "iq".
|
||||
use "aq" and "iq". Use 'quotepairs' to define pairs of quotes, like
|
||||
'matchpairs'?
|
||||
8 Add text object for any kind of parens, also multi-byte ones.
|
||||
7 Add text object for current search pattern: "a/" and "i/". Makes it
|
||||
possible to turn text highlighted for 'hlsearch' into a Visual area.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*uganda.txt* For Vim version 7.0aa. Last change: 2004 Aug 29
|
||||
*uganda.txt* For Vim version 7.0aa. Last change: 2005 Feb 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -172,7 +172,7 @@ There is a small clinic at the project, which provides children and their
|
||||
family with medical help. When needed, transport to a hospital is offered.
|
||||
Immunization programs are carried out and help is provided when an epidemic is
|
||||
breaking out (measles and cholera have been a problem).
|
||||
|
||||
*donate*
|
||||
Summer 1994 to summer 1995 I spent a whole year at the centre, working as a
|
||||
volunteer. I have helped to expand the centre and worked in the area of water
|
||||
and sanitation. I learned that the help that the KCC provides really helps.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Feb 08
|
||||
*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@ -22,6 +22,8 @@ script. There are a lot of them, thus this is a long chapter.
|
||||
|41.11| Writing a plugin
|
||||
|41.12| Writing a filetype plugin
|
||||
|41.13| Writing a compiler plugin
|
||||
|41.14| Writing a plugin that loads quickly
|
||||
|41.15| Writing library scripts
|
||||
|
||||
Next chapter: |usr_42.txt| Add new menus
|
||||
Previous chapter: |usr_40.txt| Make new commands
|
||||
@ -663,6 +665,7 @@ System functions and manipulation of files:
|
||||
executable() check if an executable program exists
|
||||
filereadable() check if a file can be read
|
||||
filewritable() check if a file can be written to
|
||||
mkdir() create a new directory
|
||||
isdirectory() check if a directory exists
|
||||
getcwd() get the current working directory
|
||||
getfsize() get the size of a file
|
||||
@ -742,6 +745,7 @@ Various:
|
||||
maparg() get rhs of a mapping
|
||||
exists() check if a variable, function, etc. exists
|
||||
has() check if a feature is supported in Vim
|
||||
errorlist() list of quickfix errors
|
||||
cscope_connection() check if a cscope connection exists
|
||||
did_filetype() check if a FileType autocommand was used
|
||||
eventhandler() check if invoked by an event handler
|
||||
@ -2128,6 +2132,143 @@ don't check "current_compiler". This plugin is supposed to be loaded
|
||||
last, thus it should be in a directory at the end of 'runtimepath'. For Unix
|
||||
that could be ~/.vim/after/compiler.
|
||||
|
||||
==============================================================================
|
||||
*41.14* Writing a plugin that loads quickly *write-plugin-quickload*
|
||||
|
||||
A plugin may grow and become quite long. The startup delay may become
|
||||
noticable, while you hardly every use the plugin. Then it's time for a
|
||||
quickload plugin.
|
||||
|
||||
The basic idea is that the plugin is loaded twice. The first time user
|
||||
commands and mappings are defined that offer the functionality. The second
|
||||
time the functions that implement the functionality are defined.
|
||||
|
||||
It may sound surprising that quickload means loading a script twice. What we
|
||||
mean is that it loads quickly the first time, postponing the bulk of the
|
||||
script to the second time, which only happens when you actually use it. When
|
||||
you always use the functionality it actually gets slower!
|
||||
|
||||
The following example shows how it's done: >
|
||||
|
||||
" Vim global plugin for demonstrating quick loading
|
||||
" Last Change: 2005 Feb 25
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" License: This file is placed in the public domain.
|
||||
|
||||
if !exists("s:did_load")
|
||||
command -nargs=* BNRead call BufNetRead(<f-args>)
|
||||
map <F19> :call BufNetWrite('something')<CR>
|
||||
|
||||
let s:did_load = 1
|
||||
exe 'au FuncUndefined BufNet* source ' . expand('<sfile>')
|
||||
finish
|
||||
endif
|
||||
|
||||
function BufNetRead(...)
|
||||
echo 'BufNetRead(' . string(a:000) . ')'
|
||||
" read functionality here
|
||||
endfunction
|
||||
|
||||
function BufNetWrite(...)
|
||||
echo 'BufNetWrite(' . string(a:000) . ')'
|
||||
" write functionality here
|
||||
endfunction
|
||||
|
||||
When the script is first loaded "s:did_load" is not set. The commands between
|
||||
the "if" and "endif" will be executed. This ends in a |:finish| command, thus
|
||||
the rest of the script is not executed.
|
||||
|
||||
The second time the script is loaded "s:did_load" exists and the commands
|
||||
after the "endif" are executed. This defines the (possible long)
|
||||
BufNetRead() and BufNetWrite() functions.
|
||||
|
||||
If you drop this script in your plugin directory Vim will execute it on
|
||||
startup. This is the sequence of events that happens:
|
||||
|
||||
1. The "BNRead" command is defined and the <F19> key is mapped when the script
|
||||
is sourced at startup. A |FuncUndefined| autocommand is defined. The
|
||||
":finish" command causes the script to terminate early.
|
||||
|
||||
2. The user types the BNRead command or presses the <F19> key. The
|
||||
BufNetRead() or BufNetWrite() function will be called.
|
||||
|
||||
3. Vim can't find the function and triggers the |FuncUndefined| autocommand
|
||||
event. Since the pattern "BufNet*" matches the invoked function, the
|
||||
command "source fname" will be executed. "fname" will be equal to the name
|
||||
of the script, no matter where it is located, because it comes from
|
||||
expanding "<sfile>" (see |expand()|).
|
||||
|
||||
4. The script is sourced again, the "s:did_load" variable exists and the
|
||||
functions are defined.
|
||||
|
||||
Notice that the functions that are loaded afterwards match the pattern in the
|
||||
|FuncUndefined| autocommand. You must make sure that no other plugin defines
|
||||
functions that match this pattern.
|
||||
|
||||
==============================================================================
|
||||
*41.15* Writing library scripts *write-library-script*
|
||||
|
||||
Some functionality will be required in several places. When this becomes more
|
||||
than a few lines you will want to put it in one script and use it from many
|
||||
scripts. We will call that one script a library script.
|
||||
|
||||
Manually loading a library script is possible, so long as you avoid loading it
|
||||
when it's already done. You can do this with the |exists()| function.
|
||||
Example: >
|
||||
|
||||
if !exists('*MyLibFunction')
|
||||
runtime library/mylibscript.vim
|
||||
endif
|
||||
call MyLibFunction(arg)
|
||||
|
||||
Here you need to know that MyLibFunction() is defined in a script
|
||||
"library/mylibscript.vim" in one of the directories in 'runtimepath'.
|
||||
|
||||
To make this a bit simpler Vim offers the autoload mechanism. Then the
|
||||
example looks like this: >
|
||||
|
||||
call mylib:myfunction(arg)
|
||||
|
||||
That's a lot simpler, isn't it? Vim will recognize the function name and when
|
||||
it's not defined search for the script "autoload/mylib.vim" in 'runtimepath'.
|
||||
That script must define the "mylib:myfunction()" function.
|
||||
|
||||
You can put many other functions in the mylib.vim script, you are free to
|
||||
organize your functions in library scripts. But you must use function names
|
||||
where the part before the colon matches the script name. Otherwise Vim
|
||||
would not know what script to load.
|
||||
|
||||
If you get really enthousiastic and write lots of library scripts, you may
|
||||
want to use subdirectories. Example: >
|
||||
|
||||
call netlib:ftp:read('somefile')
|
||||
|
||||
For Unix the library script used for this could be:
|
||||
|
||||
~/.vim/autoload/netlib/ftp.vim
|
||||
|
||||
Where the function is defined like this: >
|
||||
|
||||
function netlib:ftp:read(fname)
|
||||
" Read the file fname through ftp
|
||||
endfunction
|
||||
|
||||
Notice that the name the function is defined with is exactly the same as the
|
||||
name used for calling the function. And the part before the last colon
|
||||
exactly matches the subdirectory and script name.
|
||||
|
||||
You can use the same mechanism for variables: >
|
||||
|
||||
let weekdays = dutch:weekdays
|
||||
|
||||
This will load the script "autoload/dutch.vim", which should contain something
|
||||
like: >
|
||||
|
||||
let dutch:weekdays = ['zondag', 'maandag', 'dinsdag', 'woensdag',
|
||||
\ 'donderdag', 'vrijdag', 'zaterdag']
|
||||
|
||||
Further reading: |autoload|.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Next chapter: |usr_42.txt| Add new menus
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*usr_toc.txt* For Vim version 7.0aa. Last change: 2005 Feb 06
|
||||
*usr_toc.txt* For Vim version 7.0aa. Last change: 2005 Feb 22
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@ -292,6 +292,8 @@ Make Vim work as you like it.
|
||||
|41.11| Writing a plugin
|
||||
|41.12| Writing a filetype plugin
|
||||
|41.13| Writing a compiler plugin
|
||||
|41.14| Writing a plugin that loads quickly
|
||||
|41.15| Writing library scripts
|
||||
|
||||
|usr_42.txt| Add new menus
|
||||
|42.1| Introduction
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*version7.txt* For Vim version 7.0aa. Last change: 2005 Feb 21
|
||||
*version7.txt* For Vim version 7.0aa. Last change: 2005 Feb 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -161,6 +161,9 @@ better portability, handling of different file encodings and using multi-line
|
||||
patterns, this also allows grepping in compressed and remote files.
|
||||
|:vimgrep|.
|
||||
|
||||
If you want to use the search results in a script you can use the
|
||||
|errorlist()| function.
|
||||
|
||||
|
||||
POSIX compatibility *new-posix*
|
||||
-------------------
|
||||
@ -216,6 +219,9 @@ Normal mode commands: ~
|
||||
a", a' and a` New text objects to select quoted strings. |a'|
|
||||
i", i' and i' (Taro Muraoka)
|
||||
|
||||
CTRL-W <Enter> In the quickfix window: opens a new window to show the
|
||||
location of the error under the cursor.
|
||||
|
||||
Options: ~
|
||||
|
||||
'completefunc' The name of a function used for user-specified Insert
|
||||
@ -272,6 +278,7 @@ New functions: ~
|
||||
|count()| count nr of times a value is in a List or Dictionary
|
||||
|deepcopy()| make a full copy of a List or Dictionary
|
||||
|empty()| check if List or Dictionary is empty
|
||||
|errorlist()| list of quickfix errors
|
||||
|extend()| append one List to another or add items from one
|
||||
Dictionary to another
|
||||
|filter()| remove selected items from a List or Dictionary
|
||||
@ -283,7 +290,7 @@ New functions: ~
|
||||
|getfontname()| Get actual font name being used.
|
||||
|getfperm()| Get file permission string. (Nikolai Weibull)
|
||||
|getftype()| Get type of file. (Nikolai Weibull)
|
||||
|getline()| get List with buffer lines
|
||||
|getline()| With second argument: get List with buffer lines
|
||||
|has_key()| check whether a key appears in a Dictionary
|
||||
|insert()| insert an item somewhere in a List
|
||||
|items()| get List of Dictionary key-value pairs
|
||||
@ -367,6 +374,8 @@ The Ukranian messages are now also available in cp1251.
|
||||
|
||||
Irish message translations. (Kevin Patrick Scannell)
|
||||
|
||||
Vietnamese message translations and menu. (Phan Vinh Thinh)
|
||||
|
||||
|
||||
Others: ~
|
||||
|
||||
@ -520,6 +529,12 @@ ignored.
|
||||
When "beep" is included in 'debug' a function or script that causes a beep
|
||||
will result in a message with the source of the error.
|
||||
|
||||
When completing buffer names, match with "\(^\|[\/]\)" instead of "^", so that
|
||||
":buf stor<Tab>" finds both "include/storage.h" and "storage/main.c".
|
||||
|
||||
To count items (pattern matches) without changing the buffer the 'n' flag has
|
||||
been added to |:substitute|. See |count-items|.
|
||||
|
||||
==============================================================================
|
||||
COMPILE TIME CHANGES *compile-changes-7*
|
||||
|
||||
@ -605,6 +620,9 @@ When 'comments' includes multi-byte characters inserting the middle part and
|
||||
alignment may go wrong. 'cindent' also suffers from this for right-aligned
|
||||
items.
|
||||
|
||||
Win32: when 'encoding' is set to "utf-8" getenv() still returns strings in the
|
||||
active codepage. Convert to utf-8. Also for $HOME.
|
||||
|
||||
The default for 'helplang' was "zh" for both "zh_cn" and "zh_tw". Now use
|
||||
"cn" or "tw" as intended.
|
||||
|
||||
@ -868,4 +886,9 @@ Lakshmanan)
|
||||
It was not possible to use a NL after a backslash in Ex mode. This is
|
||||
sometimes used to feed multiple lines to a shell command.
|
||||
|
||||
When 'cmdheight' is set to 2 in .vimrc and the GUI uses the number of lines
|
||||
from the terminal we actually get 3 lines for the cmdline in gvim.
|
||||
|
||||
When setting $HOME allocated memory would leak.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@ -492,9 +492,17 @@ System wide
|
||||
.B Vim
|
||||
initializations.
|
||||
.TP
|
||||
~/.vimrc
|
||||
Your personal
|
||||
.B Vim
|
||||
initializations.
|
||||
.TP
|
||||
/usr/local/lib/vim/gvimrc
|
||||
System wide gvim initializations.
|
||||
.TP
|
||||
~/.gvimrc
|
||||
Your personal gvim initializations.
|
||||
.TP
|
||||
/usr/local/lib/vim/optwin.vim
|
||||
Script used for the ":options" command, a nice way to view and set options.
|
||||
.TP
|
||||
|
||||
@ -370,9 +370,13 @@ FILES
|
||||
/usr/local/lib/vim/vimrc
|
||||
System wide Vim initializations.
|
||||
|
||||
~/.vimrc Your personal Vim initializations.
|
||||
|
||||
/usr/local/lib/vim/gvimrc
|
||||
System wide gvim initializations.
|
||||
|
||||
~/.gvimrc Your personal gvim initializations.
|
||||
|
||||
/usr/local/lib/vim/optwin.vim
|
||||
Script used for the ":options" command, a nice way to
|
||||
view and set options.
|
||||
|
||||
Reference in New Issue
Block a user