vb.vim 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. " Vim filetype plugin file
  2. " Language: VisualBasic (ft=vb)
  3. " Maintainer: Johannes Zellner <johannes@zellner.org>
  4. " Last Change: Thu, 22 Nov 2001 12:56:14 W. Europe Standard Time
  5. if exists("b:did_ftplugin") | finish | endif
  6. let b:did_ftplugin = 1
  7. setlocal com=sr:'\ -,mb:'\ \ ,el:'\ \ ,:'
  8. " we need this wrapper, as call doesn't allow a count
  9. fun! <SID>VbSearch(pattern, flags)
  10. let cnt = v:count1
  11. while cnt > 0
  12. call search(a:pattern, a:flags)
  13. let cnt = cnt - 1
  14. endwhile
  15. endfun
  16. let s:cpo_save = &cpo
  17. set cpo&vim
  18. " NOTE the double escaping \\|
  19. nnoremap <buffer> <silent> [[ :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'bW')<cr>
  20. nnoremap <buffer> <silent> ]] :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'W')<cr>
  21. nnoremap <buffer> <silent> [] :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'bW')<cr>
  22. nnoremap <buffer> <silent> ][ :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'W')<cr>
  23. " matchit support
  24. if exists("loaded_matchit")
  25. let b:match_ignorecase=1
  26. let b:match_words=
  27. \ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*$:\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' .
  28. \ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' .
  29. \ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' .
  30. \ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' .
  31. \ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' .
  32. \ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' .
  33. \ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' .
  34. \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' .
  35. \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>'
  36. endif
  37. let &cpo = s:cpo_save
  38. unlet s:cpo_save