| version 1.1, 2002/02/05 15:34:35 |
version 1.2, 2003/11/03 16:15:40 |
|
|
| " matchit.vim: (global plugin) Extended "%" matching |
" matchit.vim: (global plugin) Extended "%" matching |
| " Last Change: August 28, 2001 |
" Last Change: June 12, 2002 |
| " Maintainer: Benji Fisher PhD <benji@member.AMS.org> |
" Maintainer: Benji Fisher PhD <benji@member.AMS.org> |
| " Version: 1.1 |
" Version: 1.7, for Vim 6.1 |
| |
|
| " Documentation: |
" Documentation: |
| " The documentation is in a separate file, matchit.txt . |
" The documentation is in a separate file, matchit.txt . |
| |
|
| " Credits: |
" Credits: |
| " Vim editor by Bram Moolenaar (Thanks, Bram!) |
" Vim editor by Bram Moolenaar (Thanks, Bram!) |
| " Original script and design by Raul Segura Acevedo |
" Original script and design by Raul Segura Acevedo |
| " Support for comments by Douglas Potts |
" Support for comments by Douglas Potts |
| " Support for back references and other improvements by Benji Fisher |
" Support for back references and other improvements by Benji Fisher |
| " Support for many languages by Johannes Zellner |
" Support for many languages by Johannes Zellner |
| " Suggestions for improvement, bug reports, and support for additional |
" Suggestions for improvement, bug reports, and support for additional |
| " languages by Jordi-Albert Batalla, Neil Bird, Mark Collett, Stephen Wall, |
" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark |
| " and Johannes Zellner. |
" Collett, Stephen Wall, and Johannes Zellner. |
| |
|
| " Debugging: |
" Debugging: |
| " If you'd like to try the built-in debugging commands... |
" If you'd like to try the built-in debugging commands... |
|
|
| " variables. See the MatchDebug() function, below, for details. |
" variables. See the MatchDebug() function, below, for details. |
| |
|
| " TODO: I should think about multi-line patterns for b:match_words. |
" TODO: I should think about multi-line patterns for b:match_words. |
| |
" This would require an option: how many lines to scan (default 1). |
| |
" This would be useful for Python, maybe also for *ML. |
| " TODO: Maybe I should add a menu so that people will actually use some of |
" TODO: Maybe I should add a menu so that people will actually use some of |
| " the features that I have implemented. |
" the features that I have implemented. |
| |
" TODO: Eliminate the MultiMatch function. Add yet another argument to |
| |
" Match_wrapper() instead. |
| |
" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' |
| |
" TODO: Make backrefs safer by using '\V' (very no-magic). |
| |
" TODO: Add a level of indirection, so that custom % scripts can use my |
| |
" work but extend it. |
| |
|
| " allow user to prevent loading |
" allow user to prevent loading |
| " and prevent duplicate loading |
" and prevent duplicate loading |
| Line 42 nnoremap <silent> % :<C-U>call <SID>Mat |
|
| Line 50 nnoremap <silent> % :<C-U>call <SID>Mat |
|
| nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR> |
nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR> |
| vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv`` |
vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv`` |
| vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv`` |
vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv`` |
| onoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'o') <CR> |
onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR> |
| onoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'o') <CR> |
onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR> |
| |
|
| " Analogues of [{ and ]} using matching patterns: |
" Analogues of [{ and ]} using matching patterns: |
| nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR> |
nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR> |
| nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR> |
nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR> |
| vnoremap [% <Esc>[%m'gv`` |
vmap [% <Esc>[%m'gv`` |
| vnoremap ]% <Esc>]%m'gv`` |
vmap ]% <Esc>]%m'gv`` |
| onoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "o") <CR> |
" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv`` |
| onoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "o") <CR> |
" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv`` |
| |
onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR> |
| |
onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR> |
| |
|
| " Auto-complete mappings: (not yet "ready for prime time") |
" Auto-complete mappings: (not yet "ready for prime time") |
| " TODO Read :help write-plugin for the "right" way to let the user |
" TODO Read :help write-plugin for the "right" way to let the user |
| Line 68 onoremap <silent> ]% :<C-U>call <SID>Mul |
|
| Line 78 onoremap <silent> ]% :<C-U>call <SID>Mul |
|
| " execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' |
" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' |
| " endif " gthhoh = "Get the heck out of here!" |
" endif " gthhoh = "Get the heck out of here!" |
| |
|
| " Highlight group for error messages. The user may choose to set this |
|
| " to be invisible. |
|
| hi link MatchError WarningMsg |
|
| |
|
| let s:notslash = '\\\@<!\%(\\\\\)*' |
let s:notslash = '\\\@<!\%(\\\\\)*' |
| |
|
| function! s:Match_wrapper(word, forward, mode) range |
function! s:Match_wrapper(word, forward, mode) range |
| |
" In s:CleanUp(), :execute "set" restore_options . |
| |
let restore_options = (&ic ? " " : " no") . "ignorecase" |
| |
if exists("b:match_ignorecase") |
| |
let &ignorecase = b:match_ignorecase |
| |
endif |
| |
let restore_options = " ve=" . &ve . restore_options |
| |
set ve= |
| " If this function was called from Visual mode, make sure that the cursor |
" If this function was called from Visual mode, make sure that the cursor |
| " is at the correct end of the Visual range: |
" is at the correct end of the Visual range: |
| if a:mode == "v" |
if a:mode == "v" |
| execute "normal! gv\<Esc>" |
execute "normal! gv\<Esc>" |
| endif |
endif |
| |
" In s:CleanUp(), we may need to check whether the cursor moved forward. |
| |
let startline = line(".") |
| |
let startcol = col(".") |
| " Use default behavior if called with a count or if no patterns are defined. |
" Use default behavior if called with a count or if no patterns are defined. |
| if v:count |
if v:count |
| exe "normal! " . v:count . "%" |
exe "normal! " . v:count . "%" |
| return |
return s:CleanUp(restore_options, a:mode, startline, startcol) |
| elseif !exists("b:match_words") || b:match_words == "" |
elseif !exists("b:match_words") || b:match_words == "" |
| silent! normal! % |
silent! normal! % |
| return |
return s:CleanUp(restore_options, a:mode, startline, startcol) |
| end |
end |
| |
|
| " First step: if not already done, set the script variables |
" First step: if not already done, set the script variables |
| " s:do_BR flag for whether there are backrefs |
" s:do_BR flag for whether there are backrefs |
| " s:pat parsed version of b:match_words |
" s:pat parsed version of b:match_words |
| " s:all regexp based on s:pat and the default groups |
" s:all regexp based on s:pat and the default groups |
| |
" |
| |
" Allow b:match_words = "GetVimMatchWords()" . |
| |
if b:match_words =~ ":" |
| |
let match_words = b:match_words |
| |
else |
| |
execute "let match_words =" b:match_words |
| |
endif |
| " Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! |
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! |
| if (b:match_words != s:last_words) || (&mps != s:last_mps) || |
if (match_words != s:last_words) || (&mps != s:last_mps) || |
| \ exists("b:match_debug") |
\ exists("b:match_debug") |
| let s:last_words = b:match_words |
let s:last_words = match_words |
| let s:last_mps = &mps |
let s:last_mps = &mps |
| if b:match_words !~ s:notslash . '\\\d' |
if match_words !~ s:notslash . '\\\d' |
| let s:do_BR = 0 |
let s:do_BR = 0 |
| let s:pat = b:match_words |
let s:pat = match_words |
| else |
else |
| let s:do_BR = 1 |
let s:do_BR = 1 |
| let s:pat = s:ParseWords(b:match_words) |
let s:pat = s:ParseWords(match_words) |
| endif |
endif |
| " The next several lines were here before |
" The next several lines were here before |
| " BF started messing with this script. |
" BF started messing with this script. |
| Line 130 function! s:Match_wrapper(word, forward, |
|
| Line 153 function! s:Match_wrapper(word, forward, |
|
| " suffix = regexp for end of match to end of line |
" suffix = regexp for end of match to end of line |
| " Require match to end on or after the cursor and prefer it to |
" Require match to end on or after the cursor and prefer it to |
| " start on or before the cursor. |
" start on or before the cursor. |
| let matchline = getline(".") |
let matchline = getline(startline) |
| let startcol = col(".") |
|
| if a:word != '' |
if a:word != '' |
| " word given |
" word given |
| if a:word !~ s:all |
if a:word !~ s:all |
| echohl MatchError|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE |
echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE |
| return |
return s:CleanUp(restore_options, a:mode, startline, startcol) |
| endif |
endif |
| let matchline = a:word |
let matchline = a:word |
| let curcol = 0 |
let curcol = 0 |
| let prefix = '^\%(' |
let prefix = '^\%(' |
| let suffix = '\)$' |
let suffix = '\)$' |
| " Now the case when "word" is not given |
" Now the case when "word" is not given |
| elseif matchend(matchline, '.*' . s:all) < startcol |
|
| " there is no special word in this line || it ends before the cursor |
|
| echohl MatchError | echo "No matching rule applies here" | echohl NONE |
|
| return |
|
| else " Find the match that ends on or after the cursor and set curcol. |
else " Find the match that ends on or after the cursor and set curcol. |
| let regexp = s:Wholematch(matchline, s:all, startcol-1) |
let regexp = s:Wholematch(matchline, s:all, startcol-1) |
| let curcol = match(matchline, regexp) |
let curcol = match(matchline, regexp) |
| Line 156 function! s:Match_wrapper(word, forward, |
|
| Line 174 function! s:Match_wrapper(word, forward, |
|
| " If the match comes from the defaults, bail out. |
" If the match comes from the defaults, bail out. |
| if matchline !~ prefix . |
if matchline !~ prefix . |
| \ substitute(s:pat, s:notslash.'\zs[,:]\+', '\\|', 'g') . suffix |
\ substitute(s:pat, s:notslash.'\zs[,:]\+', '\\|', 'g') . suffix |
| norm! % |
silent! norm! % |
| return |
return s:CleanUp(restore_options, a:mode, startline, startcol) |
| endif |
endif |
| endif |
endif |
| if exists("b:match_debug") |
if exists("b:match_debug") |
| Line 167 function! s:Match_wrapper(word, forward, |
|
| Line 185 function! s:Match_wrapper(word, forward, |
|
| |
|
| " Third step: Find the group and single word that match, and the original |
" Third step: Find the group and single word that match, and the original |
| " (backref) versions of these. Then, resolve the backrefs. |
" (backref) versions of these. Then, resolve the backrefs. |
| " Set the following local variables: |
" Set the following local variable: |
| " group = colon-separated list of patterns, one of which matches |
" group = colon-separated list of patterns, one of which matches |
| " = ini:mid:fin or ini:fin |
" = ini:mid:fin or ini:fin |
| " |
" |
| " Reconstruct the version with unresolved backrefs. |
" Reconstruct the version with unresolved backrefs. |
| let patBR = substitute(b:match_words.',', |
let patBR = substitute(match_words.',', |
| \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') |
\ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') |
| let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g') |
let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g') |
| " Now, set group and groupBR to the matching group: 'if:endif' or |
" Now, set group and groupBR to the matching group: 'if:endif' or |
| " 'while:endwhile' or whatever. |
" 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns |
| |
" group . "," . groupBR, and we pick it apart. |
| let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) |
let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) |
| let i = matchend(group, s:notslash . ",") |
let i = matchend(group, s:notslash . ",") |
| let groupBR = strpart(group, i) |
let groupBR = strpart(group, i) |
| Line 185 function! s:Match_wrapper(word, forward, |
|
| Line 204 function! s:Match_wrapper(word, forward, |
|
| if s:do_BR " Do the hard part: resolve those backrefs! |
if s:do_BR " Do the hard part: resolve those backrefs! |
| let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) |
let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) |
| endif |
endif |
| |
if exists("b:match_debug") |
| |
let b:match_wholeBR = groupBR |
| |
let i = matchend(groupBR, s:notslash . ":") |
| |
let b:match_iniBR = strpart(groupBR, 0, i-1) |
| |
endif |
| |
|
| " Fourth step: Set the arguments for searchpair(). |
" Fourth step: Set the arguments for searchpair(). |
| let i = matchend(group, s:notslash . ":") |
let i = matchend(group, s:notslash . ":") |
| Line 223 function! s:Match_wrapper(word, forward, |
|
| Line 247 function! s:Match_wrapper(word, forward, |
|
| endif |
endif |
| |
|
| " Fifth step: actually start moving the cursor and call searchpair(). |
" Fifth step: actually start moving the cursor and call searchpair(). |
| " This minimizes screen jumps and avoids using a global mark. |
" Later, :execute restore_cursor to get to the original screen. |
| let restore_cursor = line(".") . "G" . virtcol(".") . "|" |
let restore_cursor = line(".") . "G" . virtcol(".") . "|" |
| normal! H |
normal! H |
| let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor |
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor |
| execute restore_cursor |
execute restore_cursor |
| " Later, :execute restore_cursor to get to the original screen. |
|
| let restore_options = (&ic ? "" : "no") . "ignorecase" |
|
| if exists("b:match_ignorecase") |
|
| let &ignorecase = b:match_ignorecase |
|
| endif |
|
| " Instead of the next few lines, could I :execute "normal!".(curcol+1)."|" ? |
|
| normal! 0 |
normal! 0 |
| if curcol |
if curcol |
| execute "normal!" . curcol . "l" |
execute "normal!" . curcol . "l" |
| Line 245 function! s:Match_wrapper(word, forward, |
|
| Line 263 function! s:Match_wrapper(word, forward, |
|
| endif |
endif |
| let sp_return = searchpair(ini, mid, fin, flag, skip) |
let sp_return = searchpair(ini, mid, fin, flag, skip) |
| let final_position = line(".") . "normal!" . virtcol(".") . "|" |
let final_position = line(".") . "normal!" . virtcol(".") . "|" |
| " Restore options, cursor position, and original screen. |
" Restore cursor position and original screen. |
| execute "set " . restore_options |
|
| execute restore_cursor |
execute restore_cursor |
| normal!m' |
normal! m' |
| if sp_return > 0 |
if sp_return > 0 |
| execute final_position |
execute final_position |
| " Open folds, if appropriate. |
|
| if a:mode != "o" && &foldopen =~ "percent" |
|
| normal!zv |
|
| endif |
|
| endif |
endif |
| |
return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin) |
| |
endfun |
| |
|
| |
" Restore options and do some special handling for Operator-pending mode. |
| |
" The optional argument is the tail of the matching group. |
| |
fun! s:CleanUp(options, mode, startline, startcol, ...) |
| |
execute "set" a:options |
| |
" Open folds, if appropriate. |
| |
if a:mode != "o" |
| |
if &foldopen =~ "percent" |
| |
normal! zv |
| |
endif |
| |
" In Operator-pending mode, we want to include the whole match |
| |
" (for example, d%). |
| |
" This is only a problem if we end up moving in the forward direction. |
| |
elseif (a:startline < line(".")) || |
| |
\ (a:startline == line(".") && a:startcol < col(".")) |
| |
if a:0 |
| |
" Check whether the match is a single character. If not, move to the |
| |
" end of the match. |
| |
let matchline = getline(".") |
| |
let currcol = col(".") |
| |
let regexp = s:Wholematch(matchline, a:1, currcol-1) |
| |
let endcol = matchend(matchline, regexp) |
| |
if endcol > currcol " This is NOT off by one! |
| |
execute "normal!" . (endcol - currcol) . "l" |
| |
endif |
| |
endif " a:0 |
| |
endif " a:mode != "o" && etc. |
| |
return 0 |
| endfun |
endfun |
| |
|
| " Example (simplified HTML patterns): if |
" Example (simplified HTML patterns): if |
|
|
| " let j = matchend(getline("."), regexp) |
" let j = matchend(getline("."), regexp) |
| " let match = matchstr(getline("."), regexp) |
" let match = matchstr(getline("."), regexp) |
| fun! s:Wholematch(string, pat, start) |
fun! s:Wholematch(string, pat, start) |
| if a:pat =~ '^\\%\=(.*\\)$' |
let group = '\%(' . a:pat . '\)' |
| let group = a:pat |
let prefix = (a:start ? '\(^.\{,' . a:start . '}\)\zs' : '^') |
| else |
|
| let group = '\(' . a:pat . '\)' |
|
| endif |
|
| let prefix = (a:start ? '\(^.\{,' . a:start . '}\)\@<=' : '^') |
|
| let len = strlen(a:string) |
let len = strlen(a:string) |
| let suffix = (a:start+1 < len ? '\(.\{,'.(len-a:start-1).'}$\)\@=' : '$') |
let suffix = (a:start+1 < len ? '\(.\{,'.(len-a:start-1).'}$\)\@=' : '$') |
| if a:string !~ prefix . group . suffix |
if a:string !~ prefix . group . suffix |
| Line 587 fun! s:MultiMatch(spflag, mode) |
|
| Line 626 fun! s:MultiMatch(spflag, mode) |
|
| if !exists("b:match_words") || b:match_words == "" |
if !exists("b:match_words") || b:match_words == "" |
| return "" |
return "" |
| end |
end |
| |
let restore_options = (&ic ? "" : "no") . "ignorecase" |
| |
if exists("b:match_ignorecase") |
| |
let &ignorecase = b:match_ignorecase |
| |
endif |
| |
let startline = line(".") |
| |
let startcol = col(".") |
| |
|
| " First step: if not already done, set the script variables |
" First step: if not already done, set the script variables |
| " s:do_BR flag for whether there are backrefs |
" s:do_BR flag for whether there are backrefs |
| Line 595 fun! s:MultiMatch(spflag, mode) |
|
| Line 640 fun! s:MultiMatch(spflag, mode) |
|
| " This part is copied and slightly modified from s:Match_wrapper(). |
" This part is copied and slightly modified from s:Match_wrapper(). |
| let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . |
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . |
| \ '\/\*:\*\/,#if\%(def\)\=:$else\>:#elif\>:#endif\>' |
\ '\/\*:\*\/,#if\%(def\)\=:$else\>:#elif\>:#endif\>' |
| if (b:match_words != s:last_words) || (&mps != s:last_mps) || |
" Allow b:match_words = "GetVimMatchWords()" . |
| |
if b:match_words =~ ":" |
| |
let match_words = b:match_words |
| |
else |
| |
execute "let match_words =" b:match_words |
| |
endif |
| |
if (match_words != s:last_words) || (&mps != s:last_mps) || |
| \ exists("b:match_debug") |
\ exists("b:match_debug") |
| let s:last_words = b:match_words |
let s:last_words = match_words |
| let s:last_mps = &mps |
let s:last_mps = &mps |
| if b:match_words !~ s:notslash . '\\\d' |
if match_words !~ s:notslash . '\\\d' |
| let s:do_BR = 0 |
let s:do_BR = 0 |
| let s:pat = b:match_words |
let s:pat = match_words |
| else |
else |
| let s:do_BR = 1 |
let s:do_BR = 1 |
| let s:pat = s:ParseWords(b:match_words) |
let s:pat = s:ParseWords(match_words) |
| endif |
endif |
| let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default, |
let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default, |
| \ '[,:]\+','\\|','g') . '\)' |
\ '[,:]\+','\\|','g') . '\)' |
| Line 634 fun! s:MultiMatch(spflag, mode) |
|
| Line 685 fun! s:MultiMatch(spflag, mode) |
|
| normal! H |
normal! H |
| let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor |
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor |
| execute restore_cursor |
execute restore_cursor |
| let restore_options = (&ic ? "" : "no") . "ignorecase" |
|
| if exists("b:match_ignorecase") |
|
| let &ignorecase = b:match_ignorecase |
|
| endif |
|
| |
|
| " Third step: call searchpair(). |
" Third step: call searchpair(). |
| " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. |
" Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. |
| Line 654 fun! s:MultiMatch(spflag, mode) |
|
| Line 701 fun! s:MultiMatch(spflag, mode) |
|
| let level = v:count1 |
let level = v:count1 |
| while level |
while level |
| if searchpair(openpat, '', closepat, a:spflag, skip) < 1 |
if searchpair(openpat, '', closepat, a:spflag, skip) < 1 |
| execute "set " . restore_options |
call s:CleanUp(restore_options, a:mode, startline, startcol) |
| return "" |
return "" |
| endif |
endif |
| let level = level - 1 |
let level = level - 1 |
| endwhile |
endwhile |
| |
|
| " Open folds, if appropriate. |
|
| if a:mode != "o" && &foldopen =~ "percent" |
|
| normal!zv |
|
| endif |
|
| " Restore options and return a string to restore the original position. |
" Restore options and return a string to restore the original position. |
| execute "set " . restore_options |
call s:CleanUp(restore_options, a:mode, startline, startcol) |
| return restore_cursor |
return restore_cursor |
| endfun |
endfun |
| |
|
|
|
| \ '\<!loopondimensions\>\|\<!looponselected\>:\<!endloop\>' |
\ '\<!loopondimensions\>\|\<!looponselected\>:\<!endloop\>' |
| \ | endif |
\ | endif |
| " HTML: thanks to Johannes Zellner. |
" HTML: thanks to Johannes Zellner. |
| au FileType html,jsp if !exists("b:match_words") | |
au FileType html,jsp,php if !exists("b:match_words") | |
| \ let b:match_ignorecase = 1 | |
\ let b:match_ignorecase = 1 | |
| \ let b:match_skip = 's:Comment' | |
\ let b:match_skip = 's:Comment' | |
| \ let b:match_words = '<:>,' . |
\ let b:match_words = '<:>,' . |
|
|
| \ '^%package:^%preun:^%postun:^%changelog' |
\ '^%package:^%preun:^%postun:^%changelog' |
| \ | endif |
\ | endif |
| " Tcsh: see Csh |
" Tcsh: see Csh |
| " Verilog: thanks to Mark Collett |
|
| au FileType verilog if !exists("b:match_words") | |
|
| \ let b:match_ignorecase = 0 |
|
| \ | let b:match_words = |
|
| \ '\<begin\>:\<end\>,'. |
|
| \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,'. |
|
| \ '\<module\>:\<endmodule\>,'. |
|
| \ '\<function\>:\<endfunction\>,'. |
|
| \ '`ifdef\>:`else\>:`endif\>' |
|
| \ | endif |
|
| " XML: thanks to Johannes Zellner and Akbar Ibrahim |
" XML: thanks to Johannes Zellner and Akbar Ibrahim |
| " - case sensitive |
" - case sensitive |
| " - don't match empty tags <fred/> |
" - don't match empty tags <fred/> |
|
|
| " - match <!, > inlined dtd's. This is not perfect, as it |
" - match <!, > inlined dtd's. This is not perfect, as it |
| " gets confused for example by |
" gets confused for example by |
| " <!ENTITY gt ">"> |
" <!ENTITY gt ">"> |
| au! FileType xml,sgml,entity if !exists("b:match_words") | |
au! FileType xml,sgml,entity,xslt,svg,xhtml,xsl,xsd |
| |
\ if !exists("b:match_words") | |
| \ let b:match_ignorecase=0 | let b:match_words = |
\ let b:match_ignorecase=0 | let b:match_words = |
| \ '<:>,' . |
\ '<:>,' . |
| \ '<\@<=!\[CDATA\[:]]>,'. |
\ '<\@<=!\[CDATA\[:]]>,'. |
|
|
| |
|
| let &cpo = s:save_cpo |
let &cpo = s:save_cpo |
| |
|
| " vim:sts=2:sw=2: |
" vim:sts=2:sw=2:ff=unix: |