updated for version 7.0201
diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt
index 2fc1bee..30c548d 100644
--- a/runtime/doc/tips.txt
+++ b/runtime/doc/tips.txt
@@ -1,4 +1,4 @@
-*tips.txt* For Vim version 7.0aa. Last change: 2006 Feb 16
+*tips.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -450,11 +450,13 @@
This example shows the use of a few advanced tricks:
- using the |CursorMoved| autocommand event
- using |searchpairpos()| to find a matching paren
+- using |synID()| to detect whether the cursor is in a string or comment
- using |:match| to highlight something
- using a |pattern| to match a specific position in the file.
This should be put in a Vim script file, since it uses script-local variables.
-Note that it doesn't recognize strings or comments in the text.
+It skips matches in strings or comments, unless the cursor started in string
+or comment. This requires syntax highlighting.
>
let s:paren_hl_on = 0
function s:Highlight_Matching_Paren()
@@ -484,8 +486,11 @@
let c = '\['
let c2 = '\]'
endif
+ let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "string\\|comment"'
+ execute 'if' s_skip '| let s_skip = 0 | endif'
- let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags)
+ let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip)
if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col .