Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
vb.vim76 linesDownload Raw Back to ftplugin
1" Vim filetype plugin file2" Language:		Visual Basic (ft=vb)3" Maintainer:		Doug Kearns <dougkearns@gmail.com>4" Previous Maintainer:	Johannes Zellner <johannes@zellner.org>5" Last Change:		2024 Jan 146 7if exists("b:did_ftplugin")8  finish9endif10let b:did_ftplugin = 111 12let s:cpo_save = &cpo13set cpo&vim14 15setlocal comments=sr:'\ -,mb:'\ \ ,el:'\ \ ,:'16setlocal commentstring='\ %s17setlocal formatoptions-=t formatoptions+=croql18 19let b:undo_ftplugin = "setlocal com< cms< fo<"20 21" we need this wrapper, as call doesn't allow a count22function! s:VbSearch(pattern, flags)23    let cnt = v:count124    while cnt > 025	call search(a:pattern, a:flags)26	let cnt = cnt - 127    endwhile28endfunction29 30if !exists("no_plugin_maps") && !exists("no_vb_maps")31  nnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>32  vnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>33  nnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>34  vnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>35  nnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>36  vnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>37  nnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>38  vnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>39  let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" .40	\		 " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" .41	\		 " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" .42	\		 " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['"43endif44 45" TODO: line start anchors are almost certainly overly restrictive - allow46" after statement separators.  Even in QuickBasic only block IF statements47" were required to be at the start of a line.48if exists("loaded_matchit") && !exists("b:match_words")49  let b:match_ignorecase = 150  let b:match_words =51	\ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*\%($\|''\):\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' .52	\ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' .53	\ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' .54	\ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' .55	\ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' .56	\ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' .57	\ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' .58	\ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' .59	\ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>'60  let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"61endif62 63if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")64  let b:browsefilter = "Visual Basic Source Files (*.bas)\t*.bas\n" .65	\	       "Visual Basic Form Files (*.frm)\t*.frm\n"66  if has("win32")67    let b:browsefilter .= "All Files (*.*)\t*\n"68  else69    let b:browsefilter .= "All Files (*)\t*\n"70  endif71  let b:undo_ftplugin .= " | unlet! b:browsefilter"72endif73 74let &cpo = s:cpo_save75unlet s:cpo_save76 
codekingpro/portable-devtools · Team Ai