summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-07-26 20:58:42 +0000
committerBram Moolenaar <Bram@vim.org>2007-07-26 20:58:42 +0000
commit6ee10162b24109d5b3a0558304c110ffc9dc25b7 (patch)
tree499b2caf889484c944c88eafc6a7c5f7c73838cb /runtime
parentf621048b53fb2ac84608886102b1733d7a338708 (diff)
updated for version 7.1-040v7.1.040
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt89
-rw-r--r--runtime/doc/pattern.txt16
-rw-r--r--runtime/doc/usr_41.txt9
3 files changed, 108 insertions, 6 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a18b048c77..95ef5372b2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.1. Last change: 2007 Jul 11
+*eval.txt* For Vim version 7.1. Last change: 2007 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1557,6 +1557,7 @@ call( {func}, {arglist} [, {dict}])
changenr() Number current change number
char2nr( {expr}) Number ASCII value of first char in {expr}
cindent( {lnum}) Number C indent for line {lnum}
+clearmatches() None clear all matches
col( {expr}) Number column nr of cursor or mark
complete({startcol}, {matches}) String set Insert mode completion
complete_add( {expr}) Number add completion match
@@ -1622,6 +1623,7 @@ getftype( {fname}) String description of type of file {fname}
getline( {lnum}) String line {lnum} of current buffer
getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer
getloclist({nr}) List list of location list items
+getmatches() List list of current matches
getpos( {expr}) List position of cursor, mark, etc.
getqflist() List list of quickfix items
getreg( [{regname} [, 1]]) String contents of register
@@ -1676,7 +1678,10 @@ mapcheck( {name}[, {mode} [, {abbr}]])
String check for mappings matching {name}
match( {expr}, {pat}[, {start}[, {count}]])
Number position where {pat} matches in {expr}
+matchadd( {group}, {pattern}[, {priority}[, {id}]])
+ Number highlight {pattern} with {group}
matcharg( {nr}) List arguments of |:match|
+matchdelete( {id}) Number delete match identified by {id}
matchend( {expr}, {pat}[, {start}[, {count}]])
Number position where {pat} ends in {expr}
matchlist( {expr}, {pat}[, {start}[, {count}]])
@@ -1731,6 +1736,7 @@ setcmdpos( {pos}) Number set cursor position in command-line
setline( {lnum}, {line}) Number set line {lnum} to {line}
setloclist( {nr}, {list}[, {action}])
Number modify location list using {list}
+setmatches( {list}) Number restore a list of matches
setpos( {expr}, {list}) none set the {expr} position to {list}
setqflist( {list}[, {action}]) Number modify quickfix list using {list}
setreg( {n}, {v}[, {opt}]) Number set register to value and type
@@ -2012,6 +2018,10 @@ cindent({lnum}) *cindent()*
feature, -1 is returned.
See |C-indenting|.
+clearmatches() *clearmatches()*
+ Clears all matches previously defined by |matchadd()| and the
+ |:match| commands.
+
*col()*
col({expr}) The result is a Number, which is the byte index of the column
position given with {expr}. The accepted positions are:
@@ -2918,6 +2928,28 @@ getloclist({nr}) *getloclist()*
returned. For an invalid window number {nr}, an empty list is
returned. Otherwise, same as getqflist().
+getmatches() *getmatches()*
+ Returns a |List| with all matches previously defined by
+ |matchadd()| and the |:match| commands. |getmatches()| is
+ useful in combination with |setmatches()|, as |setmatches()|
+ can restore a list of matches saved by |getmatches()|.
+ Example: >
+ :echo getmatches()
+< [{'group': 'MyGroup1', 'pattern': 'TODO',
+ 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
+ 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+ :let m = getmatches()
+ :call clearmatches()
+ :echo getmatches()
+< [] >
+ :call setmatches(m)
+ :echo getmatches()
+< [{'group': 'MyGroup1', 'pattern': 'TODO',
+ 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
+ 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+ :unlet m
+<
+
getqflist() *getqflist()*
Returns a list with all the current quickfix errors. Each
list item is a dictionary with these entries:
@@ -3622,6 +3654,44 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()*
the pattern. 'smartcase' is NOT used. The matching is always
done like 'magic' is set and 'cpoptions' is empty.
+ *matchadd()* *E798* *E799* *E801*
+matchadd({group}, {pattern}[, {priority}[, {id}]])
+ Defines a pattern to be highlighted in the current window (a
+ "match"). It will be highlighted with {group}. Returns an
+ identification number (ID), which can be used to delete the
+ match using |matchdelete()|.
+
+ The optional {priority} argument assigns a priority to the
+ match. A match with a high priority will have its
+ highlighting overrule that of a match with a lower priority.
+ A priority is specified as an integer (negative numbers are no
+ exception). If the {priority} argument is not specified, the
+ default priority is 10. The priority of 'hlsearch' is zero,
+ hence all matches with a priority greater than zero will
+ overrule it. Syntax highlighting (see 'syntax') is a separate
+ mechanism, and regardless of the chosen priority a match will
+ always overrule syntax highlighting.
+
+ The optional {id} argument allows the request for a specific
+ match ID. If a specified ID is already taken, an error
+ message will appear and the match will not be added. An ID
+ is specified as a positive integer (zero excluded). IDs 1, 2
+ and 3 are reserved for |:match|, |:2match| and |:3match|,
+ respectively. If the {id} argument is not specified,
+ |matchadd()| automatically chooses a free ID.
+
+ The number of matches is not limited, as it is the case with
+ the |:match| commands.
+
+ Example: >
+ :highlight MyGroup ctermbg=green guibg=green
+ :let m = matchadd("MyGroup", "TODO")
+< Deletion of the pattern: >
+ :call matchdelete(m)
+
+< A list of matches defined by |matchadd()| and |:match| are
+ available from |getmatches()|. All matches can be deleted in
+ one operation by |clearmatches()|.
matcharg({nr}) *matcharg()*
Selects the {nr} match item, as set with a |:match|,
@@ -3631,8 +3701,15 @@ matcharg({nr}) *matcharg()*
The pattern used.
When {nr} is not 1, 2 or 3 returns an empty |List|.
When there is no match item set returns ['', ''].
- This is usef to save and restore a |:match|.
+ This is useful to save and restore a |:match|.
+ Highlighting matches using the |:match| commands are limited
+ to three matches. |matchadd()| does not have this limitation.
+matchdelete({id}) *matchdelete()* *E802* *E803*
+ Deletes a match with ID {id} previously defined by |matchadd()|
+ or one of the |:match| commands. Returns 0 if succesfull,
+ otherwise -1. See example for |matchadd()|. All matches can
+ be deleted in one operation by |clearmatches()|.
matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()*
Same as match(), but return the index of first character after
@@ -4385,7 +4462,13 @@ setloclist({nr}, {list} [, {action}]) *setloclist()*
When {nr} is zero the current window is used. For a location
list window, the displayed location list is modified. For an
invalid window number {nr}, -1 is returned.
- Otherwise, same as setqflist().
+ Otherwise, same as |setqflist()|.
+ Also see |location-list|.
+
+setmatches({list}) *setmatches()*
+ Restores a list of matches saved by |getmatches()|. Returns 0
+ if succesfull, otherwise -1. All current matches are cleared
+ before the list is restored. See example for |getmatches()|.
*setpos()*
setpos({expr}, {list})
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 22c5782a8f..5331cfec41 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1212,7 +1212,10 @@ Finally, these constructs are unique to Perl:
{group} must exist at the moment this command is executed.
The {group} highlighting still applies when a character is
- to be highlighted for 'hlsearch'.
+ to be highlighted for 'hlsearch', as the highlighting for
+ matches is given higher priority than that of 'hlsearch'.
+ Syntax highlighting (see 'syntax') is also overruled by
+ matches.
Note that highlighting the last used search pattern with
'hlsearch' is used in all windows, while the pattern defined
@@ -1226,8 +1229,15 @@ Finally, these constructs are unique to Perl:
display you may get unexpected results. That is because Vim
looks for a match in the line where redrawing starts.
- Also see |matcharg()|, it returns the highlight group and
- pattern of a previous :match command.
+ Also see |matcharg()|and |getmatches()|. The former returns
+ the highlight group and pattern of a previous |:match|
+ command. The latter returns a list with highlight groups and
+ patterns defined by both |matchadd()| and |:match|.
+
+ Highlighting matches using |:match| are limited to three
+ matches (aside from |:match|, |:2match| and |:3match|are
+ available). |matchadd()| does not have this limitation and in
+ addition makes it possible to prioritize matches.
Another example, which highlights all characters in virtual
column 72 and more: >
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index da5bf7ce91..64cf78d3b2 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -763,13 +763,22 @@ Folding:
foldtextresult() get the text displayed for a closed fold
Syntax and highlighting:
+ clearmatches() clear all matches defined by |matchadd()| and
+ the |:match| commands
+ getmatches() get all matches defined by |matchadd()| and
+ the |:match| commands
hlexists() check if a highlight group exists
hlID() get ID of a highlight group
synID() get syntax ID at a specific position
synIDattr() get a specific attribute of a syntax ID
synIDtrans() get translated syntax ID
diff_hlID() get highlight ID for diff mode at a position
+ matchadd() define a pattern to highlight (a "match")
matcharg() get info about |:match| arguments
+ matchdelete() delete a match defined by |matchadd()| or a
+ |:match| command
+ setmatches() restore a list of matches saved by
+ |getmatches()|
Spelling:
spellbadword() locate badly spelled word at or after cursor